[Rd] Trigonometric functions (PR#7728)

Thomas Lumley tlumley at u.washington.edu
Wed Mar 16 00:26:30 CET 2005


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



More information about the R-devel mailing list