E.V.E
v2023.02.15
 
Loading...
Searching...
No Matches

◆ atan2

auto eve::atan2 = functor<atan2_t>
inlineconstexpr

Header file

#include <eve/module/core.hpp>

Callable Signatures

Header file

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto atan2(floating_value auto x, floating_value auto y) noexcept; // 1
// Semantic option
constexpr auto atan2[pedantic](floating_value auto x, floating_value auto y) noexcept; // 2
// Lanes masking
constexpr auto atan2[conditional_expr auto c][floating_value auto x, floating_value auto y) noexcept; // 3
constexpr auto atan2[logical_value auto m](floating_value auto x, floating_value auto y) noexcept; // 3
}
Specifies that a type is a Conditional Expression.
Definition conditional.hpp:28
The concept floating_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition value.hpp:116
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition value.hpp:132
constexpr auto atan2
elementwise_callable object computing the arc tangent using the signs of the arguments to determine t...
Definition atan2.hpp:109
EVE Main Namespace.
Definition abi.hpp:18

Parameters

Return value

  1. 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 \(\pm0\) and x is strictly negative or \(-0\), \(\pm\pi\) is returned
    • If y is \(\pm0\) and x is strictly positive or \(+0\), \(\pm0\) is returned
    • If y is \(\pm\infty\) and x is finite, \(\pm\frac\pi2\) is returned
    • If x is \(\pm0\) and y is strictly negative, \(-\frac\pi2\) is returned
    • If x is \(\pm0\) and y is strictly positive, \(+\frac\pi2\) is returned
    • If x is \(-\infty\) and y is finite and positive, \(+\pi\) is returned
    • If x is \(-\infty\) and y is finite and negative, \(-\pi\) is returned
    • If x is \(+\infty\) and y is finite and positive, \(+0\) is returned
    • If x is \(+\infty\) and y is finite and negative, \(-0\) 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 conformant, but allows to simplify (and speed) the implementation. In all other cases, the result is standard conformant.

  1. Same as 1, except that all IEEE limiting values are satisfied :
    • If y is \(\pm\infty\) and x is \(-\infty\), \(\pm\frac{3\pi}4\) is returned
    • If y is \(\pm\infty\) and x is \(+\infty\), \(\pm\frac{\pi}4\) is returned
    • If x is \(\pm0\) and y is \(\pm-0\), \(-\frac\pi2\) is returned
    • If x is \(\pm0\) and y is \(\pm+0\), \(+\frac\pi2\) is returned
  2. The operation is performed conditionnaly.

External references

Example

// revision 1
#include <eve/module/math.hpp>
#include <iostream>
int main()
{
eve::wide pf = { 0.0f, 1.0f, 4.0f, -2.0f, eve::inf(eve::as<float>()), 0.0f, eve::minf(eve::as<float>()), 1.0f};
eve::wide qf = { 1.0f, -1.0f, 3.0f, -0.0f, 1.0f, 0.0f, 0.0f, -0.0f};
std::cout << "<- pf = " << pf << "\n";
std::cout << "<- qf = " << qf << "\n";
std::cout << "-> atan2(pf, qf) = " << eve::atan2(pf, qf) << "\n";
std::cout << "-> atan2[pedantic](pf, qf) = " << eve::atan2[eve::pedantic](pf, qf) << "\n";
std::cout << "-> atan2[ignore_last(2)](pf, qf)= " << eve::atan2[eve::ignore_last(2)](pf, qf) << "\n";
std::cout << "-> atan2[pf != -2.0f](pf, qf) = " << eve::atan2[pf != -2.0f](pf, qf) << "\n";
}
constexpr auto inf
Computes the infinity ieee value.
Definition inf.hpp:66
constexpr auto minf
Computes the -infinity ieee value.
Definition minf.hpp:66
Lightweight type-wrapper.
Definition as.hpp:29
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition conditional.hpp:332
Wrapper for SIMD registers.
Definition wide.hpp:70