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

◆ sqrt

eve::sqrt = {}
inlineconstexpr

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::floating_value T >
T sqrt(T x) noexcept;
}
constexpr callable_sqrt_ sqrt
Computes the square root of the parameter.
Definition: sqrt.hpp:74
EVE Main Namespace.
Definition: abi.hpp:18

Parameters

  • x : real argument.

Return value

  • value containing the elementwise square root of x or Nan if x is less than zero.

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft pf = {1.0f, 2.0f, -3.0f, eve::inf(eve::as<float>())};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> sqrt(pf) = " << eve::sqrt(pf) << '\n'
<< "-> raw(sqrt)(pf) = " << eve::raw(eve::sqrt)(pf) << '\n'
<< "-> sqrt[pf > 0](pf)= " << eve::sqrt[pf > 0](pf) << '\n';
float xf = 32.768f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> sqrt(xf) = " << eve::sqrt(xf) << '\n';
return 0;
}
constexpr auto inf
Computes the infinity ieee value.
Definition: inf.hpp:70
constexpr raw_type const raw
Higher-order Callable Object imbuing quick and dirty behaviour onto other Callable Objects.
Definition: raw.hpp:43
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65

Semantic Modifiers

  • Masked Call

    The call eve;sqrt[mask](x) provides a masked version of eve::sqrt which is equivalent to if_else (mask, sqrt(x), x).

  • eve::raw

    The call raw(sqrt)(x), call a proper system intrinsic if one exists, but with possibly very poor accuracy in return. Otherwise it uses the non-decorated call.