C Language: acos function
(Arc Cosine)
In the C Programming Language, the acos function returns the arc cosine of x.
Syntax
The syntax for the acos function in the C Language is:
double acos(double x);
Parameters or Arguments
- x
- A value between -1 and 1. A domain error will occur if x is not between -1 and 1.
Returns
The acos function returns the arc cosine of a number represented by x. It will return a value between 0 and π.
Required Header
In the C Language, the required header for the acos function is:
#include <math.h>
Applies To
In the C Language, the acos function can be used in the following versions:
- ANSI/ISO 9899-1990
acos Example
/* Example using acos by TechOnTheNet.com */ #include <stdio.h> #include <math.h> int main(int argc, const char * argv[]) { /* Define temporary variables */ double value; double result; /* Assign the value we will find the acos of */ value = 0.5; /* Calculate the Arc Cosine of value */ result = acos(value); /* Display the result of the calculation */ printf("The Arc Cosine of %f is %f\n", value, result); return 0; }
When compiled and run, this application will output:
The Arc Cosine of 0.500000 is 1.047198
Similar Functions
Other C functions that are similar to the acos function:
Advertisements