#22179 [Opn->Fbk]: convert float to int crashes

From: Date: Wed, 12 Feb 2003 01:07:04 +0000
Subject: #22179 [Opn->Fbk]: convert float to int crashes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-32854@lists.php.net to get a copy of this message
ID: 22179 Updated by: helly@php.net Reported By: csmall@enc.com.au -Status: Open +Status: Feedback Bug Type: Reproducible crash Operating System: Debian GNU/Linux PHP Version: 4.2.3 New Comment: Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip Previous Comments: ------------------------------------------------------------------------ [2003-02-11 18:59:49] csmall@enc.com.au <? $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 this bug report at http://bugs.php.net/?id=22179&edit=1

« previous php.bugs (#32854) next »