Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!travelers.mail.cornell.edu!news.tc.cornell.edu!news.cac.psu.edu!howland.reston.ans.net!Germany.EU.net!EU.net!uunet!in1.uu.net!boulder!news.coop.net!news.den.mmc.com!britt
From: britt@tigercat.den.mmc.com (Dan Britt)
Subject: Re: Why is (round 2.5) = 2?
Message-ID: <1995Apr19.183312.17989@den.mmc.com>
Sender: britt@tigercat (Dan Britt)
Nntp-Posting-Host: tigercat.den.mmc.com
Organization: Martin Marietta Astronautics Group
References: <jmeehan-1504951641460001@machine.mv.us.adobe.com> <1995Apr17.152540.5214@den.mmc.com> <ronjr-1704951257260001@catastrophe.chem-eng.nwu.edu>
Date: Wed, 19 Apr 1995 18:33:12 GMT
Lines: 43

In article <ronjr-1704951257260001@catastrophe.chem-eng.nwu.edu>, ronjr@src.umd.edu (Ron Forsythe) writes:
|> In article <1995Apr17.152540.5214@den.mmc.com>, britt@tigercat.den.mmc.com
|> (Dan Britt) wrote:
|> 
|> > I've seen this thread before and don't remember the answer (maybe it's
|> > ease of implementation).  It seems to me that mathematically (using
|> > infinite precision arithmetic) rounding toward an even number is wrong.
|> > The "size" of the real number space including 0.0 through 0.49999... is
|> > equal to that including 0.50 through 0.99999....  Thus, one should always
|> > round anything at or above .5 up.  But that's with infinite precision.
|> > Digital representations may change things...
|> 
|> Except the range is not 0.0 -> .49999...
|> It's 0.00...01 -> .49999...
|> 
|> Consider breaking the range up like this:
|>  0  |  1    2    3   4  |  5  |  6    7    8    9  |  10
|> even|    round down     |  ?  |      round up      |  odd
|> 
|> Always rounding up results in 5 cases that lead to rounding up and 4 to rounding
|> down.  Rounding to even numbers gives equal probability that .5 will be rounded
|> up as rounded down (at least over the range from -infinity to infinity).

Except that in the range 0  |  1  ... 9  |  10,  zero equals ten (with respect
to rounding).  And, the real number line _does_ include integers, so the
range is 0 (exactly, not 0.00...01) through 0.49999....  There are exactly
as many real numbers between 0 and 0.49999... inclusive as there are between
0.5 and 0.99999... inclusive, so the habit of rounding .5 down half of the
time means rounding down more often than rounding up.  Finite precision
arithmetic may either mitigate or exacerbate that; I don't know.  But this
subject has to do with open vs closed intervals on the real number line. The
interval [0, .5) is the same size as the interval [.5, 1) (though it's been
so long I might have the symbols reversed), and that [.5 means include .5,
whereas .5) means don't include it.  That's why so many of us were
taught to round .5 up:

|> > Strange.  I learned rounding .5 up, as did everyone I've talked to so far.

Dan
______________________________________________________________________
Daniel L. Britt				Martin Marietta Astronautics
britt@tigercat.den.mmc.com		Opinions expressed are my own,
303-977-1682				not those of my employer.
