SIN

Section: Mathematical Library (3M)
Updated: August 1, 1992
Index Return to Main Contents
 

NAME

sin, cos, tan, asin, acos, atan, atan2 - trigonometric functions and their inverses  

SYNOPSIS

#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);
 

DESCRIPTION

Sin, cos and tan return trigonometric functions of radian arguments x.

Asin returns the arc sine in the range -pi/2 to pi/2.

Acos returns the arc cosine in the range 0 to pi.

Atan returns the arc tangent in the range -pi/2 to pi/2.

Atan2 computes the principal value of the arc tangent of y/x, using the signs of both arguments to determine the quadrant of the return value. The arc tangent returned is in the range [- pi , + pi ]  

ERROR (due to roundoff, etc.)

Let P stand for the number stored in the computer in place of pi = 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*pi/P), and ``atrig(x)'' approximates (P/pi)*atrig(x). The approximations are close.

In the codes that run on other machines, P differs from pi 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 pi explicitly is satisfied equally well regardless of whether P = pi. For instance, sin(x)**2+cos(x)**2 = 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 pi is most unlikely to affect scientific and engineering computations.  

SEE ALSO

math(3M), hypot(3M), sinh(3M), sqrt(3M)  

AUTHOR

Robert P. Corbett, W. Kahan, Stuart I. McDonald, Peter Tang and, for the codes for IEEE 754, Dr. Kwok-Choi Ng.


 

Index

NAME
SYNOPSIS
DESCRIPTION
ERROR (due to roundoff, etc.)
SEE ALSO
AUTHOR

This document was created by man2html, using the manual pages.
Time: 17:21:16 GMT, March 25, 2025