Why does 0.06 + 0.01 = 0.07 in ColdFusion?

后端 未结 1 1457
你的背包
你的背包 2020-12-20 11:20

Why don\'t math operations in ColdFusion seem to be affected by floating point math issues? Take the code:

result = 0.06 + 0.01;

writedump(result);
writedu         


        
相关标签:
1条回答
  • 2020-12-20 11:25

    I strongly suspect it's simply rounding differently on output. In other words, the issue is still there - it just happens not to show up when this particular value is printed out with writedump.

    What happens if you use:

    writedump(String.valueOf(result));
    

    ?

    0 讨论(0)
提交回复
热议问题