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

◆ rsqrt_pio_2

eve::rsqrt_pio_2 = functor<rsqrt_pio_2_t>
inlineconstexpr

Defined in Header

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
template< eve::floating_value T >
T rsqrt_pio_2(as<T> x) noexcept;
}
constexpr auto rsqrt_pio_2
Callable object computing the constant .
Definition: rsqrt_pio_2.hpp:77
EVE Main Namespace.
Definition: abi.hpp:18
Lightweight type-wrapper.
Definition: as.hpp:29

Parameters

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

Return value

The call eve::rsqrt_pio_2(as<T>()) returns the inverse of \(\sqrt{\pi/2}\).

Example

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