E.V.E
v2023.02.15
Loading...
Searching...
No Matches
◆
nthroot
auto eve::nthroot =
functor
<nthroot_t>
inline
constexpr
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
}
eve::conditional_expr
Specifies that a type is a Conditional Expression.
Definition
conditional.hpp:28
eve::floating_value
The concept floating_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition
value.hpp:116
eve::logical_value
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition
value.hpp:134
eve::value
The concept value<T> is satisfied if and only if T satisfies either eve::scalar_value or eve::simd_va...
Definition
value.hpp:34
eve::nthroot
constexpr auto nthroot
Callable object computing the nth root: .
Definition
nthroot.hpp:79
eve
EVE Main Namespace.
Definition
abi.hpp:19
Parameters
x
:
floating value
.
n
:
integral_value
. Actually
n
can be a
flint
.
c
:
Conditional expression
masking the operation.
m
:
Logical value
masking the operation.
Return value
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.
The operation is performed conditionnaly
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::minf(
eve::as<float>
()),
eve::eps
(
eve::as<float>
()),
eve::nan
(
eve::as<float>
())};
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"
;
}
eve::nan
constexpr auto nan
Computes the IEEE quiet NaN constant.
Definition
nan.hpp:67
eve::eps
constexpr auto eps
Computes a constant to the machine epsilon.
Definition
eps.hpp:74
eve::as
Lightweight type-wrapper.
Definition
as.hpp:29
eve::ignore_last
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition
conditional.hpp:353
eve::wide
Wrapper for SIMD registers.
Definition
wide.hpp:94
eve