visual c++ - Different values depending on floating point exception flags set -
short question: how can setting _em_invalid exception flag on fpu result in different values? long question: in our project have turned off floating point exceptions in our release build, turned on zerodivide, invalid , overflow using _controlfp_s() in our debug build. in order catch errors if there. however, results of numerical calculations (involving optimisation algorithms, matrix inversion, monte carlo , sorts of things) consistent between debug , release build make debugging easier. i expect setting of exception flags on fpu should not affect calculated values - whether exceptions thrown or not. after working backwards through our calculations can isolate below code example shows there difference on last bit when calling log() function. this propagates 0.5% difference in resulting value. the below code give shown program output when adding new solution in visual studio 2005, windows xp , compile in debug configuration. (release give different output, that's ...