4 ms·
I noticed this comment in the "notes.html": // Set the floating point precision ... _controlfp // Question: Why do that for ev
by 0x0 15y ago
I noticed this comment in the "notes.html":
// Set the floating point precision ...
_controlfp
// Question: Why do that for every frames ? Probably because precision is altered during the loop execution.
// Answer: The is no other call to this function. It appears that floating point precision remains the same during program execution.
I seem to vaguely recall reading something about some versions of Windows not preserving the FPU state across task switches. Could it be that this call to configure the FPU for every frame is a workaround for that?
- AshleysBrain 15y agoMaybe it's because the calls to functions in DLLs could, in theory, change it?
- apaprocki 15y agohttp://gafferongames.com/networking-for-game-programmers/floating-point-determinism/ http://gafferongames.com/networking-for-game-programmers/flo... Search for _controlfp.. seems some MS API calls could change it.
- daemin 15y agoI've also experienced Windows / DirectX API's use MMX, hence the floating point code I was using (x87 FPU) required a femms instruction before it to change back from MMX state. This just goes to show that if you need a particular state on a processor (CPU, FPU, GFX, etc) you need to set it explicitly before use.
- cdavid 15y agoYou may mix up with linux (which does not save the FPU state: that's why you can't use most floating point operations in the kernel).