I am running some test code and observed something strange. the numpy power function giving strange output post 2 to the power 62


The outout of above code is

array([                   2,                    4,                    8,
       1125899906842624,  1152921504606846976,  4611686018427387904,
   -9223372036854775808,                    0,                    0,

enter image description here

Curious if someone can explain what is happening here

enter image description here


1 Answer 1


Numpy uses C datatype and thus it has limited precision. I guess the highest precision integer in your system is 64-bit. You can refer the documentation of NumPy to get a more detailed answer on overflow errors and extended precision.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.