On Fri, 14 Nov 2008 15:21:17 +0100, spir wrote: > Well, actually not really I guess. I asked for rounded floats, not > full-precision ones. > Now, after more reflexion on the topic, I understand that even rounded > floats need to keep full precision internally, because of the 'modular' > difference between decimal and binary representations that causes > 'epsilon' errors; which still applies on rounded floats, for the > rounding operates at the decimal level. In other words, (decimal) > rounding does not eliminate the source of 'little errors' -- it should > be binary rounding instead, but this is probably not very useful for us > in the real world ;-). The reason why repr(), that shows inner > representation, is still full of junk digits for rounded floats, while > str() shows the expected format. denis
If you wanted a more controllable precision and can tolerate being a bit slow, you can use the Decimal module instead. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor