why does math.pow yields OverflowError (while python itself can calculate that large number)

Tzury Bar Yochay Afro.Systems at gmail.com
Thu Oct 23 11:21:36 CEST 2008


What is the reason math.pow yields OverflowError while python itself
can
calculate these large numbers. e.g:

>>> import math
>>> math.pow(100, 154)
1e+308
>>> math.pow(100, 155)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: math range error
>>> eval(('100*'* 155)[:-1])
10000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000
0000000000000000L
>>>



More information about the Python-list mailing list