ID: 48939 User updated by: louis at frenzoo dot com Reported By: louis at frenzoo dot com -Status: Feedback +Status: Closed Bug Type: Math related Operating System: Linux PHP Version: 5.2.10 New Comment:
Sorry to disturb. Got the idea that it is the definition from IEEE, the limitation of float in binary representation. Thanks for concern! Previous Comments: ------------------------------------------------------------------------ [2009-07-16 06:36:47] ka...@php.net Please try with PHP 5.3.0 where the rounding was revised per this RFC: http://wiki.php.net/rfc/rounding ------------------------------------------------------------------------ [2009-07-16 05:11:52] louis at frenzoo dot com Description: ------------ ceil() does not give an correct expected result. I have read some bug reports before. I understand that there is floating point error, but it happens in just a simple math calculation, which is unacceptable in the below case. It created inaccurate result on simple math, it will also create chaos in more complicated ones. Reproduce code: --------------- $n = 100.0*1.1; print $n.'='.ceil($n); Expected result: ---------------- 110 = 110 Actual result: -------------- 110 = 111 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48939&edit=1