C++ cmath atan() function
Example
Return the arctangent of different numbers:
cout << atan(0.5);
cout << atan(-0.5);
cout << atan(5);
cout << atan(-5);
cout << atan(100);
cout << atan(-100);
Try it Yourself »
Definition and Usage
The atan()
function returns the arctangent of a number in radians.
The atan()
function is defined in the <cmath>
header file.
Tip: The atan() function only returns angles between -PI/2 and PI/2. The atan2() function can return any angle.
Syntax
One of the following:
atan(double number);
atan(float number);
Parameter Values
Parameter | Description |
---|---|
number | Required. Specifies 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 arctangent of a number. |
---|