mantissa and exponent in base 10

Ulrich Eckhardt eckhardt at satorlaser.com
Thu Oct 7 08:23:33 CEST 2010


Steven D'Aprano wrote:
> I want the mantissa and decimal exponent of a float, in base 10:
> 
> mantissa and exponent of 1.2345e7
> => (1.2345, 7)
> 
> (0.12345, 8) would also be acceptable.
[...]
> Have I missed a built-in or math function somewhere?

The integral, decimal exponent is just the floor/ceiling of log10 of that
number.

Uli

-- 
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932




More information about the Python-list mailing list