s-news
[Top] [All Lists]

range of argument for trigonometric functions

To: s-news@lists.biostat.wustl.edu
Subject: range of argument for trigonometric functions
From: Naoki Saito <saito@math.ucdavis.edu>
Date: Thu, 15 Nov 2001 11:35:52 -0800
Cc: saito@math.ucdavis.edu
Dear Splus users,

I would like to evaluate trigonometric functions (e.g., sin, cos) for
a really large argument.
And it is interesting to know the following:

> sin(1e+14)
[1] -0.20940830749645
> sin(1e+15)
[1] NA
Warning messages:
  NAs generated in: sin(1e+15)
> sin(4.5035996e+14)
[1] 0.99812756524116
> sin(4.5035997e+14)
[1] NA
Warning messages:
  NAs generated in: sin(1e+15)

So, there is a threshold over which I cannot evaluate sin, cos, tan, etc.
I would greatly appreciate it if you could tell me why this happens, and
how to circumvent this problem.
Incidentally, on matlab, I do not have any problems like this.

Thank you very much for your help!
Naoki Saito

-- 
 Naoki Saito, Ph.D., Professor, Department of Mathematics
 University of California, One Shields Avenue, Davis, CA 95616-8633 USA
 Voice: 530-754-2121, Fax: 530-752-6635, Email: saito@math.ucdavis.edu
 Home Page: http://math.ucdavis.edu/~saito/

<Prev in Thread] Current Thread [Next in Thread>
  • range of argument for trigonometric functions, Naoki Saito <=