Jump to content
  • Advertisement
Sign in to follow this  
Richy2k

Floating point determinism.

This topic is 4097 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

Quote:
Original post by hplus0603
Quote:
Same exe, different machines.


That means it's a problem with the exe. You have to make sure that the internal precision is set to 64 bits (not 80, because only Intel implements that), and that the rounding mode is consistent. Furthermore, you have to check this after calls to external DLLs, because many DLLs (Direct3D, printer drivers, sound libraries, etc) will change the precision or rounding mode without setting it back.

Also, you can't use SSE or SSE2 for floating point, because it's too under-specified to be deterministic.
Do you know of an extensive study of this to see to what degree chip makers comply with the IEEE standard? This is obviously not the sort of thing you'd risk basing the network model for a large game project on without a great deal of testing.
One might easily imagine a slight bug in a transcendental function on a VIA processor might go undetected for a long time. Or (more likely) an emulator skimping a bit on the floating point precision for performance reasons, e.g. if the Itanium had taken off, PS2 backwards-compatibility on the PS3, or a PPC Mac user running Virtual PC.
But then again perhaps they test these sort of things extensively nowadays, at least I don't see Intel forgetting the whole Pentium FDIV debacle anytime soon.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Do you know of an extensive study of this to see to what degree chip makers comply with the IEEE standard? This is obviously not the sort of thing you'd risk basing the network model for a large game project on without a great deal of testing.


The ISA is IEEE compliant. If your x87 implementation isn't IEEE, it's not x87.

The technology we license to various customers is based on determinism of floating point (in 64-bit mode, even) and has worked that way since the year 2000.

Share this post


Link to post
Share on other sites
Quote:
Original post by hplus0603
Quote:
Same exe, different machines.


That means it's a problem with the exe. You have to make sure that the internal precision is set to 64 bits (not 80, because only Intel implements that), and that the rounding mode is consistent. Furthermore, you have to check this after calls to external DLLs, because many DLLs (Direct3D, printer drivers, sound libraries, etc) will change the precision or rounding mode without setting it back.


I hate to ask as usually a google will suffice - but I've had no luck with this one. How do you go about setting the internal precision to 64 bits? Would be greatly appreciated!

Share this post


Link to post
Share on other sites
Quote:

I hate to ask as usually a google will suffice - but I've had no luck with this one. How do you go about setting the internal precision to 64 bits? Would be greatly appreciated!


in C/C++ i think the command is _controlfp_s() which takes a couple of bit masks where you can set different floating point settings.

Share this post


Link to post
Share on other sites
http://msdn.microsoft.com/en-us/library/c9676k6h(VS.80).aspx should tell you what you need to know.

I think I'm in the same position as you at the moment. Apparently the VC++ implementation of the C/C++ math library uses processor-specific optimizations, so you'll need another math library anyway, making STREFLOP the best option.

EDIT: ...unless you're using MSVC++.

[Edited by - Baiame on July 7, 2008 11:22:31 PM]

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!