How to detect a double's significant digits

Peter Otten __peter__ at web.de
Thu May 5 15:29:36 EDT 2005


mrstephengross wrote:

> This was all supposed to be on comp.lang.c++, but

You may still want to read the following thread on Python-Dev:
http://mail.python.org/pipermail/python-dev/2004-March/043703.html

A link mentioned by Andrew Koenig may be helpful:
http://www.netlib.org/fp/

"""
file    g_fmt.c
by      David Gay
for     ANSI C or C++ source for function g_fmt(char *, double):
,       with help from dtoa, g_fmt(buf, x) sets buf to the shortest
,       decimal string that correctly rounds to x and returns buf.
"""

Peter




More information about the Python-list mailing list