E.V.E
v2022.09.01

◆ inv_pi

eve::inv_pi = {}
inlineconstexpr

Callable object computing the constant \(\frac{1}{\pi}\).

Defined in Header

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
template< eve::value T >
T inv_pi(as<T> x) noexcept;
}
constexpr callable_inv_pi_ inv_pi
Callable object computing the constant .
Definition: inv_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::inv_pi(as<T>()) returns the inverse of \(\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
<< "-> inv_pi(as<wide_ft>()) = " << eve::inv_pi(eve::as<wide_ft>()) << std::endl
<< "-> inv_pi(as(wxf)) = " << eve::inv_pi(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> inv_pi(as<float>()) = " << eve::inv_pi(eve::as(float())) << std::endl
<< "-> inv_pi(as<xf)) = " << eve::inv_pi(eve::as(xf)) << std::endl;
return 0;
}
Wrapper for SIMD registers.
Definition: wide.hpp:65