[issue29160] pow with three int arguments works like it had two arguments
Case Van Horsen
report at bugs.python.org
Wed Jan 4 19:04:38 EST 2017
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 <report at bugs.python.org>
<http://bugs.python.org/issue29160>
_______________________________________
More information about the Python-bugs-list
mailing list