E.V.E
v2023.02.15

◆ nthroot

eve::nthroot = {}
inlineconstexpr

Callable object computing the nth root: \(x^{1/n}\).

Defined in Header

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
template< eve::floating_value T, eve::floating_value U >
T nthroot(T x, U y) noexcept;
}
constexpr callable_nthroot_ nthroot
Callable object computing the nth root: .
Definition: nthroot.hpp:57
Definition: abi.hpp:18

Parameters

Return value

Returns elementwise the value of \(x^{1/n}\). For negative x the value returned is a Nan as soon as n is not an odd integer.

The result type is of the compatibility type of the parameters.

Example

#include <eve/module/math.hpp>
#include <eve/wide.hpp>
#include <iostream>
#include <iomanip>
int main()
{
wide_ft pf = {2.0f, 64.0f, 4.0f, 2.0f, 2.0f,
wide_nt qn = {4, 3, 2, 1, 0, 4, 3, 2};
std::cout << "---- simd" << '\n'<< std::setprecision(20)
<< "<- pf = " << pf << '\n'
<< "<- qn = " << qn << '\n'
<< "-> nthroot(pf, qn) = " << eve::nthroot(pf, qn) << '\n'
<< "-> raw(nthroot)(pf, qn) = " << eve::raw(eve::nthroot)(pf, qn) << '\n';
double xf = 64.0f;
int n = 3;
std::cout << "---- scalar" << '\n' << std::setprecision(20)
<< "<- xf = " << xf << '\n'
<< "<- n = " << n << '\n'
<< "-> nthroot(xf, n) = " << eve::nthroot(xf, n) << '\n'
<< "-> raw(nthroot)(xf, n) = " << eve::raw(eve::nthroot)(xf, n) << '\n'
;
return 0;
}
constexpr callable_nan_ nan
Computes the IEEE NaN constant.
Definition: nan.hpp:53
constexpr callable_minf_ minf
Computes the -infinity ieee value.
Definition: minf.hpp:60
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