You are on page 1of 3

Purpose The inverse trigonometric functions calculate the arcsin, arccos, or arctan of a value, returning the angle in radians.

Header File math.h (asin, acos, atan, atan2) Prototypes


double double double double asin (double Angle); acos (double Angle); atan (double Angle); atan2 (double Y, double X);

Arguments Value The value of the function (sin, cos, or tan) X The abcissa of the angle Y The ordinate of the angle Return Values asin The principal arc sine of the argument (-/2 .. /2), in radians acos The principal arc cosine of the argument (0 .. ), in radians atan The principal arc tangent of the argument (-/2 .. /2), in radians atan2 The arc tangent of Y / X, in the proper quadrant (- .. ), in radians Example
#include <stdio.h> #include <math.h> #include <stdlib.h> void Display (double Value); void Display2 (double Y, double X); double Rad2Deg (double Angle); int main () { Display (.02 * Display (.02 * Display (.02 * Display2 (1.0, Display2 (1.0, (double)(rand() % 100) - 1.0); (double)(rand() % 100) - 1.0); (double)(rand() % 100) - 1.0); 2.0); -2.0);

Display2 (-1.0, 2.0); Display2 (-1.0, -2.0); return 0; } double Rad2Deg (double Angle) { static double ratio = 180.0 / 3.141592653589793238; return Angle * ratio; } void Display (double Value) { double Radians; double Degrees; Radians = asin (Value); Degrees = Rad2Deg (Radians); printf ("The arc sine of %f is %f radians = %f degrees\n", Value, Radians, Degrees); Radians = acos (Value); Degrees = Rad2Deg (Radians); printf ("The arc cosine of %f is %f radians = %f degrees\n", Value, Radians, Degrees); Radians = atan (Value); Degrees = Rad2Deg (Radians); printf ("The arc tangent of %f is %f radians = %f degrees\n\n", Value, Radians, Degrees); } void Display2 (double Y, double X) { double Radians; double Degrees; Radians = atan2 (Y, X); Degrees = Rad2Deg (Radians); printf ("The angle having an absissa of %f\n", X); printf ("and an ordinate of %f\n", Y); printf ("is %f radians = %f degrees\n\n", Radians, Degrees); }

Output
The arc sine of -0.400000 is -0.411517 radians = -23.578178 degrees The arc cosine of -0.400000 is 1.982313 radians = 113.578178 degrees The arc tangent of -0.400000 is -0.380506 radians = -21.801409 degrees The arc sine of 0.640000 is 0.694498 radians = 39.791819 degrees The arc cosine of 0.640000 is 0.876298 radians = 50.208181 degrees The arc tangent of 0.640000 is 0.569313 radians = 32.619243 degrees The arc sine of 0.800000 is 0.927295 radians = 53.130102 degrees

The arc cosine of 0.800000 is 0.643501 radians = 36.869898 degrees The arc tangent of 0.800000 is 0.674741 radians = 38.659808 degrees The angle having an absissa of 2.000000 and an ordinate of 1.000000 is 0.463648 radians = 26.565051 degrees The angle having an absissa of -2.000000 and an ordinate of 1.000000 is 2.677945 radians = 153.434949 degrees The angle having an absissa of 2.000000 and an ordinate of -1.000000 is -0.463648 radians = -26.565051 degrees The angle having an absissa of -2.000000 and an ordinate of -1.000000 is -2.677945 radians = -153.434949 degrees

See Also
C Trigonometry C# Trigonometry FORTRAN Trigonometry Java Trigonometry Pascal Trigonometry PHP Trigonometry Trigonometry

C Now C# Now FORTRAN Now Java Now Pascal Now PHP Now Math Now eLook eLook eLook eLook

External Links
cos sin tan tan2

C Programming Reference C Programming Reference C Programming Reference C Programming Reference

Copyright 1999-2007, jhyoung, revised 5/2/2007

You might also like