Why not FP for Money?

Paul Rubin http
Fri Sep 24 21:23:05 CEST 2004

danb_83 at yahoo.com (Dan Bishop) writes:
> str(x), however, is meant to return a "nice" string representation,
> and so it only uses '%.12g' % x (ignoring 5 "noise" digits at the end
> of repr(x)).

Thanks.  I didn't realize that 'nice' means 'inaccurate':

    >>> a=1e12+1
    >>> b=a-1e12
    >>> b
    >>> str(a)
    >>> float(str(a))-1e12

I really do think now that if we're serious about supporting decimals,
we need decimal literals.

More information about the Python-list mailing list