]> granicus.if.org Git - php/commitdiff
- Decouple NAN and INF
authorMarcus Boerger <helly@php.net>
Mon, 10 May 2004 07:23:38 +0000 (07:23 +0000)
committerMarcus Boerger <helly@php.net>
Mon, 10 May 2004 07:23:38 +0000 (07:23 +0000)
ext/standard/basic_functions.c
ext/standard/config.m4

index 3106022f3df13b8a302e0fc18b5a314dc50f31c1..85ebe92bbd1018a9dc665bdfb74de701a894ac34 100644 (file)
@@ -957,7 +957,7 @@ static void basic_globals_dtor(php_basic_globals *basic_globals_p TSRMLS_DC)
 #define PHP_DOUBLE_INFINITY_HIGH       0x7ff00000
 #define PHP_DOUBLE_QUIET_NAN_HIGH      0xfff80000
 
-PHPAPI double php_get_nan()
+PHPAPI double php_get_nan(void)
 {
 #if HAVE_HUGE_VAL_NAN
        return HUGE_VAL + -HUGE_VAL;
@@ -973,9 +973,9 @@ PHPAPI double php_get_nan()
 #endif
 }
 
-PHPAPI double php_get_inf()
+PHPAPI double php_get_inf(void)
 {
-#if HAVE_HUGE_VAL_NAN
+#if HAVE_HUGE_VAL_INF
        return HUGE_VAL;
 #elif defined(__i386__) || defined(_X86_) || defined(ALPHA) || defined(_ALPHA) || defined(__alpha)
        double val = 0.0;
index 82b5b0b2bb243a9ec57879d2f765da1227d08059..7a8689d8978a42af78bd0d20489c20fa1bd73476 100644 (file)
@@ -389,7 +389,7 @@ if test "$ac_cv_atof_accept_inf" = "yes"; then
   AC_DEFINE([HAVE_ATOF_ACCEPTS_INF], 1, [whether atof() accepts INF])
 fi
 
-AC_CACHE_CHECK(whether HUGE_VAL + -HUGEVAL == NAN, ac_cv_huge_val_nan,[
+AC_CACHE_CHECK(whether HUGE_VAL == INF, ac_cv_huge_val_inf,[
   AC_TRY_RUN([
 #include <math.h>
 #include <stdlib.h>
@@ -405,6 +405,28 @@ AC_CACHE_CHECK(whether HUGE_VAL + -HUGEVAL == NAN, ac_cv_huge_val_nan,[
 #define zend_isinf(a) 0
 #endif
 
+int main(int argc, char** argv)
+{
+       return zend_isinf(HUGE_VAL) ? 0 : 1;
+}
+  ],[
+      ac_cv_huge_val_inf=yes
+  ],[
+      ac_cv_huge_val_inf=no
+  ],[
+      ac_cv_huge_val_inf=yes
+  ])
+])
+dnl This is the most probable fallback so we assume yes in case of cross compile.
+if test "$ac_cv_huge_val_inf" = "yes"; then
+  AC_DEFINE([HAVE_HUGE_VAL_INF], 1, [whether HUGE_VAL == INF])
+fi
+
+AC_CACHE_CHECK(whether HUGE_VAL + -HUGEVAL == NAN, ac_cv_huge_val_nan,[
+  AC_TRY_RUN([
+#include <math.h>
+#include <stdlib.h>
+
 #ifdef HAVE_ISNAN
 #define zend_isnan(a) isnan(a)
 #elif defined(HAVE_FPCLASS)
@@ -419,7 +441,7 @@ int main(int argc, char** argv)
        /* prevent bug #27830 */
        return 1;
 #else
-       return zend_isinf(HUGE_VAL) && zend_isnan(HUGE_VAL + -HUGE_VAL) ? 0 : 1;
+       return zend_isnan(HUGE_VAL + -HUGE_VAL) ? 0 : 1;
 #endif
 }
   ],[