Calculates the arcsine.
double asin( double x );
Routine | Required Header | Compatibility |
asin | <math.h> | ANSI, Win 95, Win NT |
For additional compatibility information, see Compatibility in the Introduction.
Libraries
LIBC.LIB | Single thread static library, retail version |
LIBCMT.LIB | Multithread static library, retail version |
MSVCRT.LIB | Import library for MSVCRT.DLL, retail version |
Return Value
The asin function returns the arcsine of x in the range –π/2 to π/2 radians. If x is less than –1 or greater than 1, asin returns an indefinite (same as a quiet NaN). You can modify error handling with the _matherr routine.
Parameter
x
Value whose arcsine is to be calculated
Example
/* ASINCOS.C: This program prompts for a value in the range
* -1 to 1. Input values outside this range will produce
* _DOMAIN error messages.If a valid value is entered, the
* program prints the arcsine and the arccosine of that value.
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
void main( void )
{
double x, y;
printf( "Enter a real number between -1 and 1: " );
scanf( "%lf", &x );
y = asin( x );
printf( "Arcsine of %f = %f\n", x, y );
y = acos( x );
printf( "Arccosine of %f = %f\n", x, y );
}
Output
Enter a real number between -1 and 1: .32696
Arcsine of 0.326960 = 0.333085
Arccosine of 0.326960 = 1.237711