ID:               43867
 Updated by:       [EMAIL PROTECTED]
 Reported By:      pjotrik at post dot cz
-Status:           Open
+Status:           Bogus
 Bug Type:         *Math Functions
 Operating System: Windows XP SP2
 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-01-16 15:46:00] pjotrik at post dot cz

Sorry, I have a better example:

echo (4.3*((100-25)/100));
    ----> result: 3.225

echo round(4.3*((100-25)/100),2);
    ----> result: 3.22

echo round(3.225,2);
    ----> result: 3.23

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

[2008-01-16 15:13:49] pjotrik at post dot cz

Description:
------------
When I try to round a number like X.YZ5 with precision 2, I get X.YZ,
but Z number should be incremented to Z+1

Reproduce code:
---------------
$a=round(2.225,2);

Expected result:
----------------
$a=2.23

Actual result:
--------------
$a=2.22


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


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

Reply via email to