From pmosquin at hotmail.com  Wed Aug 17 03:33:13 2005
From: pmosquin at hotmail.com (Paul Mosquin)
Date: Tue, 16 Aug 2005 21:33:13 -0400
Subject: [Rd] bug? (PR#8074)
In-Reply-To: <Pine.A41.4.61b.0508161605490.213406@homer08.u.washington.edu>
Message-ID: <BAY105-F4177524FBD782B41AA91BDCDB30@phx.gbl>

Thomas,

Thank you for your response.  I checked the FAQ and it provides an example 
using sqrt(2) where you'd expect numerical precision to be an issue.

I guess that I expect R to act pretty much as C or C++ would do if I were to 
program the same code.  It's a bit of a surprise that assignment of 
rationals, well within precision, followed by multiplication leading to a 
result well within precision picks up those extra bits along the way.  
Something to watch out for, to be sure.

Thanks again for your help

Paul


>From: Thomas Lumley <tlumley at u.washington.edu>
>To: pmosquin at hotmail.com
>CC: r-devel at stat.math.ethz.ch, R-bugs at biostat.ku.dk
>Subject: Re: [Rd] bug? (PR#8074)
>Date: Tue, 16 Aug 2005 16:06:48 -0700 (PDT)
>
>On Wed, 17 Aug 2005 pmosquin at hotmail.com wrote:
>>I just don't understand this:
>>
>>>(2*2)==4
>>[1] TRUE
>>>.2*.2
>>[1] 0.04
>>>(.2*.2)==.04
>>[1] FALSE
>
>It's a FAQ, not a bug. Consider:
>
>>(.2*.2) - .04
>[1] 6.938894e-18
>
>and read the FAQ
>
>	-thomas
>
>
>>or
>>
>>>x=.04
>>>x
>>[1] 0.04
>>>y=.2*.2
>>>y
>>[1] 0.04
>>>y==x
>>[1] FALSE
>>
>>______________________________________________
>>R-devel at r-project.org mailing list
>>https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>
>Thomas Lumley			Assoc. Professor, Biostatistics
>tlumley at u.washington.edu	University of Washington, Seattle



[Rd] bug? (PR#8074)
Paul Mosquin