sin(3) — Subroutines
NAME
sin, sind, cos, cosd, tan, tand, cot, cotd, asin, asind, acos, acosd, atan, atand, atan2, atand2 − Trigonometric and inverse trigonometric functions in radian and degree calculations.
SYNOPSIS
#include <math.h>
double sin(
double x ); float sinf(
float x ); long double sinl(
long double x ); double sind(
double x ); float sindf(
float x ); long double sindl(
long double x,
float x ); double cos(
double x ); float cosf(
float x ); long double cosl(
long double x ); double cosd(
double x ); float cosdf(
float x ); long double cosdl(
long double x ); double tan(
double x ); float tanf(
float x ); long double tanl(
long double x ); double tand(
double x ); float tandf(
float x ); long double tandl(
long double x ); double cot(
double x ); float cotf(
float x ); long double cotl(
long double x ); double cotd(
double x ); float cotdf(
float x ); long double cotdl(
long double x ); double asin(
double x ); float asinf(
float x ); long double asinl(
long double x ); double asind(
double x ); float asindf(
float x ); long double asindl(
long double x ); double acos(
double x ); float acosf(
float x ); long double acosl(
long double x ); double acosd(
double x ); float acosdf(
float x ); long double acosdl(
long double x ); double atan(
double x ); float atanf(
float x ); long double atanl(
long double x ); double atand(
double x ); float atandf(
float x ); long double atandl(
long double x ); double atan2(
double y,
double x ); float atan2f(
float y,
float x ); long double atan2l(
long double y,
long double x ); double atand2(
double y,
double x ); float atand2f(
float y,
float x ); long double atand2l(
long double y,
long double x );
LIBRARY
Math Library (libm)
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
acos(): XPG4
asin(): XPG4
atan(): XPG4
atan2(): XPG4
cos(): XPG4
sin(): XPG4
tan(): XPG4
Refer to the standards(5) reference page for more information about industry standards and associated tags.
DESCRIPTION
The sin(), sinf(), and sinl() functions compute the sine of x, measured in radians.
The sind(), sindf(), and sindl() functions compute the sine of x, measured in degrees.
The cos(), cosf(), and cosl() functions compute the cosine of x, measured in radians.
The cosd(), cosdf(), and cosdl() functions compute the cosine of x, measured in degrees.
The tan(), tanf(), and tanl() functions compute the tangent of x, measured in radians.
The tand(), tandf(), and tandl() functions compute the tangent of x, measured in degrees.
The cot(), cotf(), and cotl() functions compute the cotangent of x, measured in radians.
The cotd(), cotdf(), and cotdl() functions compute the cotangent of x, measured in degrees.
The asin(), asinf(), and asinl() functions compute the principal value of the arc sine of x in the interval [−pi/2,pi/2] radians. The value of x must be in the domain [−1,1].
The asind(), asindf(), and asindl() functions compute the principal value of the arc sine of x in the interval [−90,90] degrees. The value of x must be in the domain [−1,1].
The acos(), acosf(), and acosl() functions compute the principal value of the arc cosine of x in the interval [0,pi] radians. The value of x must be in the domain [−1,1].
The acosd(), acosdf(), and acosdl() functions compute the principal value of the arc cosine of x in the interval [0,180] degrees. The value of x must be in the domain [−1,1].
The atan(), atanf(), and atanl() functions compute the principal value of the arc tangent of x in the interval [−pi/2,pi/2] radians.
The atand(), atandf(), and atandl() functions compute the principal value of the arc tangent of x in the interval [−90,90] degrees.
The atan2(), atan2f(), and atan2l() functions compute the principal value of the arc tangent of y/x, in the interval [−pi,pi] radians. The sign of atan2 and atan2f is determined by the sign of y. The value of atan2(y,x) is computed as follows where f is the number of fraction bits associated with the data type.
| Value of Input Arguments | Angle Returned |
| x = 0 or y/x > 2∗∗(f+1) | pi/2 ∗ (sign y) |
| x > 0 and y/x <= 2∗∗(f+1) | atan(y/x) |
| x < 0 and y/x <= 2∗∗(f+1) | pi ∗ (sign y) + atan(y/x) |
The atand2(), atand2f(), and atand2l() functions compute the principal value of the arc tangent of y/x in the interval [−180,180] degrees. The sign of atand2() and atand2f() is determined by the sign of y.
The following table describes function behavior in response to exceptional arguments:
| Function | Exceptional Argument | Routine Behavior |
| sin(), sinf(), sinl() | |x| = infinity | Invalid argument |
| sind(), sindf(), sindl() | |x| = infinity | Invalid argument |
| sind(), sindf(), sindl() | |x| < (180/pi) ∗ min_float | Underflow |
| cos(), cosf(), cosl() | |x| = infinity | Invalid argument |
| cosd(), cosdf(), cosdl() | |x| = infinity | Invalid argument |
| tan(), tanf(), tanl() | |x| = infinity | Invalid argument |
| tand(), tandf(), tandl() | |x| = infinity | Invalid argument |
| tand(), tandf(), tandl() | |x| < (180/pi) ∗ min_float | Underflow |
| tand(), tandf(), tandl() | x = (2n+1) ∗ 90 | Overflow |
| cot(), cotf(), cotl() | x = 0 | Overflow |
| cotd(), cotdf(), cotdl() | |x| = multiples of 180 degrees | Overflow |
| asin(), asinf(), asinl() | |x| > 1 | Invalid argument |
| asind(), asindf(), asindl() | |x| > 1 | Invalid argument |
| acos(), acosf(), acosl() | |x| > 1 | Invalid argument |
| acosd(), acosdf(), acosdl() | |x| > 1 | Invalid argument |
| atan2(), atan2f(), atan2l() | x = y = 0 | Invalid argument |
| atan2(), atan2f(), atan2l() | |x| = |y| = infinity | Invalid argument |
| atand2(), atand2f(), atand2l() | x = y = 0 | Invalid argument |
| atand2(), atand2f(), atand2l() | |x| = |y| = infinity | Invalid argument |
The following table lists boundary values used by these functions:
| Value Name | Data Type | Hexadecimal Value | Decimal Value |
| (180/pi) | S_FLOAT | 00000039 | 8.028849e-44 |
| ∗ min_float | |||
| T_FLOAT | 0000000000000039 | 2.830787630910868e-322 |