#44204 [NEW]: intval makes very big mistakes
| From: | bugs at kathaus dot nl | Date: | Thu, 21 Feb 2008 17:22:13 +0000 |
| Subject: | #44204 [NEW]: intval makes very big mistakes | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-122554@lists.php.net to get a copy of this message | ||
From: bugs at kathaus dot nl
Operating system: Linux
PHP version: 5.2.5
PHP Bug Type: Variables related
Bug description: intval makes very big mistakes
Description:
------------
see a page I created to show this bug:
http://www.budgetdedicated.com/phpbug.php
Reproduce code:
---------------
for quick reproduction:
$v=18.82;
$v=$v*100;
$v=intval($v);
echo $v."\n"; // 1820 = OK
$v=18.81;
$v=$v*100;
$v=intval($v);
echo $v."\n"; // 1800 = BAD
Expected result:
----------------
intval (18.81*100) == 1881
Actual result:
--------------
1880
--
Edit bug report at http://bugs.php.net/?id=44204&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44204&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44204&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44204&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44204&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=44204&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44204&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44204&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44204&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44204&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44204&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=44204&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=44204&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44204&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44204&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44204&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44204&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44204&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44204&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44204&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44204&r=mysqlcfg