]> granicus.if.org Git - php/commitdiff
Bugfix #24142, part 2
authorMarcus Boerger <helly@php.net>
Sat, 9 Aug 2003 01:12:41 +0000 (01:12 +0000)
committerMarcus Boerger <helly@php.net>
Sat, 9 Aug 2003 01:12:41 +0000 (01:12 +0000)
ext/standard/config.m4
ext/standard/math.c

index 9ee84205c6f4487ab2f54f48b81dac29ca4b3afd..51ef3e4cd282909d9f88edf525e9b750bd7b61da 100644 (file)
@@ -253,6 +253,27 @@ AC_DEFUN([PHP_CHECK_IF_SUPPORT_PROC_OPEN],[
 
 ])
 
+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 ])
+
 PHP_CHECK_IF_SUPPORT_PROC_OPEN
 
 dnl getopt long options disabled for now
index ee4274460f5551e1a1105bb6aea8680f491a2a35..7d7c73f84b4ee19a74e230424852f371d673ee81 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 */