CKTIS / C
sin — sine of an angle in radians
The sin function from <math.h> computes the sine of a double argument measured in radians and returns a double.
Version: C23; repository compiler flag, production runtime not attested
Syntax
#include <math.h>
double sin(double x);sin(x) from <math.h> computes the sine of angle x in radians, not degrees. Its argument and result have type double; the counterparts for float and long double are sinf and sinl.
Floating-point results may be approximate. A range error may occur for nonzero x too close to zero. Under Annex F conformance, sin preserves signed zero; infinity produces NaN and raises the “invalid” floating-point exception.
The example uses zero; fabs removes any zero sign before printing. N3096 is a C23 draft, not an attestation of production-runtime behavior.
Examples
#include <math.h>
#include <stdio.h>
int main(void)
{
double x = 0.0;
double y = sin(x);
printf("sin(0) = %.0f\n", fabs(y));
return 0;
}
Result
sin(0) = 0
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.