TRIG(3M) — MATHEMATICAL LIBRARY
NAME
sin, cos, tan, asin, acos, atan, atan2 − trigonometric functions
SYNOPSIS
#include <math.h>
double sin(x)
double x;
double cos(x)
double x;
void sincos(x, s, c)
double x, ∗s, ∗c;
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, sincos, and tan() return trigonometric functions of radian arguments. The values of trigonometric functions of arguments exceeding π/4 in magnitude are affected by the precision of the approximation to π/2 used to reduce those arguments to the range −π/4 to π/4. Argument reduction may occur in hardware or software; if in software, the variable fp_pi defined in <math.h> allows changing that precision at run time. Trigonometric argument reduction is discussed in the Floating Point Programmers Guide. Note that sincos(x,s,c) allows simultaneous computation of ∗s = sin(x) and ∗c = cos(x).
asin() returns the arc sin in the range −π/2 to π/2.
acos() returns the arc cosine in the range 0 to π.
atan() returns the arc tangent of x in the range −π/2 to π/2.
atan2(y,x) and hypot(3M) convert rectangular coordinates (x,y) to polar (r,θ); atan2() computes θ, the argument or phase, by computing an arc tangent of y/x in the range −π to π. atan2(0.0,0.0) is ±0.0 or ±π, in conformance with 4.3BSD, as discussed in the Floating Point Programmers Guide.
DIAGNOSTICS
These functions handle exceptional arguments in the spirit of ANSI/IEEE Std 754-1985. sin(±∞), cos(±∞), tan(±∞), or asin(x) or acos(x) with |x|>1, return NaN. In addition, asin, acos, and atan2() may also set errno and call matherr(3M).
SEE ALSO
Sun Release 4.0 — Last change: 22 November 1987