[pypy-svn] pypy default: Fix the math module when the mingw32 compiler is used.

amauryfa commits-noreply at bitbucket.org
Mon Feb 7 15:30:06 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: 
Changeset: r41669:398ee49204b8
Date: 2011-02-07 15:27 +0100
http://bitbucket.org/pypy/pypy/changeset/398ee49204b8/

Log:	Fix the math module when the mingw32 compiler is used.

diff --git a/pypy/rpython/lltypesystem/module/test/test_ll_math.py b/pypy/rpython/lltypesystem/module/test/test_ll_math.py
--- a/pypy/rpython/lltypesystem/module/test/test_ll_math.py
+++ b/pypy/rpython/lltypesystem/module/test/test_ll_math.py
@@ -34,7 +34,8 @@
                 repr,)
         else:
             if not get_tester(expected)(got):
-                raise AssertionError("%r: got %s" % (repr, got))
+                raise AssertionError("%r: got %r, expected %r" %
+                                     (repr, got, expected))
     #
     dict[fnname] = dict.get(fnname, 0) + 1
     testname = 'test_%s_%d' % (fnname, dict[fnname])

diff --git a/pypy/translator/c/src/ll_math.c b/pypy/translator/c/src/ll_math.c
--- a/pypy/translator/c/src/ll_math.c
+++ b/pypy/translator/c/src/ll_math.c
@@ -5,18 +5,22 @@
 
 /* The following macros are copied from CPython header files */
 
-#ifdef _MSC_VER
+#ifdef _WIN32
 #include <float.h>
 #include <math.h>
+#endif
+
+#ifdef _MSC_VER
 #define PyPy_IS_NAN _isnan
 #define PyPy_IS_INFINITY(X) (!_finite(X) && !_isnan(X))
 #define copysign _copysign
 #else
 #define PyPy_IS_NAN(X) ((X) != (X))
+#define Py_FORCE_DOUBLE(X) ((double)(X))
 #define PyPy_IS_INFINITY(X) ((X) &&                                   \
                              (Py_FORCE_DOUBLE(X)*0.5 == Py_FORCE_DOUBLE(X)))
 #endif
-#define PyPy_NAN (HUGE * 0.)
+#define PyPy_NAN (HUGE_VAL * 0.)
 
 int
 _pypy_math_isinf(double x)


More information about the Pypy-commit mailing list