[R] round() seems inconsistent when rounding 5s

Rashid Nassar rnassar at duke.edu
Sat Mar 15 22:53:48 CET 2003


It may be my lack of unerstanding, but round() seems to me to give
inconsistent results when rounding 5s as in the following examples?

> round(1.45, 1)
[1] 1.4               # OK

> round(2.45, 1)
[1] 2.5               # shouldn't this be 2.4?

> round(1.05, 1)
[1] 1.1               #  1.0 ?

and signif():

> signif(2.445, 3)
[1] 2.44             # OK

> signif(3.445, 3)
[1] 3.45             # 3.44 ?


> version
         _
platform i586-pc-linux-gnu
arch     i586
os       linux-gnu
system   i586, linux-gnu
status
major    1
minor    6.2
year     2003
month    01
day      10
language R

Many thanks!

Rashid Nassar



More information about the R-help mailing list