[Tutor] The '45' bug in round()
Michael Hannon
jmh at physics.ucdavis.edu
Mon Mar 19 19:00:01 CET 2007
On Mon, Mar 19, 2007 at 03:04:03AM -0700, Dick Moores wrote:
> Yesterday I was shocked, SHOCKED, to discover that round() is
> occasionally rounding incorrectly. For example,
>
> >>> print round(0.19945,4)
> 0.1994
.
.
.
> Comments, Tutors? Am I way out in left field with this?
I suggest you might want to look at the discussion of unbiased rounding at:
http://en.wikipedia.org/wiki/Rounding
- Mike
More information about the Tutor
mailing list