E.V.E
v2022.03.00

◆ two_o_pi

eve::two_o_pi = {}
inlineconstexpr

Callable object computing the constant \(2/\pi\).

Defined in Header

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
template< eve::value T >
T two_o_pi(as<T> x) noexcept;
}
constexpr callable_two_o_pi_ two_o_pi
Callable object computing the constant .
Definition: two_o_pi.hpp:49
Definition: all_of.hpp:22
Lightweight type-wrapper.
Definition: as.hpp:29

Parameters

  • x : Type wrapper instance embedding the type of the constant.

Return value

The call eve::two_o_pi(as<T>()) returns \(2/\pi\).

Example

#include <eve/module/math.hpp>
#include <eve/wide.hpp>
#include <iostream>
#include <iomanip>
using wide_ft = eve::wide<float>;
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::setprecision(9) << std::endl
<< "-> two_o_pi(as<wide_ft>()) = " << eve::two_o_pi(eve::as<wide_ft>()) << std::endl
<< "-> two_o_pi(as(wxf)) = " << eve::two_o_pi(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> two_o_pi(as<float>()) = " << eve::two_o_pi(eve::as(float())) << std::endl
<< "-> two_o_pi(as<xf)) = " << eve::two_o_pi(eve::as(xf)) << std::endl;
return 0;
}
Wrapper for SIMD registers.
Definition: wide.hpp:65