Possible Duplicate:
Floating point inaccuracy examples
PHP rounding issue - Is this a bug?
Found what may be a bug in PHP, but I wanted to check to see if it's just some weird calculation or something that someone already knows about.
An example:
$available = 64.02;
$spent = 64.01;
$available -= $spent;
print $available."<br />";
I'd expect the result to be 0.01, right? However, I get 0.00999999999999.
If you do this for any integer less than 64 (ex: 45.02 - 45.01) I get the correct 0.01 result. Anything greater than or equal to 64, however, gives me 0.00999999999999.
I've tested in PHP 5.2.17 and PHP 5.2.12. Tried to google it, but couldn't find anything. Can any one shed any light on this issue?