mantissa and exponent in base 10

Steven D'Aprano steve-REMOVE-THIS at cybersource.com.au
Thu Oct 7 00:54:20 CEST 2010


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.


The math module has a frexp() function, but it produces a base-2 exponent:

>>> math.frexp(1.2345e7)
(0.73581933975219727, 24)

Have I missed a built-in or math function somewhere?



-- 
Steven



More information about the Python-list mailing list