[Rd] round() increases or decreases (PR#9195)

gael.millot at curie.fr gael.millot at curie.fr
Fri Sep 1 11:14:55 CEST 2006


Full_Name: Gael Millot
Version: 2.3.1.
OS: XP
Submission from: (NULL) (195.220.102.23)


Hello.

I have a strange behavior with round() when it has to deal with 5.
It sometimes rounds up, sometimes rounds down. Example :

coma effect :
> round(0.5,0)
[1] 0
> round(0.25,1)
[1] 0.2
> round(0.225,2)
[1] 0.23

Previous number effect :
> round(0.35,1)
[1] 0.3
> round(0.45,1)
[1] 0.5

It also happens with signif()

Is it normal ?
Many thanks.

Gael.




More information about the R-devel mailing list