ID: 15164
Updated by: jan
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Bogus
Bug Type: Math related
Operating System: linux 2.2.19
PHP Version: 4.1.1
New Comment:

floats are not supposed to be exact (per definition). do not use them
on currencies. calculate cents ant use (agein) number_format() to
display them prooperly. No bug in PHP, bogus.


Previous Comments:
------------------------------------------------------------------------

[2002-01-22 09:17:32] [EMAIL PROTECTED]

my previous bug report was 15162. i wrote about (int) cast there.
another bug may be a reason of that.

i do: (267.57 - 267) * 100 
and i get: 57.999999999999
(i expected 57)
[may be i work too much...]

consider this:

<?
$price = 267.57;
$price_dolars = floor($price);
echo "number of cents is: " . ($price - $price_dolars)*100 . "<BR>";
?>


------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=15164&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