[pypy-commit] pypy numpy-fixes: special case sign(nan)

mattip noreply at buildbot.pypy.org
Wed Apr 29 21:28:28 CEST 2015


Author: mattip <matti.picus at gmail.com>
Branch: numpy-fixes
Changeset: r76948:15dee07ee651
Date: 2015-04-28 00:18 +0300
http://bitbucket.org/pypy/pypy/changeset/15dee07ee651/

Log:	special case sign(nan)

diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py
--- a/pypy/module/micronumpy/types.py
+++ b/pypy/module/micronumpy/types.py
@@ -722,6 +722,8 @@
     def sign(self, v):
         if v == 0.0:
             return 0.0
+        if rfloat.isnan(v):
+            return rfloat.NAN
         return rfloat.copysign(1.0, v)
 
     @raw_unary_op


More information about the pypy-commit mailing list