[R] precision issue?

Berend Hasselman bhh at xs4all.nl
Thu Mar 4 11:59:22 CET 2010



Alexander Nervedi wrote:
> 
> I am trying to figure out what is going on here.
> 
>> a <- 68.08
>> b <- a-1.55
>> a-b
> [1] 1.55
>> a-b == 1.55
> [1] FALSE
>> round(a-b,2) == 1.55
> [1] TRUE
>> round(a-b,15) == 1.55
> [1] FALSE
> 
> Why should (a - b) == 1.55 fail when in fact b has been defined to be a -
> 1.55?  Is this a precision issue? How do i correct this?
> 

Read th R FAQ.
See 7.31 Why doesn't R think these numbers are equal?

Berend
-- 
View this message in context: http://n4.nabble.com/precision-issue-tp1577815p1577903.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list