double x = 10000.000000000;
double y = 0.0001;
double z = y+x;
at the begining of the program it works fine, z == 10000.000100000 If
I run it after calling CreateDevice to create the D3D device, z ==
10000.000000000 Any thoughts? Does D3D screw around with the
floating point processor registers in some way?
Is it okay to change the FPU control word back to 53 bits of precision
during the function where I'm using doubles and then back to 24 at the
end of the function? Or is this going to cause problems if an
interupt occurs while the function is running?
I haven't used this, but it looks like this is a feature. D3D uses floats
internally & it looks like this is done so that FPU precision state change
is minimal. But you can override this behavior when calling CreateDevice()
by passing it the D3DCREATE_FPU_PRESERVE. This will do what you suggest, but
at a performance penalty. Some docs is at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dx8_c/direc
tx_cpp/Graphics/Reference/CPP/D3D/Interfaces/IDirect3D8/CreateDevice.asp
I looked it up in the D3D docs and it discusses it. Looks like the
best thing to do is set the precision to 53 bits in the function I
need it in, then switch back at the end of the function.