From tlumley at u.washington.edu  Wed Mar 16 00:26:30 2005
From: tlumley at u.washington.edu (Thomas Lumley)
Date: Wed Mar 16 00:26:48 2005
Subject: [Rd] Trigonometric functions (PR#7728)
In-Reply-To: <Pine.LNX.4.44.0503160018280.2246-100000@kleigh.nl>
References: <Pine.LNX.4.44.0503160018280.2246-100000@kleigh.nl>
Message-ID: <Pine.A41.4.61b.0503151524570.383546@homer03.u.washington.edu>

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


[Rd] Trigonometric functions (PR#7728)
Thomas Lumley