◆ atan2
Callable object computing the atan2 operation. Required header: Members Functions
template< value T, value U > auto operator()( T x, U y ) const noexcept
requires compatible< T,U>;
Parameters
Return value the arc tangent of \(\frac{y}x\) in the range \([-\pi , +\pi]\) 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$\pm\pi\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$\pm\frac\pi2\f$ is returned - If `x` is \f$\pm0\f$ and `y` is strictly negative, \f$-\frac\pi2\f$ is returned - If `x` is \f$\pm0\f$ and `y` is strictly positive, \f$+\frac\pi2\f$ is returned - If `x` is \f$-\inft`y`\f$ and `y` is finite and positive, \f$+\pi\f$ is returned - If `x` is \f$-\inft`y`\f$ and `y` is finite and negative, \f$-\pi\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
ExampleSee it live on Compiler Explorer #include <eve/function/atan2.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide <float, eve::fixed<4>>;
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'
float xf = 2.0f;
float yf = 10.0f;
std::cout
<< "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
return 0;
}
constexpr callable_atan2_ atan2 Callable object computing the atan2 operation. Definition: atan2.hpp:96 |