Jump to content
  • Advertisement
Sign in to follow this  
Baiame

Unity Floating point consistency across different machines (x86, Windows, VC++)

This topic is 3649 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm aware that this topic has come up many times before (I believe I've read most or all such threads), but I need a bit more specific information on how to achieve it. Apparently it is possible:
Quote:
Original post by mattnewportIt's possible to use floating point math for your simulation and get deterministic results across different processors, you just have to be a bit careful. If you have the same floating point precision settings across all machines and are running identical code then all current AMD and Intel processors give consistent (bit identical) results for floating point arithmetic.
(from http://www.gamedev.net/community/forums/topic.asp?topic_id=448857&PageSize=25&WhichPage=2) So how is it done? I understand the Windows API has several _controlfp functions to set the internal floating-point precision. But why do the constants for the precision listed here: http://msdn.microsoft.com/en-us/library/c9676k6h(VS.80).aspx only go up to 64? As far as I know the default internal precision on x86 hardware is 80 bits. Is there anything else I must set to ensure consistency? Finally, I obviously need to be extremely careful with external libraries. I'll be using open-source ones for all simulation-relevant tasks, so I can check the code, but what should I look out for? Of course many of those libraries probably use SC++L functions, and according to mattnewport MS's implementation uses processor-specific optimizations. Can I disable them entirely in VS2008 (and the default compiler)? EDIT- Guess I actually have two alternatives for the last part: GCC, if you can disable the optimizations in that (can you?), or a good free C++ math library I can use in place of the SC++L in the libraries I'm using (know of any that do at least the same stuff as the SC++L?). Sorry for the barrage of questions but it's all pretty crucial. Thanks for answering any of them. [Edited by - Baiame on July 1, 2008 1:21:52 AM]

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!