How to detect a double's significant digits

Dan Bishop danb_83 at yahoo.com
Thu May 5 23:10:09 EDT 2005


Fredrik Lundh wrote:
> "mrstephengross" wrote:
>
> > >But, assuming you have your numbers as strings, I would suggest
> > looking
> > at str.split() and len().
> >
> > Well, the numbers are in fact stored as numbers, so string
processing
> > won't work.
>
> if they're not strings, your question is meaningless.  as others have
> pointed out, the exact internal representation for 0.103 is more like
> 0.10299999999999999433786257441170164383947849273681640625
> which has a lot more than 3 digits...

Actually, it's more like

0 01111111011 1010010111100011010100111111011111001110110110010001




More information about the Python-list mailing list