]> granicus.if.org Git - php/commitdiff
MFH: Detection of buggy compiler (gcc)
authorIlia Alshanetsky <iliaa@php.net>
Sat, 9 Aug 2003 16:13:47 +0000 (16:13 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sat, 9 Aug 2003 16:13:47 +0000 (16:13 +0000)
ext/standard/config.m4
ext/standard/math.c

index bc72ae533e1fe9e914e5caabc66e6eb37ffcab8c..bf84dcfe40617bc76f0d0e8d65940f2718a1c346 100644 (file)
@@ -226,6 +226,27 @@ AC_ARG_WITH(regex,
   REGEX_TYPE=php
 ])
 
+dnl
+dnl round fuzz
+dnl
+AC_MSG_CHECKING([whether rounding works as expected])
+AC_TRY_RUN([
+#include <math.h>
+  int main() {
+    return floor(0.045*pow(10,2) + 0.5)/10.0 != 0.5;
+  }
+],[
+  PHP_ROUND_FUZZ=0.5
+  AC_MSG_RESULT(yes)
+],[
+  PHP_ROUND_FUZZ=0.50000000001
+  AC_MSG_RESULT(no)
+],[
+  PHP_ROUND_FUZZ=0.50000000001
+  AC_MSG_RESULT(cross compile)
+])
+AC_DEFINE_UNQUOTED(PHP_ROUND_FUZZ, $PHP_ROUND_FUZZ, [ see #24142 ])
+
 AC_FUNC_FNMATCH        
 
 dnl getopt long options disabled for now
index 1b93b6fd0fe445c89f6c81c5f5a4a40b1dafd57d..22f6805dddef7fdf8f80901428fcf801b49e39cf 100644 (file)
 #define M_PI 3.14159265358979323846
 #endif
 
-#define PHP_ROUND_FUZZ 0.50000000001
+#ifndef PHP_ROUND_FUZZ
+# ifndef PHP_WIN32
+#  define PHP_ROUND_FUZZ 0.50000000001
+# else
+#  define PHP_ROUND_FUZZ 0.5
+# endif
+#endif
 
 /* {{{ proto int abs(int number)
    Return the absolute value of the number */