Calculates the trigonometric sine function of a single precision floating-point value.
Include
<math.h>
Prototype
float sin (float x);
Argument
x
Return Value
Returns the sine of x
in radians in the ranges of -1 to 1
inclusive.
Remarks
A domain error will occur if x
is a NaN or infinity.
Example
#include <math.h>
#include <stdio.h>
#include <errno.h>
int main(void)
{
float x, y;
errno = 0;
x = -1.0F;
y = sinf (x);
if (errno)
perror("Error");
printf("The sine of %f is %f\n", x, y);
errno = 0;
x = 0.0F;
y = sinf (x);
if (errno)
perror("Error");
printf("The sine of %f is %f\n", x, y);
}
Example Output
The sine of -1.000000 is -0.841471
The sine of 0.000000 is 0.000000