【发布时间】:2014-06-07 20:19:08
【问题描述】:
我编写了一个函数来在必要时将逗号和零添加到数字中,但我已经陷入了模数函数的困境。根据我的PHP:
float(877.5) % 1 == 0 //true
不应该877.5 % 1 == 0.5吗?
【问题讨论】:
-
Operands of modulo are converted to integers (by stripping the decimal part) before processing. For floating-point modulo, see fmod().reference 。谢谢提问
标签: php floating-point modulus