From:             [EMAIL PROTECTED]
Operating system: slackware linux (kernel 2.2.19)
PHP version:      4.1.1
PHP Bug Type:     Math related
Bug description:  (int) cast doesn't work properly

i'm writing a little internet shop in php.
i found really bad bug, which can make a lot of losses to somebody...

may be i'm using cast not good way, but i call this bug anyway.

consider this script:

<?
$price = 33.44;

echo "the price is: $price <BR>";

$price_dolars = floor($price);

echo "number of cents is: " . ($price - $price_dolars)*100 . "<BR>";
// we can see value of 44

echo "but as integer it would be: " . (int)(($price - $price_dolars)*100)
. "<BR>";
// but now it is 43

?>

-- 
Edit bug report at: http://bugs.php.net/?id=15162&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to