#30577 [NEW]: (int)float truncation

From: Date: Wed, 27 Oct 2004 05:21:48 +0000
Subject: #30577 [NEW]: (int)float truncation
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-68374@lists.php.net to get a copy of this message
From: rick at gibbed dot us Operating system: win32 PHP version: 5.0.2 PHP Bug Type: Scripting Engine problem Bug description: (int)float truncation Description: ------------ On the Windows platform any form of casting done to a float that can fit in an integer that is above 0x7FFFFFFF gets truncated to 0x7FFFFFFF rather than assuming the actual signed integer value. Reproduce code: --------------- $v = 2147483648; // 0x80000000 var_dump((int)$v); Expected result: ---------------- int(-2147483648) // 0x80000000 Actual result: -------------- int(2147483647) // 0x7FFFFFFF -- Edit bug report at http://bugs.php.net/?id=30577&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30577&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30577&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30577&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30577&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30577&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30577&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30577&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30577&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30577&r=support Expected behavior: http://bugs.php.net/fix.php?id=30577&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30577&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30577&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30577&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30577&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30577&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30577&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30577&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30577&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30577&r=mysqlcfg

« previous php.bugs (#68374) next »