Author: mattip <matti.pi...@gmail.com> Branch: numpy-unify-methods Changeset: r61220:219bbd8abdcd Date: 2013-02-13 23:28 +0200 http://bitbucket.org/pypy/pypy/changeset/219bbd8abdcd/
Log: implement missing ufuncs for integers 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 @@ -7,6 +7,7 @@ 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 @@ -479,6 +480,17 @@ 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 _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit