in reply to Re^2: Why the Integer part of this calculation is 102?
in thread Why the Integer part of this calculation is 102?
Both 3408/10000 and 9936/10000 are periodic numbers in binary, just like 1/3 is a periodic number in decimal. It would take infinite storage to store them as floats, so they're not being stored exactly.
You can avoid the problem by using sprintf("%.0f", $x) (rounds) instead of int($x) (truncates).
|
|---|