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

◆ nthroot

auto eve::nthroot = functor<nthroot_t>
inlineconstexpr

Header file

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto nthroot(floating_value auto x, value auto n) noexcept; noexcept; // 1
// Lanes masking
constexpr auto nthroot[conditional_expr auto c](/* any of the above overloads */) noexcept; // 2
constexpr auto nthroot[logical_value auto m](/* any of the above overloads */) noexcept; // 2
// Semantic options
constexpr auto nthroot[raw](/* any of the above overloads */) noexcept; // 3
}
Specifies that a type is a Conditional Expression.
Definition conditional.hpp:28
The concept floating_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition value.hpp:116
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition value.hpp:132
The concept value<T> is satisfied if and only if T satisfies either eve::scalar_value or eve::simd_va...
Definition value.hpp:34
constexpr auto nthroot
Callable object computing the nth root: .
Definition nthroot.hpp:79
EVE Main Namespace.
Definition abi.hpp:18

Parameters

Return value

  1. Returns the value of \(x^{1/n}\). For negative x the value returned is a Nan as soon as n is not an odd integer.
  2. The operation is performed conditionnaly
  3. Speedier but less accurate computation.

Example

// revision 1
#include <eve/module/math.hpp>
#include <iostream>
int main()
{
eve::wide wf = {2.0f, 64.0f, 4.0f, 2.0f, 2.0f,
eve::wide wn = {4, 3, 2, 1, 0, 4, 3, 2};
std::cout << "<- wf = " << wf << "\n";
std::cout << "<- wn = " << wn << "\n";
std::cout << "-> nthroot(wf, wn) = " << eve::nthroot(wf, wn) << "\n";
std::cout << "-> nthroot[ignore_last(2)](wf, wn)= " << eve::nthroot[eve::ignore_last(2)](wf, wn) << "\n";
std::cout << "-> nthroot[wf != 2.0f](wf, wn) = " << eve::nthroot[wf != 2.0f](wf, wn) << "\n";
std::cout << "-> nthroot[raw](wf, wn) = " << eve::nthroot[eve::raw](wf, wn) << "\n";
}
constexpr auto nan
Computes the IEEE quiet NaN constant.
Definition nan.hpp:67
constexpr auto eps
Computes a constant to the machine epsilon.
Definition eps.hpp:73
constexpr auto minf
Computes the -infinity ieee value.
Definition minf.hpp:66
Lightweight type-wrapper.
Definition as.hpp:29
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition conditional.hpp:332
Wrapper for SIMD registers.
Definition wide.hpp:70