ID: 44311 Updated by: [EMAIL PROTECTED] Reported By: sawas at poczta dot onet dot pl -Status: Open +Status: Bogus Bug Type: Math related Operating System: WinXP, Debian PHP Version: 4.4.8 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-02 13:25:44] sawas at poczta dot onet dot pl Description: ------------ I found a bug in arithmetic operation. Simple subtraction of amounts gives inaccurate result. Reproduce code: --------------- $a = 160.00 + 5.90 + 7.52; $b = 173.42; print $a-$b; Expected result: ---------------- 0 Actual result: -------------- 2.8421709430404E-014 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44311&edit=1