Standards / Extensions | C or C++ | Dependencies |
---|---|---|
ISO C |
both |
#include <math.h>
double sin(double x);
float sin(float x); /* C++ only */
long double sin(long double x); /* C++ only */
float sinf(float x);
long double sinl(long double x);
If successful, the function returns the calculated value, expressed as a double, float, or long double. Otherwise, if the result is an underflow, the function returns 0 and sets the errno to ERANGE.
⁄* CELEBS27
This example computes y as the sine of &pi.&slr.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);
}
sin( 1.570796 ) = 1.000000