Content-type: text/html
#include <math.h>
double sin (double x);
float sinf (float x);
double sind (double x);
float sindf (float x);
double cos (double x);
float cosf (float x);
double cosd (double x);
float cosdf (float x);
double tan (double x);
float tanf (float x);
double tand (double x);
float tandf (float x);
double cot (double x);
float cotf (float x);
double cotd (double x);
float cotdf (float x);
double asin (double x);
float asinf (float x);
double asind (double x);
float asindf (float x);
double acos (double x);
float acosf (float x);
double acosd (double x);
float acosdf (float x);
double atan (double x);
float atanf (float x);
double atand (double x);
float atandf (float x);
double atan2 (double y, double x);
float atan2f (float y, float x);
double atand2 (double y, double x);
float atand2f (float y, float x);
double_complex sincos (double x);
float_complex sincosf (float x);
double_complex sincosd (double x);
float_complex sincosdf (float x);
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.
The sin() and sinf() functions compute the sine of x, measured in radians.
The sind() and sindf() functions compute the sine of x, measured in degrees.
The cos() and cosf() functions compute the cosine of x, measured in radians.
The cosd() and cosdf() functions compute the cosine of x, measured in degrees.
The tan() and tanf() functions compute the tangent of x, measured in radians.
The tand() and tandf() functions compute the tangent of x, measured in degrees.
The cot() and cotf() functions compute the cotangent of x, measured in radians.
The cotd() and cotdf() functions compute the cotangent of x, measured in degrees.
The asin() and asinf() 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() and asindf() 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() and acosf() 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() and acosdf() 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() and atanf() functions compute the principal value of the arc tangent of x in the interval [-pi/2,pi/2] radians.
The atand() and atandf() functions compute the principal value of the arc tangent of x in the interval [-90,90] degrees.
The atan2() and atan2f() 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() and atand2f() 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 sincos() and sincosf() functions compute the sine and cosine of x, measured in radians.
The sincosd() and sincosdf() functions compute the sine and cosine of x, measured in degrees.
Double_complex and float_complex data types can be used only by languages that support them.
The following table describes function behavior in response to exceptional arguments:
Function | Exceptional Argument | Routine Behavior |
sin(), sinf() | |x| = infinity | Invalid argument |
sind(), sindf() | |x| = infinity | Invalid argument |
sind(), sindf() | |x| < (180/pi) * min_float | Underflow |
cos(), cosf() | |x| = infinity | Invalid argument |
cosd(), cosdf() | |x| = infinity | Invalid argument |
tan(), tanf() | |x| = infinity | Invalid argument |
tand(), tandf() | |x| = infinity | Invalid argument |
tand(), tandf() | |x| < (180/pi) * min_float | Underflow |
tand(), tandf() | x = (2n+1) * 90 | Overflow |
cot(), cotf() | x = 0 | Overflow |
cotd(), cotdf() | |x| = multiples of 180 degrees | Overflow |
asin(), asinf() | |x| > 1 | Invalid argument |
asind(), asindf() | |x| > 1 | Invalid argument |
acos(), acosf() | |x| > 1 | Invalid argument |
acosd(), acosdf() | |x| > 1 | Invalid argument |
atan2(), atan2f() | x = y = 0 | Invalid argument |
atan2(), atan2f() | |x| = |y| = infinity | Invalid argument |
atand2(), atand2f() | x = y = 0 | Invalid argument |
atand2(), atand2f() | |x| = |y| = infinity | Invalid argument |
sincos(), sincosf() | |x| = infinity | Invalid argument |
sincosd(), sincosdf() | |x| = infinity | Invalid argument |
The following table lists boundary values used by these functions:
Value | Data | Hexadecimal Value | Decimal Value |
Name | Type | ||
(180/pi) | S_FLOAT | 00000039 | 8.028849e-44 |
* min_float | |||
T_FLOAT | 0000000000000039 | 2.830787630910868e-322 | |