Unexpected result in floor function

From: Date: Mon, 17 Nov 2003 12:52:20 +0000
Subject: Unexpected result in floor function
Groups: php.general 
Request: Send a blank email to php-general+get-169930@lists.php.net to get a copy of this message
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; 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
?>

« previous php.general (#169930) next »