[pypy-svn] pypy default: Try another approach to isinf.
alex_gaynor
commits-noreply at bitbucket.org
Mon Apr 11 15:10:26 CEST 2011
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch:
Changeset: r43295:55888b692fe7
Date: 2011-04-11 09:10 -0400
http://bitbucket.org/pypy/pypy/changeset/55888b692fe7/
Log: Try another approach to isinf.
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
@@ -11,6 +11,7 @@
nan = inf / inf
assert not ll_math.ll_math_isinf(0)
assert ll_math.ll_math_isinf(inf)
+ assert ll_math.ll_math_isinf(-inf)
assert not ll_math.ll_math_isinf(nan)
def test_isnan(self):
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
@@ -94,7 +94,7 @@
return y != y
def ll_math_isinf(y):
- return not isnan(y) and isnan(y - y)
+ return y != 0 and y * .5 == y
ll_math_copysign = math_copysign
More information about the Pypy-commit
mailing list