ID:               33030
 Updated by:       [EMAIL PROTECTED]
 Reported By:      justandy at lagparty dot org
-Status:           Open
+Status:           Bogus
 Bug Type:         Math related
 Operating System: XP
 PHP Version:      5CVS-2005-05-13 (dev)
 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:
------------------------------------------------------------------------

[2005-05-13 22:59:13] justandy at lagparty dot org

Description:
------------
PHP 5.0.0 (cli) (built: Jul 13 2004 21:39:58)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.0, Copyright (c) 1998-2004 Zend Technologies

// 

Subtraction for floating point numbers is incorrect. 
I searched the existing bug reports and could not find anything
similar. 

Running the same version on LINUX reports the correct value.


Reproduce code:
---------------
<?
//CORRECT: 0.03
echo 1.06 - 1.03; 

//WRONG : 0.029999999999999
echo 6.06 - 6.03;
?>

Expected result:
----------------
0.03

Actual result:
--------------
0.029999999999999


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=33030&edit=1

Reply via email to