On Wed, 16 Mar 2005, Peter Kleiweg wrote:

Thomas Lumley schreef op de 15e dag van de lentemaand van het jaar 2005:


x<-sqrt(2)
asin(x^2-1)
result in:
NaN

Because you can't take the arcsin of 2^2-1=3.

Wrong answer.

You're right. It's actually because you can't take the arcsin of 1+4.4e-16. Same problem, just less extreme.


x<-sqrt(2)
x^2-1==1
[1] FALSE
x^2-1>1
[1] TRUE
x^2-1-1
[1] 4.440892e-16


-thomas

______________________________________________
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to