Hi:
Why is the "floor" function returning 27564 instead of 27565 in this script? PHP version is 4.2.2.
Thanks! Ruben.
#!/usr/bin/php -q
<?php
$b = 275.65 * 100;
$b = (int)$b;
/*
$b was a floating point number with value something like 27564.9999989, when displayed it shows correctly 27565, but in calculations 27564.9999989 is used.
Q: Do you know why pentiums are faster than 486 processors? A: Because 486 computes, pentium guesses.
*/
echo "\n\nb= ".$b; echo "\nfloor(b)= ".floor($b); // Incorrect. why 27564?
$b = 27565; echo "\n\nb= ".$b; echo "\nfloor(b)= ".floor($b)."\n\n"; // Correct
?>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php