E.V.E  0.1-beta

◆ invsqrt_2

eve::invsqrt_2 = {}
inlineconstexpr

Callable object computing \(2^{-1/2}\).

Required header: #include <eve/function/invsqrt_2.hpp>

Member Effect
operator() Computes the invsqrt_2 constant

tempate < floating_value T > T operator()( as<T> const & t) const noexcept;
Lightweight type-wrapper.
Definition: as.hpp:29

Parameters

t: Type wrapper instance embedding the type of the constant.

Return value

the call eve::invsqrt_2(as<T>()) is semantically equivalent to eve::sqrt(T(2))/2.


Example

See it live on Compiler Explorer

#include <eve/constant/invsqrt_2.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::endl
<< "-> invsqrt_2(as<wide_ft>()) = " << eve::invsqrt_2(eve::as<wide_ft>()) << std::endl
<< "-> invsqrt_2(as(wxf)) = " << eve::invsqrt_2(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> invsqrt_2(as<float>()) = " << eve::invsqrt_2(eve::as(float())) << std::endl
<< "-> invsqrt_2(as<xf)) = " << eve::invsqrt_2(eve::as(xf)) << std::endl;
return 0;
}
constexpr callable_invsqrt_2_ invsqrt_2
Callable object computing .
Definition: invsqrt_2.hpp:54
Wrapper for SIMD registers.
Definition: wide.hpp:65