Bug #52415 [Opn->Bgs]: Round Off Error
| From: | aharvey@php.net | Date: | Fri, 23 Jul 2010 10:41:47 +0000 |
| Subject: | Bug #52415 [Opn->Bgs]: Round Off Error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-152663@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52415&edit=1
ID: 52415
Updated by: aharvey@php.net
Reported by: benjamin at aceinformatique dot com
Summary: Round Off Error
-Status: Open
+Status: Bogus
Type: Bug
Package: *General Issues
Operating System: Windows
PHP Version: 5.2.14
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:
------------------------------------------------------------------------
[2010-07-23 12:36:18] benjamin at aceinformatique dot com
Description:
------------
There are a round off problems with add/sub of floating values
for instance 0.27+0.34 is not equal to 0.61
0.27+0.34-0.61 != 0
Test script:
---------------
<?php
echo((0.27+0.34)-0.61);
?>
Expected result:
----------------
0
Actual result:
--------------
1.1102230246252E-16
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52415&edit=1