From tlumley at u.washington.edu  Sun Aug  3 21:15:43 2003
From: tlumley at u.washington.edu (Thomas Lumley)
Date: Mon Aug  4 05:15:48 2003
Subject: [Rd] round to even digit (PR#3604)
In-Reply-To: <200307311753.h6VHrpJH009691@pubhealth.ku.dk>
Message-ID: <Pine.A41.4.44.0308032008060.78202-100000@homer36.u.washington.edu>

On Thu, 31 Jul 2003 kbroman@jhsph.edu wrote:

> Full_Name: Karl W Broman
> Version: 1.7.1
> OS: Linux
> Submission from: (NULL) (162.129.44.18)
>
>
> There appears to be a slight problem with round(); for rounding off a 5,
> it should go to the even digit, but there appear to be some cases where
> it goes to an odd digit; see below.
>

I think this may be a case where the number doesn't actually end in 5, it
just appears to
> round(217.5)
[1] 218
> round(21.75*10)
[1] 218
> round(2.175*100)
[1] 217
> round(0.2175*1000)
[1] 218
since .175 isn't exactly expressible in binary.

	-thomas

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley@u.washington.edu	University of Washington, Seattle


[Rd] round to even digit (PR#3604)
Thomas Lumley