[PHP] 有关PHP浮点数默认显示位数 precision 以及如何调整

PHP 以浮点数显示的有效位数默认是 14 位。-1 表示将使用一种增强的算法来四舍五入这些数字。

如果想显示更长的浮点位数,可以设置如:ini_set('precision', 40);

有两点需要注意:1. 该设置只是控制显示精度,和查询精度无关。2. 遇到计算和round函数时,显示上依然会以该配置为准。

Doc:https://www.php.net/manual/en/ini.core.php#ini.precision

Link:https://www.cnblogs.com/farwish/p/14177705.html

原文地址:https://www.cnblogs.com/farwish/p/14177705.html