[R] Numerical precision problem

C.Rosa at lse.ac.uk C.Rosa at lse.ac.uk
Fri Dec 21 20:52:29 CET 2007


Dear All,

 

I have a numerical problem:

R, as other statistical software, can tell the difference between very small numbers and 0, while apparently cannot distinguish a number close to 1 and 1. In the example below, is it possible to instruct R to recognize that q is different from 1?

> p=.00000000000000000000000000000001

> p==0

[1] FALSE

> q=.99999999999999999999999999999

> q==1

[1] TRUE

Interestingly, 

> (1-p)==1

[1] TRUE

The main problem I have is that I need to evaluate the inverse of the normal Cumulative Distribution Function near 1 (but not exactly 1) and the PC cannot recognize it.

Thank you very much for your help!

Carlo


Please access the attached hyperlink for an important electronic communications disclaimer: http://www.lse.ac.uk/collections/secretariat/legal/disclaimer.htm



More information about the R-help mailing list