Commits

Brian Kearns committed 90289b2

fix reciprocal on 32bit

Comments (0)

Files changed (2)

pypy/module/micronumpy/test/test_ufuncs.py

         for i in range(4):
             assert b[i] == reference[i]
 
-        for dtype in ['int8', 'int16', 'int32', 'int64',
-                      'uint8', 'uint16', 'uint32', 'uint64']:
+        for dtype in 'bBhHiIlLqQ':
+            a = array([-2, -1, 0, 1, 2], dtype)
             reference = [0, -1, 0, 1, 0]
+            dtype = a.dtype.name
             if dtype[0] == 'u':
                 reference[1] = 0
             elif dtype == 'int32':
                     reference[2] = -2147483648
             elif dtype == 'int64':
                     reference[2] = -9223372036854775808
-            a = array([-2, -1, 0, 1, 2], dtype)
             b = reciprocal(a)
             assert (b == reference).all()
 

pypy/module/micronumpy/types.py

         ans = 0
         if raw == 0:
             # XXX good place to warn
-            if self.T is rffi.INT or self.T is rffi.LONG:
+            if self.T is rffi.INT or self.T is rffi.LONG or self.T is rffi.LONGLONG:
                 ans = most_neg_value_of(self.T)
         elif abs(raw) == 1:
             ans = raw