加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 为什么我的浮点数在MYSQL中以大于1的形式存储为.9999?

发布时间:2020-12-13 18:28:22 所属栏目:PHP教程 来源:网络整理
导读:我将处理时间作为float(4,4)存储在 MySQL数据库中. $start_time = microtime( TRUE );// things happen in my script$end_time = microtime( TRUE );$process_time = $end_time - $start_time;// insert $process time into mysql table $process_time总是在
我将处理时间作为float(4,4)存储在 MySQL数据库中.
$start_time = microtime( TRUE );

// things happen in my script

$end_time = microtime( TRUE );
$process_time = $end_time - $start_time;

// insert $process time into mysql table

$process_time总是在输出到命令行时正确显示,但是如果它的值大于1,它将以mysql存储为.9999.

是什么赋予了?

float(4,4)表示总共4位数,其中4位在小数点后面.
所以你必须改为10,4例如

MySQL permits a nonstandard syntax: FLOAT(M,D) or REAL(M,D) or DOUBLE PRECISION(M,D). Here,“(M,D)” means than values can be stored with up to M digits in total,of which D digits may be after the decimal point.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读