Re: [R] help for the first poster- a simple question

From: Marianne Promberger <>
Date: Mon, 03 Mar 2008 18:49:54 +0000

On 03/03/08 12:52, Xuejun Qin wrote:
> Hi, there,
> I cannot get accurate value for calculation.
> for example:
> ld<-sqrt(1*0.05*0.95*0.05*0.95)
> 0.05*0.95-ld=-6.938894e-18
> 0.05*0.95-ld==0 is False.
> I met this problem in my program, how can I handle it. Thanks.

I think what you are experiencing is this:

(R FAQ "7.31 Why doesn't R think these numbers are equal?")

Maybe handle it using round().

HTH m. mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Mon 03 Mar 2008 - 18:58:38 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 03 Mar 2008 - 19:30:25 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive