[R] reference for round

JRG loesljrg at accucom.net
Wed Oct 18 23:30:14 CEST 2000

Date sent:      	Wed, 18 Oct 2000 11:18:40 -0700 (PDT)
From:           	Anne York <york at noaa.gov>
Send reply to:  	Anne York <anne.york at noaa.gov>
To:             	r-help at stat.math.ethz.ch
Subject:        	[R] reference for round

> The help for the round function states: 
> round rounds the values in its first argument to the specified number of
> decimal places (default 0). Note that for rounding
> off a 5, the IEEE standard is used, ``go to the even digit''. Therefore
> round(0.5) is 0 and round(-1.5) is -2. 
> Could someone provide a  reference for this standard?
> Thanks, Anne

The IEEE standard itself, or the round-to-even digit rule adopted by 
the IEEE standard?

If the latter, Knuth puts the matter well:

 for most numerical applications the best policy appears to be the 
rounding scheme which insists that the least significant digit should 
always be made even (or always odd) when an ambiguous value is 
rounded.  This is not a trivial technicality, of interest only to nit-
pickers; it is an important practical consideration, since the 
ambiguous case arises surprisingly often and a biased rounding rule 
produces significantly poor results.  
 [Why not round to odd in 
ambiguous cases?] ...  Fortunately, the base [of the arithmetic 
system] is usually b = 2 [binary arithmetic] or b = 10 [decimal 
arithmetic], when everyone agrees that round-to-even is best."    
(Knuth, 1981, pp. 221-222.)

[That's Volume 2, _Semi-Numerical Algorithms_].  The third edition of 
that work contains a similar set of remarks.


John R. Gleason

Syracuse University
430 Huntington Hall                      Voice:   315-443-3107
Syracuse, NY 13244-2340  USA             FAX:     315-443-4085

PGP public key at keyservers
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list