S
Satchidanand Haridas
/>/ >>> e**709janeaustine50 at hotmail.com said:/ >>> from math import e
/>/ 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?
/
While float may not be able to handle such large numbers, the 'long' data-type is capable of unlimited precision limited only by your system memory.
You could cast the above floats to long and then do the needed calculation. But note that long floors a floating number. So:
long(e) will return 2.
So you will have to consider the fractional part while multiplying to avoid rounding-off errors. Something like this:
Hope this was of some help.
Regards,
Satchit
----
Satchidanand Haridas (sharidas at zeomega dot com)
ZeOmega (www.zeomega.com)
Open Minds' Open Solutions
#20,Rajalakshmi Plaza,
South End Road,
Basavanagudi,
Bangalore-560 004, India