#22179 [NEW]: convert float to int crashes

From: Date: Wed, 12 Feb 2003 00:59:49 +0000
Subject: #22179 [NEW]: convert float to int crashes
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-32853@lists.php.net to get a copy of this message
From: csmall@enc.com.au Operating system: Debian GNU/Linux PHP version: 4.2.3 PHP Bug Type: Reproducible crash Bug description: convert float to int crashes <? $b = "NAN"; $c = (float)$b; $sum = 0; $sum+= (int)$c; echo "B is $b, C is $c, sum is $sum\n"; ?> i386 says sum is 0 alpha just does a floating point exception sparc64 says sum is 2147483647 powerpc says sum is -2147483648 It should be 0, I guess. If you prefer a one-liner: <? echo (int)((float)"NAN")."\n"; ?> Same result. -- Edit bug report at http://bugs.php.net/?id=22179&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=22179&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=22179&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=22179&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=22179&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=22179&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=22179&r=support Expected behavior: http://bugs.php.net/fix.php?id=22179&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=22179&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=22179&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=22179&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22179&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=22179&r=dst IIS Stability: http://bugs.php.net/fix.php?id=22179&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=22179&r=gnused

« previous php.bugs (#32853) next »