E.V.E  0.1-beta

◆ atan2d

eve::atan2d = {}
inlineconstexpr

Callable object computing the atan2d operation.

Required header: #include <eve/function/atan2d.hpp>

Members Functions

Member Effect
operator() the atan2d operation

template< value T, value U > auto operator()( T x, U y ) const noexcept
requires compatible< T,U>;

Parameters

x, y: floating real values

Return value

the arc tangent of \(\frac{y}x\) in the range [-180 , +180] radians, is returned. The IEEE limiting values are almost all satisfied :

 -  If `x` and `y` are both zero or infinites, Nan is returned (this is not standard conforming)
 -  If `y` is \f$\pm0\f$ and `x` is strictly negative or \f$-0\f$, \f$\pm180\f$ is returned
 -  If `y` is \f$\pm0\f$ and `x` is strictly positive or \f$+0\f$, \f$\pm0\f$ is returned
 -  If `y` is \f$\pm\inft`y`\f$ and `x` is finite, \f$\pm90\f$ is returned
 -  If `x` is \f$\pm0\f$ and `y` is strictly negative, \f$-90\f$ is returned
 -  If `x` is \f$\pm0\f$ and `y` is strictly positive, \f$+90\f$  is returned
 -  If `x` is \f$-\inft`y`\f$ and `y` is finite and positive, \f$+180\f$ is returned
 -  If `x` is \f$-\inft`y`\f$ and `y` is finite and negative, \f$-180\f$ is returned
 -  If `x` is \f$+\inft`y`\f$ and `y` is finite and positive, \f$+0\f$ is returned
 -  If `x` is \f$+\inft`y`\f$ and `y` is finite and negative, \f$-0\f$ is returned
 -  If either `x` is Nan or `y` is Nan, Nan is returned

 The call will return a NaN if `x` and `y` are both either null or infinite: this result is not **IEEE** conform,
 but not more absurd than the IEEE choices and allows to simplify (and speed) the implementation.
 In all other cases, the result is standard conformant.

The result type is the common compatible type of the two parameters.


Supported decorators

  • eve::pedantic

    Required header: #include <eve/function/pedantic/atan2d.hpp>

    The call pedantic(atan2d)(x,y) returns the same results as the regular call, but all IEEE limiting values are satisfied :

    • If y is \(\pm\infty\) and x is \(-\inft`y`\), \(\pm135\) is returned
    • If y is \(\pm\infty\) and x is \(+\infty\), \(\pm45\) is returned
    • If x is \(\pm0\) and y is \(\pm-0\), \(-90\) is returned
    • If x is \(\pm0\) and y is \(\pm+0\), \(+90\) is returned
  • eve::diff, eve::diff_1st, eve::diff_2nd, eve::diff_nth

    Required header: #include <eve/function/diff/atan2d.hpp>

    The expression diff_1st(atan2d)(x,y) and diff_2nd(atan2d)(x,y) computes the partial derivatives of \(f\), where \(f\) is the function \((x,y) \rightarrow \ \mbox{atan2d}(x,y)\).

Example

See it live on Compiler Explorer

#include <eve/function/atan2d.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft pf = { 0.0f, 1.0f, 4.0f, -2.0f };
wide_ft qf = { 1.0f, -1.0f, 3.0f, -0.0f};
std::cout
<< "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "<- qf = " << qf << '\n'
<< "-> atan2d(pf, qf) = " << eve::atan2d(pf, qf) << '\n';
float xf = 2.0f;
float yf = 10.0f;
std::cout
<< "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> atan2d(xf, yf) = " << eve::atan2d(xf, yf) << '\n';
return 0;
}
constexpr callable_atan2d_ atan2d
Callable object computing the atan2d operation.
Definition: atan2d.hpp:96
Wrapper for SIMD registers.
Definition: wide.hpp:65