Bug #54224 [Opn->Bgs]: Sum comutative operation fails with minus on front
Edit report at http://bugs.php.net/bug.php?id=54224&edit=1
ID: 54224
Updated by: scottmac@php.net
Reported by: philip dot almeida at freedomson dot com
Summary: Sum comutative operation fails with minus on front
-Status: Open
+Status: Bogus
Type: Bug
Package: Math related
Operating System: Linux
PHP Version: Irrelevant
Block user comment: N
Private report: N
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://www.floating-point-gui.de/
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2011-03-11 12:31:04] philip dot almeida at freedomson dot com
Description:
------------
Making a comutative sum operation the result does not return the
expected value.
Test script:
---------------
echo -6.3536+5+1.3536;
= -2.22044604925E-16
echo -6.3537+5+1.3537
= 0
Expected result:
----------------
Always 0
Actual result:
--------------
-2.22044604925E-16
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54224&edit=1
Thread (2 messages)