ID:               41338
 Updated by:       [EMAIL PROTECTED]
 Reported By:      kjarli at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Math related
 Operating System: Windows vista
 PHP Version:      5.2.2
 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:
------------------------------------------------------------------------

[2007-05-09 09:10:26] kjarli at gmail dot com

Description:
------------
when creating formulas, i encountered a strange bug:
this is the basic forumula:
ceil(user_hp * 1.1)

when user_hp = 100 you get the following formula

ceil(100*(110/100)) in my script.

this will result 111 instead of 110


Reproduce code:
---------------
<?php
$lol1 = ceil(100 * (110 / 100));
$lol2 = ceil(100 * 1.1);
$lol3 = ceil(110);
$lol4 = ceil(110.0);

echo $lol1;
?> 
<br />
<?php
echo $lol2;
?> 
<br />
<?php
echo $lol3;
?> 
<br />
<?php
echo $lol4;
?>

Expected result:
----------------
110
110
110
110


Actual result:
--------------
111
111
110
110


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


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

Reply via email to