Why not FP for Money?
Paul Rubin
http
Fri Sep 24 15:23:05 EDT 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
1.0
>>> str(a)
'1e+12'
>>> float(str(a))-1e12
0.0
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