From: marc-bennewitz at arcor dot de Operating system: Linux acer-aspire-5680 3.2.0-38- PHP version: master-Git-2013-03-19 (Git) Package: Scripting Engine problem Bug Type: Bug Bug description:Wrong value on casting a float point number into int
Description: ------------ On some circumstances it's possible to get a wrong integer value on casting from float. I can reproduce this bug with the following installations: php -v PHP 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli) (built: Mar 11 2013 14:34:31) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans ./sapi/cli/php -v PHP 5.6.0-dev (cli) (built: Mar 17 2013 22:02:54) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.6.0-dev, Copyright (c) 1998-2013 Zend Technologies Test script: --------------- // this works $v = (float) 6; var_dump($v, (int)$v); // this is wrong $v = log(64, 2); var_dump($v, (int)$v); Expected result: ---------------- float(6) int(6) float(6) int(6) Actual result: -------------- float(6) int(6) float(6) int(5) -- Edit bug report at https://bugs.php.net/bug.php?id=64459&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64459&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64459&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64459&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64459&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64459&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64459&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64459&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64459&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=64459&r=support Expected behavior: https://bugs.php.net/fix.php?id=64459&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64459&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64459&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64459&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64459&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64459&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64459&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=64459&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64459&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64459&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64459&r=mysqlcfg