Guido van Rossum added the comment:
travelgirl: the 'decimal' module is designed to deal with this. Note
that there's a difference between BCD (which can represent decimal
numbers exactly) and binary (which can't, in general).
--
nosy: +gvanrossum
__
Trac
Georg Brandl added the comment:
round() does not return a string, but a floating point number, the best
approximation to the "real" result that is achievable with the limited
precision of binary floating point.
That result is then formatted to a string for display by the interactive
interpreter
travelgirl added the comment:
interesting, and expected as the BCD calculation. however, the round function
should be able to handle that correctly, dealing with the number in a string
fashion as opposed a mathematical one, to display the requested decimal places.
slower, to be sure, but hel
Georg Brandl added the comment:
Not really a feature, but not a bug. See
http://www.python.org/doc/faq/general/#why-are-floating-point-calculations-so-inaccurate
for an explanation.
--
nosy: +georg.brandl
resolution: -> invalid
status: open -> closed
__
New submission from travelgirl:
http://docs.python.org/tut/node5.html states, as an example, round(_, 2)
should round to the second decimal place. makes sense. when i
attempted it with different numbers, round() returned what looks like a
binary-coded decimal error (see the jpg enclosed), and d