Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,我似乎无法弄清楚如何逐步添加一个非常小的数字?
$val = 0.000000001; $add = 0.000000001; for ($i=0; $i < 100; $i++) { $val = bcadd($val, $add, 9); echo $val.'<br>'; } // echo // 0.000000000 // 0.000000000 // . . .
有人可以帮忙吗??
<?php $val = "0.000000001"; $add = "0.000000001"; for ($i=0; $i < 100; $i++) { $val = bcadd($val, $add, 9); echo $val.'<br>'; } exit; ?>
它有效:) 正如一些同事解释的那样,bacadd 需要参数是字符串。