Calculate the arcsine.
#include <math.h>
#include <errno.h>
double asin( double x );
long double _asinl( long double x );
x | Value whose arcsine is to be calculated |
The asin functions calculate the arcsine of x in the range –p/2 to p/2 radians. The value of x must be between Ô1 and 1. The _asinl function is the 80-bit counterpart, which uses an 80-bit, 10-byte coprocessor form of arguments and return values. See the reference page on the long double functions for more details on this data type.
The asin functions return the arcsine result. If x is less than –1 or greater than 1, asin sets errno to EDOM, prints a _DOMAIN error message to stderr, and returns 0.
Error handling can be modified by using the _matherr (or _matherrl) routine.
asin
Standards:ANSI, UNIX
16-Bit:DOS, QWIN, WIN, WIN DLL
32-Bit:DOS32X
_asinl
Standards:None
16-Bit:DOS, QWIN, WIN, WIN DLL
32-Bit:None
acos functions, atan functions, cos functions, _matherr, sin functions, tan functions
/* 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 );
}
Enter a real number between -1 and 1: .32696
Arcsine of 0.326960 = 0.333085
Arccosine of 0.326960 = 1.237711