#28536 [Opn->Bgs]: Invalid Calculation: 90.99-90.00 = 0.98999999999999 ... when it should be 0.99
| From: | gschlossnagle@php.net | Date: | Wed, 26 May 2004 20:06:23 +0000 |
| Subject: | #28536 [Opn->Bgs]: Invalid Calculation: 90.99-90.00 = 0.98999999999999 ... when it should be 0.99 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-60047@lists.php.net to get a copy of this message | ||
ID: 28536
Updated by: gschlossnagle@php.net
Reported By: hart0550 at umn dot edu
-Status: Open
+Status: Bogus
Bug Type: Math related
Operating System: Linux
PHP Version: 4.3.4
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Welcome to the world of floating point numbers. This is
how it works.
Previous Comments:
------------------------------------------------------------------------
[2004-05-26 22:04:41] hart0550 at umn dot edu
Description:
------------
When calculating 90.99 minus 90.00 it returns 0.98999999999999 which is
a bit big for a simple subtraction of two floats that only have 2
decimal numbers.
Reproduce code:
---------------
<?php
$calc = 90.99 - 90.00;
print $calc;
?>
Expected result:
----------------
.99
Actual result:
--------------
0.98999999999999
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28536&edit=1