#46613 [Opn->Bgs]: 55.76 value wrong interpreted
| From: | pajoye@php.net | Date: | Wed, 19 Nov 2008 13:43:25 +0000 |
| Subject: | #46613 [Opn->Bgs]: 55.76 value wrong interpreted | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-131108@lists.php.net to get a copy of this message | ||
ID: 46613
Updated by: pajoye@php.net
Reported By: nylas2u at yahoo dot com
-Status: Open
+Status: Bogus
Bug Type: MySQL related
Operating System: Windows XP
PHP Version: 5.2.6
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:
------------------------------------------------------------------------
[2008-11-19 13:21:13] nylas2u at yahoo dot com
I also whant to clarify that the value is tored in an mysql field, and
from mysql operation seems to be correct but using php script i have
this problem
------------------------------------------------------------------------
[2008-11-19 13:18:30] nylas2u at yahoo dot com
Description:
------------
I have an apache+php+mysql server. If i store in one field this value :
55.76 and after that reapitly decreasing this value to zero, after the
las decrease i never can make the value to be zero.
I over verified my script it works in this way with any value like
12.28 even when using 55.76005 but never for 55.76
Reproduce code:
---------------
Example :
55.76 - 10 = 44.76
44.76 - 33 = 11.76
11.76 - 11.76 = 1.17... * E-15
Expected result:
----------------
of course that expected result should be zero
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46613&edit=1