helly Fri Aug 8 21:12:41 2003 EDT
Modified files:
/php-src/ext/standard config.m4 math.c
Log:
Bugfix #24142, part 2
Index: php-src/ext/standard/config.m4
diff -u php-src/ext/standard/config.m4:1.62 php-src/ext/standard/config.m4:1.63
--- php-src/ext/standard/config.m4:1.62 Mon Jun 30 12:33:50 2003
+++ php-src/ext/standard/config.m4 Fri Aug 8 21:12:41 2003
@@ -1,4 +1,4 @@
-dnl $Id: config.m4,v 1.62 2003/06/30 16:33:50 sniper Exp $ -*- sh -*-
+dnl $Id: config.m4,v 1.63 2003/08/09 01:12:41 helly Exp $ -*- sh -*-
divert(3)dnl
@@ -252,6 +252,27 @@
fi
])
+
+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
Index: php-src/ext/standard/math.c
diff -u php-src/ext/standard/math.c:1.105 php-src/ext/standard/math.c:1.106
--- php-src/ext/standard/math.c:1.105 Fri Aug 8 19:40:44 2003
+++ php-src/ext/standard/math.c Fri Aug 8 21:12:41 2003
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: math.c,v 1.105 2003/08/08 23:40:44 iliaa Exp $ */
+/* $Id: math.c,v 1.106 2003/08/09 01:12:41 helly Exp $ */
#include "php.h"
#include "php_math.h"
@@ -32,7 +32,13 @@
#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 */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php