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.
我有以下代码
$suma += round(1*43067.8000,2); $suma += round(-1*18875.1800,2); $suma += round(-1*15293.9700,2); $suma += round(-1*8898.6500,2); print $suma;
输出为 3.6379788070917E-12
如果数字在加法之前四舍五入,为什么答案不是 0?
Round 仍然返回一个浮点数。因为它是一个浮点数,所以可能总是会有非常小的错误。在这种情况下,这会导致您的答案不同于 0。
通过 php 函数来自 wordpress 短代码的标签