This math scares me

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Tue Mar 13 17:15:25 EST 2001


Tue, 13 Mar 2001 22:11:53 +0100, Werner Schiendl <ws-news at gmx.at> pisze:

> 15 to 16 digits are the precision double values will provide. So
> rounding to 15 digits will normally display the value you have
> entered. There is however no guarantee that your value is displayed
> exactly.

That's why I am asking for not fixing the number of digits but having
this functionality:

    def most_useful_str_or_repr_variant(x):
        s = str(x)
        if float(s) == x: return s
        return repr(x)

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list