From gael.millot at curie.fr  Fri Sep  1 11:14:55 2006
From: gael.millot at curie.fr (gael.millot at curie.fr)
Date: Fri,  1 Sep 2006 11:14:55 +0200 (CEST)
Subject: [Rd] round() increases or decreases (PR#9195)
Message-ID: <20060901091455.2D1D519A0A@slim.kubism.ku.dk>

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.




[Rd] round() increases or decreases (PR#9195)
gael.millot at curie.fr