[pypy-commit] pypy default: The hack "y + VERY_LARGE_FLOAT == y" fails to give the correct

arigo noreply at buildbot.pypy.org
Wed Nov 16 12:29:05 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r49464:14495ad804bc
Date: 2011-11-16 12:28 +0100
http://bitbucket.org/pypy/pypy/changeset/14495ad804bc/

Log:	The hack "y + VERY_LARGE_FLOAT == y" fails to give the correct
	result on gcc, not only on msvc. Revert to the comparison with
	INFINITY and -INFINITY when not jitted.

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
@@ -127,9 +127,12 @@
     return y != y
 
 def ll_math_isinf(y):
-    if use_library_isinf_isnan and not jit.we_are_jitted():
+    if jit.we_are_jitted():
+        return (y + VERY_LARGE_FLOAT) == y
+    elif use_library_isinf_isnan:
         return not _lib_finite(y) and not _lib_isnan(y)
-    return (y + VERY_LARGE_FLOAT) == y
+    else:
+        return y == INFINITY or y == -INFINITY
 
 def ll_math_isfinite(y):
     # Use a custom hack that is reasonably well-suited to the JIT.


More information about the pypy-commit mailing list