In numerical analysis there is this concept of machine zero, which is computed like this:<br><br>e=1.0<br>while 1.0+e > 1.0:<br> e=e/2.0<br>print e<br><br>The number e will give you the precision of floating point numbers.<br>
<br>Lalitha Prasad<br><br><div class="gmail_quote">On Sun, Jun 26, 2011 at 9:05 PM, Harold <span dir="ltr"><<a href="mailto:dadapapa@googlemail.com">dadapapa@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
> >I'm curious. Is there a way to get the number of significant digits<br>
> >for a particular Decimal instance?<br>
><br>
> Yes:<br>
><br>
> def sigdig(x):<br>
> "return the number of significant digits in x"<br>
> return len(x.as_tuple()[1])<br>
<br>
Great! that's exactly what I needed.<br>
thanks Chris!<br>
<font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></blockquote></div><br>