[pypy-commit] pypy default: Tweak.

arigo noreply at buildbot.pypy.org
Wed Nov 9 19:00:33 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r49032:2466f0e89311
Date: 2011-11-09 19:00 +0100
http://bitbucket.org/pypy/pypy/changeset/2466f0e89311/

Log:	Tweak.

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
@@ -108,14 +108,17 @@
 #
 # Custom implementations
 
+VERY_LARGE_FLOAT = 1.0
+while VERY_LARGE_FLOAT * 100.0 != INFINITY:
+    VERY_LARGE_FLOAT *= 64.0
+
 def ll_math_isnan(y):
     # By not calling into the external function the JIT can inline this.
     # Floats are awesome.
     return y != y
 
 def ll_math_isinf(y):
-    # Use a bitwise OR so the JIT doesn't produce 2 different guards.
-    return (y == INFINITY) | (y == -INFINITY)
+    return (y + VERY_LARGE_FLOAT) == y
 
 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