C asin
In C, asin returns the inverse sine in radians. For real inputs from −1 to 1, the result lies between −π/2 and π/2.
A simple example
asin
- Start with 0
- Do this Find the angle with sine 0
- Result 0 radians
#include <stdio.h>
#include <math.h>
int main(void) {
printf("%.15g\n", (double) (asin(0.0)));
}
0
Syntax
asin(riseFraction)
Run these examples in C
Save one example at a time as lesson.c. Use C17 and a Unix-style shell.
cc -std=c17 -Wall -Wextra lesson.c -lm -o lesson
./lessonRecover a ladder angle from its height
A maintenance team is sketching a ladder or lifting arm against a wall. Use the known length and angle or height to recover the missing dimension and check the units before entering it in the drawing.
#include <math.h>
#include <stdio.h>
int main(void) {
double riseFraction = 0.5;
printf("%.3f\n", asin(riseFraction));
return 0;
}
0.524
A rise of half the ladder length gives about 0.524 radians, or 30 degrees.
Set the angle on a stage drawing
A 5 m model beam runs from the stage floor to a point 3 m above it. The set designer needs the angle from the horizontal in radians.
The height is opposite the marked angle. Divide it by the beam length.
Draw a level platform arm
A museum exhibit has an arm that starts level with its pivot. Its zero vertical rise provides a quick check before the designer animates it.
The ratio zero gives an angle of zero.
What to watch for
For real results the ratio must be between minus one and one.