Namespaces
Variants
Views
Actions

atan2, atan2f, atan2l

From cppreference.com
< c‎ | numeric‎ | math
 
 
 
Common mathematical functions
Functions
Basic operations
(C99)
(C99)
(C99)
(C99)(C99)(C99)(C23)
Maximum/minimum operations
(C99)
(C99)
Exponential functions
(C23)
(C99)
(C99)
(C23)
(C23)

(C99)
(C99)(C23)
(C23)
(C23)
Power functions
(C99)
(C23)
(C23)

(C99)
(C23)
(C23)
Trigonometric and hyperbolic functions
atan2
(C23)
(C23)
(C23)
(C23)
(C23)
(C23)
(C23)
(C99)
(C99)
(C99)
Nearest integer floating-point
(C99)(C99)(C99)
(C99)

(C99)(C99)(C99)
(C23)(C23)(C23)(C23)
Floating-point manipulation
(C99)(C99)
(C99)(C23)
(C99)
Narrowing operations
(C23)
(C23)
(C23)
(C23)
(C23)
(C23)
Quantum and quantum exponent
Decimal re-encoding functions
Total order and payload functions
Classification
(C99)
(C99)
(C99)
(C23)
Error and gamma functions
(C99)
(C99)
(C99)
(C99)
Types
Macro constants
Special floating-point values
(C99)(C23)
Arguments and return values
Error handling
Fast operation indicators
 
Defined in header <math.h>
float       atan2f( float y, float x );
(1) (since C99)
double      atan2( double y, double x );
(2)
long double atan2l( long double y, long double x );
(3) (since C99)
_Decimal32  atan2d32( _Decimal32 y, _Decimal32 x );
(4) (since C23)
_Decimal64  atan2d64( _Decimal64 y, _Decimal64 x );
(5) (since C23)
_Decimal128 atan2d128( _Decimal128 y, _Decimal128 x );
(6) (since C23)
Defined in header <tgmath.h>
#define atan2( y, x )
(7) (since C99)
1-6) Computes the arc tangent of y / x using the signs of arguments to determine the correct quadrant.
7) Type-generic macro: If any argument has type long double, (3) (atan2l) is called. Otherwise, if any argument has integer type or has type double, (2) (atan2) is called. Otherwise, (1) (atan2f) is called.

The functions (4-6) are declared if and only if the implementation predefines __STDC_IEC_60559_DFP__ (i.e. the implementation supports decimal floating-point numbers).

(since C23)

Contents

[edit] Parameters

x, y - floating-point value

[edit] Return value

If no errors occur, the arc tangent of y / x (arctan(
y
x
)
) in the range [-π ; +π] radians, is returned.
Y argument
Return value