| << Prev | Beej's Guide to C | Next >> |
Calculate the arc cosine of a number.
#include <math.h> double acos(double x); float acosf(float x); long double acosl(long double x);
Calculates the arc cosine of a number in radians. (That is, the value whose cosine is x.) The number must be in the range -1.0 to 1.0.
For those of you who don't remember, radians are another way of measuring an angle, just like degrees. To convert from degrees to radians or the other way around, use the following code:
degrees = radians * 180.0f / M_PI; radians = degrees * M_PI / 180;
Returns the arc cosine of x, unless x is out of range. In that case, errno will be set to EDOM and the return value will be NaN. The variants return different types.
double acosx; long double ldacosx; acosx = acos(0.2); ldacosx = acosl((long double)0.3);
asin(), atan(), atan2(), cos()
| << Prev | Beej's Guide to C | Next >> |