function
<cmath> <ctgmath>

asin

double asin(double x);
     double asin  (double x);      float asinf (float x);long double asinl (long double x);
     double asin (double x);      float asin (float x);long double asin (long double x);
     double asin (double x);      float asin (float x);long double asin (long double x);     double asin (T x);           // additional overloads for integral types
Compute arc sine
Returns the principal value of the arc sine of x, expressed in radians.

In trigonometrics, arc sine is the inverse operation of sine.

Header <tgmath.h> provides a type-generic macro version of this function.
This function is overloaded in <valarray> (see valarray asin).
Additional overloads are provided in this header (<cmath>) for the integral types: These overloads effectively cast x to a double before calculations (defined for T being any integral type).

This function is also overloaded in <complex> and <valarray> (see complex asin and valarray asin).

Parameters

x
Value whose arc sine is computed, in the interval [-1,+1].
If the argument is out of this interval, a domain error occurs.

Return Value

Principal arc sine of x, in the interval [-pi/2,+pi/2] radians.
One radian is equivalent to 180/PI degrees.

If a domain error occurs, the global variable errno is set to EDOM.
If a domain error occurs:
- And math_errhandling has MATH_ERRNO set: the global variable errno is set to EDOM.
- And math_errhandling has MATH_ERREXCEPT set: FE_INVALID is raised.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* asin example */
#include <stdio.h>      /* printf */
#include <math.h>       /* asin */

#define PI 3.14159265

int main ()
{
  double param, result;
  param = 0.5;
  result = asin (param) * 180.0 / PI;
  printf ("The arc sine of %f is %f degrees\n", param, result);
  return 0;
}

Output:

The arc sine of 0.500000 is 30.000000 degrees.


See also