c++ floating point precision loss: 3015/0.00025298219406977296

后端 未结 5 2119
陌清茗
陌清茗 2021-02-05 10:26

The problem.

Microsoft Visual C++ 2005 compiler, 32bit windows xp sp3, amd 64 x2 cpu.

Code:

double a = 3015.0; 
double b = 0.00025298219406977296         


        
5条回答
  •  天涯浪人
    2021-02-05 11:27

    Are you using directx in your program anywhere as that causes the floating point unit to get switched to single precision mode unless you specifically tell it not to when you create the device and would cause exactly this

提交回复
热议问题