0

我有一个类似于 4.0157725356416E+24 的浮点数组,它们没有被四舍五入round()。(看门狗是一个drupal日志工具)

$score = ($results['results'][0]['score']);
watchdog( 'multi', "float: $score");

$score = ($score * 100);
watchdog( 'multi', "percent (". gettype($score) . "): $score");

$score = round( $score );
watchdog( 'multi', "round: $score");

这个的输出是:

> float: 1.9532660466727E+25
> percent (double): 1.9532660466727E+27
> round: 1.9532660466727E+27

我在这里遗漏了一些东西......

4

1 回答 1

3

您正在查看指数数字(即 1.9532660466727 * 10 ^ 27)。它们仍在四舍五入到最接近的整数,它们只是巨大的。

与 1,953,266,046,672,700,000,000,000,000 相同

于 2012-07-26T17:19:56.573 回答