duanjin9035 2013-03-04 07:39
浏览 170

PHP给出8.8817841970013E-016而不是0

I am doing a simple calculation in PHP.

(2.70 + 2.30 + 29.70 + -2.30 + -29.70 + -2.70) - got these figures from a database

PHP is giving 8.8817841970013E-016 as answer instead of zero.

I have tried functions like round, number_format but still get the same results

  • 写回答

4条回答 默认 最新

  • doulan3436 2013-03-04 07:43
    关注

    try this

    round(2.70 + 2.30 + 29.70 - 2.30 - 29.70 - 2.70)
    
    评论

报告相同问题?

悬赏问题

  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)