working with VERY large 'float' and 'complex' types

Mikael Olofsson mikael at isy.liu.se
Thu Sep 15 04:53:27 EDT 2005


Paul Rubin calculates exp(1000.0):
> You could rearrange your formulas to not need such big numbers:
> 
>     x = 1000.
>     log10_z = x / math.log(10)
>     c,m = divmod(log10_z, 1.)
>     print 'z = %.5fE%d' % (10.**c, m)

Nice approach. We should never forget that we do have mathematical 
skills beside the computers. But, shouldn't you switch c and m in the 
last row?

/MiO



More information about the Python-list mailing list