finding out the precision of floats

Arnaud Delobelle arnodel at googlemail.com
Sun Feb 25 05:57:52 EST 2007


Hi all,

I want to know the precision (number of significant digits) of a float
in a platform-independent manner.  I have scoured through the docs but
I can't find anything about it!

At the moment I use this terrible substitute:

FLOAT_PREC = repr(1.0/3).count('3')

How can I do this properly or where is relevant part of the docs?

Thanks

--
Arnaud




More information about the Python-list mailing list