Rashid Nassar <[EMAIL PROTECTED]> writes:

> Many thanks to all for the very quick replies.  I should have stated the
> apparent problem more clearly: round() does not seem to always round 5 to
> the nearest even value as I expected, as my examples (repeated below)
> showed:
> 
> > round(2.45, 1)
> [1] 2.5               # shouldn't this be 2.4?
> 
> > round(1.05, 1)
> [1] 1.1               #  1.0 ?
> 
> > signif(3.445, 3)
> [1] 3.45             # 3.44 ?
> 
> Apologies for not stating this more clearly in my first message, and again
> thanks for the replies.

Yes. From my reading of the code, I would expect 2.4 in the first case
as well. It appears that the intention is to subtract off the integer
part, scale according to the number of digits and round nnn.5 +- eps
towards even values of nnn, but that's not what is happening. 

Anyone want to trace through the code and see what is going on?

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])             FAX: (+45) 35327907

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to