> > p. 83 'Coercions and Component Extraction'
> > I find it quite odd that round 3.5 returns 4, but round 2.5 returns 2.
> > I always thought that round x.5 returns x+1 (instead of the 
> > even integer).
> > That's the behaviour in most math books and programming languages
> 
> It looks odd to me too.   I think this is just taken from some other
> standard, so I don't propose to alter it.
> 
> 
> Can anyone shed light?

This is generally considered the most accurate kind of rounding, since it 
avoids cumulative errors.  If you get lots of values on the 0.5 boundary, 
`round up' gives you an error of +0.5 for each, whereas round-to-even gives 
you a mean error of zero.

I think IEEE floating point does this by default for its basic operations.

--KW 8-)
-- 
: Keith Wansbrough, MSc, BSc(Hons) (Auckland) ------------------------:
: PhD Student, Computer Laboratory, University of Cambridge, England. :
:  (and recently of the University of Glasgow, Scotland. [><] )       :
: Native of Antipodean Auckland, New Zealand: 174d47' E, 36d55' S.    :
: http://www.cl.cam.ac.uk/users/kw217/  mailto:[EMAIL PROTECTED]     :
:---------------------------------------------------------------------:



-- 
: Keith Wansbrough, MSc, BSc(Hons) (Auckland) ------------------------:
: PhD Student, Computer Laboratory, University of Cambridge, England. :
:  (and recently of the University of Glasgow, Scotland. [><] )       :
: Native of Antipodean Auckland, New Zealand: 174d47' E, 36d55' S.    :
: http://www.cl.cam.ac.uk/users/kw217/  mailto:[EMAIL PROTECTED]     :
:---------------------------------------------------------------------:



-- 
: Keith Wansbrough, MSc, BSc(Hons) (Auckland) ------------------------:
: PhD Student, Computer Laboratory, University of Cambridge, England. :
:  (and recently of the University of Glasgow, Scotland. [><] )       :
: Native of Antipodean Auckland, New Zealand: 174d47' E, 36d55' S.    :
: http://www.cl.cam.ac.uk/users/kw217/  mailto:[EMAIL PROTECTED]     :
:---------------------------------------------------------------------:




Reply via email to