CKTIS / C
asin — arcsine
The asin function from <math.h> computes the principal arcsine of a double argument and returns an angle in radians.
Version: C23; repository compiler flag, production runtime not attested
Syntax
#include <math.h>
double asin(double x);asin(x) returns the angle whose sine is x, in the interval [−π/2, +π/2] radians. Its argument and result have type double; <math.h> provides its declaration. It is the inverse of sine on an appropriately restricted interval, not the reciprocal 1 / sin(x).
An argument outside [−1, +1] causes a domain error. A nonzero argument too close to zero causes a range error. Do not assume every error sets errno: reporting depends on math_errhandling. In the example, 0.5 corresponds to an angle of approximately π/6.
Examples
#include <math.h>
#include <stdio.h>
int main(void)
{
double x = 0.5;
double angle = asin(x);
printf("asin(%.1f) = %.6f rad\n", x, angle);
return 0;
}
Result
asin(0.5) = 0.523599 rad
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.