Case Van Horsen added the comment: This is a bug/limitation in numpy. If x and y are Python integers, and type(z) is of another numeric type, pow calls the nb_power slot of the underlying type. Here a quick example using numpy.int32 and gmpy2.mpz:
>>> import numpy, gmpy2 >>> pow(11,13,7) 4 >>> pow(11,13,numpy.int32(7)) 34522712143931 >>> pow(11,13,gmpy2.mpz(7)) mpz(4) >>> (11).__pow__(13,7) 4 >>> numpy.int32(11).__pow__(13,7) 34522712143931 >>> gmpy2.mpz(11).__pow__(13,7) mpz(4) casevh ---------- nosy: +casevh _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29160> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com