Commits

mattip committed 219bbd8

implement missing ufuncs for integers

  • Participants
  • Parent commits 7903355
  • Branches numpy-unify-methods

Comments (0)

Files changed (1)

File pypy/module/micronumpy/types.py

 from pypy.objspace.std.floatobject import float2string
 from pypy.objspace.std.complexobject import str_format
 from rpython.rlib import rfloat, clibffi, rcomplex
+from rpython.rlib.rarithmetic import maxint
 from rpython.rlib.rawstorage import (alloc_raw_storage, raw_storage_setitem,
                                   raw_storage_getitem)
 from rpython.rlib.objectmodel import specialize
     def invert(self, v):
         return ~v
 
+    @simple_unary_op
+    def reciprocal(self, v):
+        if v == 0:
+            # XXX good place to warn
+            return -maxint
+        return 1 / v
+
+    @raw_unary_op
+    def signbit(self, v):
+        return v < 0
+
 class NonNativeInteger(NonNativePrimitive, Integer):
     _mixin_ = True