Format
#include <math.h>
double sin(double x);
Language Level: ANSI
Threadsafe: Yes.
Description
The sin() function 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
The sin() function returns the value of the sine of x. The value of errno may be set to either EDOM or ERANGE.
Example that uses sin()
This example computes y as the sine of π/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);
}
/********************* Output should be similar to: *************
sin( 1.570796 ) = 1.000000
*/
Related Information