dsc71976 2019-03-04 11:56
浏览 86
已采纳

array_sum PHP错误的结果[重复]

This question already has an answer here:

the result of this should be zero!

echo array_sum([-61.50,50.00,10.50,1.00,0.00,50.00,-16.73,-20.00,-55.75,42.48]);

Why is giving -7.105427357601E-15?

</div>
  • 写回答

3条回答 默认 最新

  • dougang6821 2019-03-04 12:02
    关注

    Just try round(), you will get the same result.

    echo round(array_sum([-61.50,50.00,10.50,1.00,0.00,50.00,-16.73,-20.00,-55.75,42.48]));
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?