#44405 [Opn->Bgs]: Math calculation problem with 1.19 - 1
| From: | pajoye@php.net | Date: | Tue, 11 Mar 2008 11:25:02 +0000 |
| Subject: | #44405 [Opn->Bgs]: Math calculation problem with 1.19 - 1 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-123171@lists.php.net to get a copy of this message | ||
ID: 44405
Updated by: pajoye@php.net
Reported By: thbley at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: *General Issues
Operating System: WinVista
PHP Version: 5.2.5
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-03-11 11:04:00] thbley at gmail dot com
Description:
------------
There seems to be a problem with the numeric calculation:
if ( (1.19 - 1) == 0.19 ) {
echo "@@";
}
The expression "(1.19 - 1) == 0.19" does not evaluate to true.
My environments (problem exists on both platforms):
WinVista: PHP 5.25
Debian: 5.2.0-8+etch10
Reproduce code:
---------------
if ( (1.19 - 1) == 0.19 ) {
echo "@@";
}
Expected result:
----------------
output: @@
Actual result:
--------------
output: <nothing>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44405&edit=1