Overflow error

Michael Hudson mwh at python.net
Tue Jul 27 15:23:27 CEST 2004

janeaustine50 at hotmail.com (Jane Austine) writes:

> >>> from math import e
> >>> e**709
> 8.218407461554662e+307
> >>> e**710
> Traceback (most recent call last):
>   File "<pyshell#15>", line 1, in -toplevel-
>     e**710
> OverflowError: (34, 'Result too large')
> What should I do to calculate e**710?

Well, it's too big for your platform's C double, so you need a
different representation.  I don't know if there are big float
packages out there that handle such things (likely, though) or if
there are Python interfaces to the same (less likely).  Or you could
store the logarithms of the numbers you are interested in.  Why do you
need such huge nubmers?


  <exarkun> today's lesson
  <exarkun> don't strace X in an xterm
                                                -- from Twisted.Quotes

More information about the Python-list mailing list