Format
#include <math.h> double sin(double x);
Language Level: ANSI, POSIX, XPG4
sin calculates the sine of x, with x
expressed in radians. If x is too large, a partial
loss of significance in the result may occur.
Return Value
sin returns the value of the sine of x.
Example
This example computes y as the sine of pi/2.
#include <math.h> #include <stdio.h>
int main(void)
{
double pi, x, y;
pi = 3.1415926535; x = pi/2; y = sin(x);
printf("sin( %lf ) = %lf\n", x, y);
return 0;
/***************************************
The output should be:
sin( 1.570796 ) = 1.000000 ***************************************/ }
![]()
acos -- Calculate Arccosine
asin -- Calculate Arcsine
atan - atan2 -- Calculate Arctangent
cos -- Calculate Cosine
cosh -- Calculate Cosine
_fasin -- Calculate Arcsine
_fcossin -- Calculate Cosine and Sine
_fsin -- Calculate Sine
_fsincos -- Calculate Sine and Cosine
sinh -- Calculate Hyperbolic Sine
tan -- Calculate Tangent
tanh -- Calculate Hyperbolic Tangent
<math.h>