why does math.pow yields OverflowError (while python itself can calculate that large number)
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Thu Oct 23 09:40:22 EDT 2008
On Thu, 23 Oct 2008 02:21:36 -0700, Tzury Bar Yochay wrote:
>>>> eval(('100*'* 155)[:-1])
> 10000000000000000000000000000000000000000000000000000000000
> 00000000000000000000000000000000000000000000000000000000000
> 00000000000000000000000000000000000000000000000000000000000
> 00000000000000000000000000000000000000000000000000000000000
> 00000000000000000000000000000000000000000000000000000000000
> 0000000000000000L
>>>>
This can be written more straigth forward as ``100**155`` or
``pow(100, 155)``. No need for `eval()`\ing a string.
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list