Previous Page
Next Page


Calculates the inverse sine of a number

#include <math.h>
double asin ( double x  );
float asinf ( float x  );         (C99)
long double asinl ( long double x  );         (C99)

asin( ) implements the inverse sine function, commonly called arc sine. The argument x must be between -1 and 1, inclusive: -1 x 1. If x is outside the function's domainthat is, if x is greater than 1 or less than -1the function incurs a domain error.

The return value is given in radians, and is thus in the range -p/2 asin(x) p/2.


 * Calculate the altitude of the sun (its angle upward from the horizon)
 * given the height of a vertical object and the length of the object's
 * shadow.
#define PI 3.141593
#define DEG_PER_RAD (180.0/PI)

float height = 2.20F;
float length = 1.23F;
float altitude = asinf( height / sqrtf( height*height + length*length ));
printf( "The sun's altitude is %2.0f\xB0.\n", altitude * DEG_PER_RAD );

This code produces the following output:

The sun's altitude is 61°.

See Also

Arcsine functions for complex numbers: casin( ), casinf( ), and casinl( )

Previous Page
Next Page