How to detect a double's significant digits

Erik Max Francis max at alcyone.com
Thu May 5 16:43:37 EDT 2005


Jeremy Bowers wrote:

> Step one for mrstephengross is to *rigorously* define what he means by
> "significant digits", then go from there. Since I think he mentioned
> something about predicting how much space it will take to print out, my
> suggestion is to run through whatever printing routines there are and get
> a string out, the measure the string, as anything else will likely be
> wrong. If that's not possible with the formatting library, you've already
> lost; you'll have to completely correctly re-implement the formatting
> library, and not only is that a major PITA, you almost never get it
> bug-for-bug right...

Especially since all of his examples have the same number of significant 
digits (3), as the term is usually meant.  Zeroes to the right are 
significant, not zeroes to the left.

-- 
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
   What is it that shapes a species?
   -- Louis Wu



More information about the Python-list mailing list