Re: [Rd] Trigonometric functions (PR#7728)

From: Thomas Lumley <tlumley_at_u.washington.edu>
Date: Tue 15 Mar 2005 - 23:26:30 GMT

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 Received on Wed Mar 16 11:21:07 2005

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 03:21:01 GMT