Why are doubles added incorrectly in a specific Visual Studio 2008 project?

前端 未结 2 1910
南旧
南旧 2021-01-03 03:35

Trying to port java code to C++ I\'ve stumbled over some weird behaviour. I can\'t get double addition to work (even though compiler option /fp:strict which means \"correct\

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-03 04:13

    The only thing I can think of is perhaps you are linking against a library or DLL which has modified the CPU precision via the control word.

    Have you tried calling _fpreset() from float.h before the problematic computation?

提交回复
热议问题