Skip to content
Prev 311087 / 398506 Next

Can R change my input at higher precision

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