[R] Can R change my input at higher precision

Gonçalo Ferraz gferraz29 at gmail.com
Sat Nov 17 13:56:40 CET 2012


I just found a problem that may be causing an error in a computation with very small numbers:

I tell R that 

thetaP <- 5.531003

and when I ask R to show me thetaP with more precision, it gives me

thetaP
[1] 5.531003000000000114

and even more surprising, if I write

thetaP <- 5.531003000000000000

again, I get:

thetaP
[1] 5.531003000000000114

Is this supposed to happen?

Is there a way to avoid it?

Thank you for any advice.

Gonçalo



More information about the R-help mailing list