C++ cmath acos() function
Example
Return the arccosine of different numbers:
cout << acos(0.64);
cout << acos(-0.4);
cout << acos(0);
cout << acos(1);
cout << acos(-1);
cout << acos(2);
Try it Yourself »
Definition and Usage
The acos()
function returns the arccosine of a number in radians.
The acos()
function is defined in the <cmath>
header file.
Syntax
One of the following:
acos(double number);
acos(float number);
Parameter Values
Parameter | Description |
---|---|
number |
Required. A number to find the arccosine of, in the range -1 to 1. If the value is outside -1 to 1, it returns NaN (Not a Number). If the number is an integer type then it will be treated as a double .
|
Technical Details
Returns: | A float value (if the argument is float) or double value (in any other case) representing the arccosine of a number in radians. |
---|