#48939 [NEW]: ceil error
| From: | louis at frenzoo dot com | Date: | Thu, 16 Jul 2009 05:11:53 +0000 |
| Subject: | #48939 [NEW]: ceil error | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-139790@lists.php.net to get a copy of this message | ||
From: louis at frenzoo dot com
Operating system: Linux
PHP version: 5.2.10
PHP Bug Type: Math related
Bug description: ceil error
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 bug report at http://bugs.php.net/?id=48939&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48939&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48939&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48939&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=48939&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48939&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=48939&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=48939&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=48939&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=48939&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=48939&r=support
Expected behavior: http://bugs.php.net/fix.php?id=48939&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=48939&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=48939&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=48939&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48939&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48939&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=48939&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=48939&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=48939&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=48939&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=48939&r=mysqlcfg