Namespaces
Variants
Actions

std::atan2, std::atan2f, std::atan2l

From cppreference.com
< cpp‎ | numeric‎ | math
 
 
 
 
Defined in header <cmath>
(1)
float       atan2 ( float y, float x );

double      atan2 ( double y, double x );

long double atan2 ( long double y, long double x );
(until C++23)
/*floating-point-type*/

            atan2 ( /*floating-point-type*/ y,

                    /*floating-point-type*/ x );
(since C++23)
(constexpr since C++26)
float       atan2f( float y, float x );
(2) (since C++11)
(constexpr since C++26)
long double atan2l( long double y, long double x );
(3) (since C++11)
(constexpr since C++26)
SIMD overload (since C++26)
Defined in header <simd>
template< class V0, class V1 >

constexpr /*math-common-simd-t*/<V0, V1>

            atan2 ( const V0& v_y, const V1& v_x );
(S) (since C++26)
Additional overloads (since C++11)
Defined in header <cmath>
template< class Integer >
double      atan2 ( Integer y, Integer x );
(A) (constexpr since C++26)
1-3) Computes the arc tangent of y / x using the signs of arguments to determine the correct quadrant. The library provides overloads of std::atan2 for all cv-unqualified floating-point types as the type of the parameters.(since C++23)
S) The SIMD overload performs an element-wise std::atan2 on v_yand v_x.
(See math-common-simd-t for its definition.)
(since C++26)
A) Additional overloads are provided for all integer types, which are treated as double.
(since C++11)

Contents

[edit] Parameters

y, x - floating-point or integer values

[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