How to detect a double's significant digits

James Stroud jstroud at mbi.ucla.edu
Thu May 5 13:51:29 EDT 2005


Significant digits are an accounting concept. As such, it is up to the 
accountant to keep track of these as only she knows the precision of her 
measurements.

Koan for the day:

What are the significant digits of 0.1?

Hint:

>>> `0.1`

James


On Thursday 05 May 2005 10:37 am, so sayeth mrstephengross:
> Hi all... How can I find out the number of significant digits (to the
> right of the decimal place, that is) in a double? At least, I *think*
> that's what I'm asking for. For instance:
>
> 0.103 --> 3
> 0.0103 --> 4
> 0.00103 --> 5
> 0.000103 --> 6
> 0.0000103 --> 7
>
> Thanks in advance!
> --Steve (mrstephengross at hotmail.com)

-- 
James Stroud, Ph.D.
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/



More information about the Python-list mailing list