[pypy-svn] pypy default: Merged upstream.

alex_gaynor commits-noreply at bitbucket.org
Thu Apr 14 03:12:25 CEST 2011


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: 
Changeset: r43338:134b0a8fd1ad
Date: 2011-04-13 21:12 -0400
http://bitbucket.org/pypy/pypy/changeset/134b0a8fd1ad/

Log:	Merged upstream.

diff --git a/pypy/translator/c/src/ll_math.h b/pypy/translator/c/src/ll_math.h
--- a/pypy/translator/c/src/ll_math.h
+++ b/pypy/translator/c/src/ll_math.h
@@ -1,6 +1,8 @@
 /* Definitions of some C99 math library functions, for those platforms
    that don't implement these functions already. */
 
+int _pypy_math_isinf(double x);
+
 double _pypy_math_acosh(double x);
 double _pypy_math_asinh(double x);
 double _pypy_math_atanh(double x);

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
@@ -22,6 +22,12 @@
 #endif
 #define PyPy_NAN (HUGE_VAL * 0.)
 
+int
+_pypy_math_isinf(double x)
+{
+    return PyPy_IS_INFINITY(x);
+}
+
 /* The following copyright notice applies to the original
    implementations of acosh, asinh and atanh. */
 

diff --git a/pypy/rpython/lltypesystem/module/ll_math.py b/pypy/rpython/lltypesystem/module/ll_math.py
--- a/pypy/rpython/lltypesystem/module/ll_math.py
+++ b/pypy/rpython/lltypesystem/module/ll_math.py
@@ -20,7 +20,8 @@
         separate_module_files=[cdir.join('src', 'll_math.c')],
         export_symbols=['_pypy_math_acosh', '_pypy_math_asinh',
                         '_pypy_math_atanh',
-                        '_pypy_math_expm1', '_pypy_math_log1p'],
+                        '_pypy_math_expm1', '_pypy_math_log1p',
+                        '_pypy_math_isinf'],
         )
     math_prefix = '_pypy_math_'
 else:
@@ -56,6 +57,7 @@
 math_fmod  = llexternal('fmod',  [rffi.DOUBLE, rffi.DOUBLE], rffi.DOUBLE)
 math_hypot = llexternal(underscore + 'hypot',
                         [rffi.DOUBLE, rffi.DOUBLE], rffi.DOUBLE)
+math_isinf = math_llexternal('isinf', [rffi.DOUBLE], rffi.INT)
 
 # ____________________________________________________________
 #
@@ -93,8 +95,9 @@
     # are awesome.
     return y != y
 
+ at jit.purefunction
 def ll_math_isinf(y):
-    return y != 0 and y * .5 == y
+    return bool(math_isinf(y))
 
 
 ll_math_copysign = math_copysign


More information about the Pypy-commit mailing list