#48939 [Fbk->Csd]: ceil error
| From: | louis at frenzoo dot com | Date: | Thu, 16 Jul 2009 06:39:00 +0000 |
| Subject: | #48939 [Fbk->Csd]: ceil error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-139793@lists.php.net to get a copy of this message | ||
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] kalle@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