# Library Function asin in Math Class

## Library Function asin of math.h Header File in C

On this page we will discuss about library function asin in math class which is used in C. The C header file math.h contains the standard math library functions that can be used for performing various mathematical operations. The asin function returns the arc sine of x in radians.

## Library Function asin of math.h Header File

In C programming language the asin function is included in math.h header file.

The asin function takes input argument in the range of $(-1 \leq x \leq 1)$ and returns the inverse sine of a parameter x in radians.

### Declaration of asin function

 double asin(double x)

We can find the inverse sine of different data types like int, float or long double by using the cast operator which explicitly converts the data type to double as given below:

int x = 0;
double result;
result = asin(double(x));


### Parameters of asin function

The value of sine lies in the range of -1 to 1, hence the asin function accepts input argument or values in the range of [-1,+1].

ParameterDescription
double valueThis value of double function is in between – 1 and +1 inclusive.

### Return value of asin function

The asin function returns the principal value of inverse sine of  parameter x in the range of [ $-\frac{\Pi }{2},+\frac{\Pi }{2}$ ] in radians. The function returns NaN if the parameter passed to asin function is greater than 1 or less than -1.

ParameterReturn Value
x = [-1, +1][ $-\frac{\Pi }{2},+\frac{\Pi }{2}$  ] in radians
x>1 or x<-1NaN (not a number)

### Implementation of Library Function math.h asin

The following code shows the use of asin function with different parameters passed to the function.

Run
#include <stdio.h>
#include <math.h>

int main ()
{

// constant PI is defined
const double PI = 3.1415926;
double y, inverse_of_function;

y = -0.8;
inverse_of_function = asin (y);
printf ("The inverse of sin(%.2f) function = %.2lf in radians\n", y,inverse_of_function);

inverse_of_function = asin (y) * 180 / PI;
printf ("The inverse of sin(%.2f) function = %.2lf in degrees\n", y,inverse_of_function);

// parameter not in range
y = 1.5;
inverse_of_function = asin (y);
printf ("The inverse of sin(%.2f) function = %.2lf", y,inverse_of_function);

return 0;
}


### Output:

The inverse of sin(-0.80) function = -0.93 in radians
The inverse of sin(-0.80) function = -53.13 in degrees
The inverse of sin(1.50) function = nan


### Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

## Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others