ID:               42143
 Updated by:       [EMAIL PROTECTED]
 Reported By:      zoe at uk dot ibm dot com
 Status:           Assigned
 Bug Type:         Math related
 Operating System: Windows
 PHP Version:      5CVS-2007-07-30 (snap)
 Assigned To:      edink
 New Comment:

I tried using vc 2k3 and 2k5 and NAN is correctly defined. VC6 seems to
have a different way to define/get/use NAN. Maybe we can rely on
fmod(1,0) instead (always return NaN on windows).


Previous Comments:
------------------------------------------------------------------------

[2007-07-31 11:42:49] [EMAIL PROTECTED]

Edin, can you check if there's some problem with the win32 build in
this?

------------------------------------------------------------------------

[2007-07-30 08:05:26] zoe at uk dot ibm dot com

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 this bug report at http://bugs.php.net/?id=42143&edit=1

Reply via email to