SIN(3M) — UNIX Programmer’s Manual
NAME
sin, cos, tan, asin, acos, atan, atan2 − trigonometric functions and their inverses
SYNOPSIS
#include <math.h>
double sin(x)
double x;
double cos(x)
double x;
double tan(x)
double x;
double asin(x)
double x;
double acos(x)
double x;
double atan(x)
double x;
double atan2(y,x)
double y,x;
DESCRIPTION
Sin, cos and tan return trigonometric functions of radian arguments x.
Asin returns the arc sine in the range −π/2 to π/2.
Acos returns the arc cosine in the range 0 to π.
Atan returns the arc tangent in the range −π/2 to π/2.
ERROR (due to roundoff, etc.)
Let P stand for the number stored in the computer in place of π = 3.14159 26535 89793 23846 26433 ... . Let "trig" stand for one of "sin", "cos" or "tan". Then the expression "trig(x)" in a program actually produces an approximation to trig(x∗π/P), and "atrig(x)" approximates (P/π)∗atrig(x). The approximations are close.
In the codes that run on other machines, P differs from π by a fraction of an ulp; the difference matters only if the argument x is huge, and even then the difference is likely to be swamped by the uncertainty in x. Besides, every trigonometric identity that does not involve π explicitly is satisfied equally well regardless of whether P = π. For instance, sin2(x)+cos2(x) = 1 and sin(2x) = 2sin(x)cos(x) to within a few ulps no matter how big x may be. Therefore the difference between P and π is most unlikely to affect scientific and engineering computations.
SEE ALSO
AUTHOR
Robert P. Corbett, W. Kahan, Stuart I. McDonald, Peter Tang and, for the codes for IEEE 754, Dr. Kwok−Choi Ng.
4th Berkeley Distribution — May 12, 1986