#42143 [NEW]: The constant NAN is reported as 0 on Windows build

From: Date: Mon, 30 Jul 2007 08:05:26 +0000
Subject: #42143 [NEW]: The constant NAN is reported as 0 on Windows build
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-115551@lists.php.net to get a copy of this message
From: zoe at uk dot ibm dot com Operating system: Windows PHP version: 5CVS-2007-07-30 (snap) PHP Bug Type: Math related Bug description: The constant NAN is reported as 0 on Windows build Description: ------------ The constant NAN is reported as '0' on the Windows binary downloaded from the snaps.php.net site. The function is correct on Linux. A colleague built locally (on Windows) from source and got the correct value for NAN (ie NAN). We stepped through this code (in basic_functions.c): PHPAPI double php_get_nan(void) { #if HAVE_HUGE_VAL_NAN return HUGE_VAL + -HUGE_VAL; #elif defined(__i386__) || defined(_X86_) || defined(ALPHA) || defined(_ALPHA) || defined(__alpha) double val = 0.0; ((php_uint32*)&val)[1] = PHP_DOUBLE_QUIET_NAN_HIGH; ((php_uint32*)&val)[0] = 0; return val; #elif HAVE_ATOF_ACCEPTS_NAN return atof("NAN"); #else return 0.0/0.0; #endif } and found that the local build goes through the first "if" section, that is, HAVE_HUGE_VAL_NAN is true. We can't step through the Windows binary we downloaded but guessing that it's not executing the same section. Reproduce code: --------------- <?php echo "NAN= "; var_dump(NAN); ?> Expected result: ---------------- NAN= float(NAN) Actual result: -------------- NAN= float(0) -- Edit bug report at http://bugs.php.net/?id=42143&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42143&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42143&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42143&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42143&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42143&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42143&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42143&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42143&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42143&r=support Expected behavior: http://bugs.php.net/fix.php?id=42143&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42143&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42143&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42143&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42143&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42143&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42143&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42143&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42143&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42143&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42143&r=mysqlcfg

« previous php.bugs (#115551) next »