[R] understanding round() behavior

Robert Duval rduval at gmail.com
Tue Apr 24 23:03:58 CEST 2007


Dear all,

I am a little bit puzzled by the way round() works.
Consider the following code

>a<-123456.3678
> round(a,digits=10)
[1] 123456.4


I would expect the outcome to be something like 123456.3678 or
123456.368, instead the computer gives me 123456.4 no matter how large
the digits are.

Can anybody help me understand what I'm missing here?

Thanks again for your help.
Robert



More information about the R-help mailing list