ID:               30048
 User updated by:  joerg dot klein at ifsam dot lu
 Reported By:      joerg dot klein at ifsam dot lu
 Status:           Bogus
 Bug Type:         *Math Functions
 Operating System: win2000
 PHP Version:      5.0.0
 New Comment:

That's the cause, but not the solution.


Previous Comments:
------------------------------------------------------------------------

[2004-09-10 11:09:02] [EMAIL PROTECTED]

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.
 
Thank you for your interest in PHP.

.

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

[2004-09-10 10:48:00] joerg dot klein at ifsam dot lu

Description:
------------
I use a fomular as the first paramter and the result is wrong. 
When brackets were set, the result is correct, but this makes no sense
to me.

Reproduce code:
---------------
echo round(0.35*90/100);
echo number_format(0.35*90/100, 2, ".", "");

to get the correct result I should use the following syntax:
echo round(0.35* (90/100) )
echo number_format(0.35* (90/100) , 2, ".", "");

Expected result:
----------------
0.32
0.32

Actual result:
--------------
0.31
0.31


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


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

Reply via email to