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

John Machin sjmachin at lexicon.net
Thu Oct 23 06:46:54 EDT 2008


On Oct 23, 9:24 pm, Tzury Bar Yochay <Afro.Syst... at gmail.com> wrote:
> > Because math.pow returns a float; 100 ** 155 won't fit in a float.
>
> Sure that is the reason.
> May I rephrase, my question:
> Why not returning another type as long as we can calculate it?
> After all, math module is likely to be used on large numbers as well.

The math module is intended to replicate the functionality found in
math.h in the C Standard Library; that's it, no more, no less. There
are other libraries if you want more-than-float precision.



More information about the Python-list mailing list