From: [EMAIL PROTECTED]
Operating system: Windows
PHP version: 4.1.2
PHP Bug Type: Math related
Bug description: Floating point calculation bug or float() function bug
Here's the code
<?
$quantities = array(5000.00, 1000.00, 200.00);
$amount = 6200;
debug($quantities);
foreach ($quantities as $quantity) {
$divVal = ($amount/$quantity);
echo ++$i.". Quantity:\n".$quantity."<BR>";
echo "divVal: ".$divVal." - ".var_dump($divVal)."<BR>\n";
echo "Amount: ".$amount."\n";
if (floor($divVal) > 0) {
echo " [floored divVal is greater than zero]\n";
$amount = ($divVal - floor($divVal)) * $quantity;
}
echo "<BR><BR>";
}
?>
You'll see the floor function is operating incorrectly?
--
Edit bug report at http://bugs.php.net/?id=16544&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=16544&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=16544&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=16544&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=16544&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16544&r=support
Expected behavior: http://bugs.php.net/fix.php?id=16544&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=16544&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=16544&r=submittedtwice