Format
#include <math.h> double asin(double x);
Language Level: ANSI, POSIX, XPG4
asin calculates the arcsine of x, in the range -PI/2
to PI/2 radians.
Return Value
asin returns the arcsine of x. The value of x
must be between -1 and 1. If x is less than -1 or
greater than 1, asin sets errno to EDOM, and returns a value of
0.
Example
This example prompts for a value for x. It prints an
error message if x is greater than 1 or less than -1;
otherwise, it assigns the arcsine of x to y.
#include <stdio.h> #include <stdlib.h> #include <math.h>
#define MAX 1.0 #define MIN -1.0
int main(void)
{
double x, y;
printf("Enter x\n");
scanf("%lf", &x);
/* Output error if not in range */
if (x > MAX)
printf("Error: %lf too large for asin\n", x);
else
if (x < MIN)
printf( "Error: %lf too small for asin\n", x );
else {
y = asin( x );
printf( "asin( %lf ) = %lf\n", x, y );
}
return 0;
/****************************************************
For the following input: 0.2
The output should be:
Enter x
asin( 0.200000 ) = 0.201358
****************************************************/
}
![]()
acos -- Calculate Arccosine
atan - atan2 -- Calculate Arctangent
cos -- Calculate Arctangent
cosh -- Calculate Hyperbolic Cosine
_fasin -- Calculate Arcsine
_fcossin -- Calculate Cosine and S ine
_fsin -- Calculate Sine
_fsincos -- Calculate Sine and Cos ine
sin -- Calculate Sine
sinh -- Calculate Hyperbolic Sine
tan -- Calculate Tangent
tanh -- Calculate Hyperbolic Tangent
<math.h>