trig(3M) manual page
Table of Contents
trig, sin, cos, tan, asin, acos, atan, atan2 - trigonometric functions
cc [ flag ... ] file ... -lm [ library ... ]
#include <math.h>
double sin(double
x);
double cos(double x);
double tan(double x);
double asin(double x);
double acos(double x);
double atan(double x);
double atan2(double y, double
x);
MT-Safe
sin(x), cos(x) and tan(x)
return trigonometric functions of radian arguments. Trigonometric argument
reduction is carried out with respect to the infinitely precise *p.
asin(x)
returns the arc sine of x in the range -*p/2 to *p/2.
acos(x) returns the
arc cosine of x in the range 0 to *p.
atan(x) returns the arc tangent of
x in the range -*p/2 to
*p/2.
atan2(y,x) and hypot(x,y) (see hypot(3M)
) convert rectangular coordinates
(x,y) to polar (r,*h); atan2(y,x) computes *h, the argument or phase, by
computing an arc tangent of y/x in the range -*p to *p.
For
exceptional cases, matherr(3M)
tabulates the values to be returned as dictated
by various Standards.
hypot(3M)
, matherr(3M)
In IEEE754
mode (i.e. the -xlibmieee cc compilation option), these functions handle exceptional
arguments in the spirit of ANSI/IEEE
Std 754-1985. sin(±if), cos(±if) and tan(±if)
return NaN; asin(x) and acos(x) return NaN if |x|>1.
atan(±if) returns ±*p/2. For atan2(),
· atan2(±0,x) returns ±0 for x > 0 or x = +0;
· atan2(±0,x) returns ±*p for x < 0 or x = -0;
· atan2(y,±0) returns *p/2 for y > 0;
· atan2(y,±0) returns -*p/2 for y < 0;
· atan2(±y,if) returns ±0 for finite y > 0;
· atan2(±if,x) returns ±*p/2 for finite x;
· atan2(±y,-if) returns ±*p for finite y > 0;
· atan2(±if,if) returns ±*p/4;
· atan2(±if,-if) returns ±3*p/4.
Table of Contents