#39425 [Opn->Bgs]: Specific BUG in DOUBLE mathematics!!!
| From: | pajoye@php.net | Date: | Wed, 08 Nov 2006 12:07:00 +0000 |
| Subject: | #39425 [Opn->Bgs]: Specific BUG in DOUBLE mathematics!!! | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-104570@lists.php.net to get a copy of this message | ||
ID: 39425
Updated by: pajoye@php.net
Reported By: jvano at read dot sk
-Status: Open
+Status: Bogus
Bug Type: *General Issues
Operating System: Irrelevant (All)
PHP Version: 5.2.0
New Comment:
Floating point values have a limited precision. Hence a value might
not have the same string representation after any processing. That also
includes writing a floating point value in your script and directly
printing it without any mathematical operations.
If you would like to know more about "floats" and what IEEE
754 is read this:
http://docs.sun.com/source/806-3568/ncg_goldberg.html
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2006-11-08 08:04:10] jvano at read dot sk
Description:
------------
Problem is in all versions of PHP.
Problem is in basic mathematic operation (+/-) wiht double. When I use
simple values and make some basic operation, for example (5.7 - (1.4 +
4.3)).
This problem is in another combinations but not in all.
Reproduce code:
---------------
<?php
echo (5.7 - (1.4 + 4.3));
?>
Expected result:
----------------
In all cases is expected 0(zero). But result is always +/-
8.881784197E-016.
Actual result:
--------------
I think that problem is in representation of double value.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39425&edit=1