Trying to port java code to C ++ I came across some strange behavior. I cannot get a double complement to work (even if the compiler option is / fp: strict, which means that the “correct” floating-point math is set in Visual Studio 2008).
double a = 0.4;
double b = 0.0 + 0.4;
double c = 0;
float f = 0.4f;
c += f;
In another test project that I set up, it works fine (/ fp: strict behaves according to IEEE754).
Using Visual Studio 2008 (standard) without optimization and FP: strict.
Any ideas? Does it truncate swimming? This project really requires the same behavior on the Java and C ++ side. I got all the values by reading from the debug window in VC ++.
: _fpreset();// . FP .