E.V.E
v2023.02.15

◆ cbrt

eve::cbrt = {}
inlineconstexpr

Callable object computing the cubic root.

Defined in Header

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
template< eve::floating_value T >
T cbrt(T x) noexcept;
}
constexpr callable_cbrt_ cbrt
Callable object computing the cubic root.
Definition: cbrt.hpp:61
Definition: abi.hpp:18

Parameters

* `x` :  [real](@ref eve::value) argument.

Return value

Returns an elementwise cubic root value of the input.

Example

#include <eve/module/math.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft pf = {0.0f, 1.0f, -1.0f, -2.0f, 2.0f,
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> cbrt(pf) = " << eve::cbrt(pf) << '\n'
;
float xf = 1.0f;
float yf = eve::nan(eve::as<float>());
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> cbrt(xf) = " << eve::cbrt(xf) << '\n'
<< "<- yf = " << yf << '\n'
<< "-> cbrt(yf) = " << eve::cbrt(yf) << '\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 callable_inf_ inf
Computes the infinity ieee value.
Definition: inf.hpp:58
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65

Semantic Modifiers

  • Masked Call

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

    Example

    #include <eve/module/math.hpp>
    #include <eve/wide.hpp>
    #include <iostream>
    int main()
    {
    wide_ft pf = {0.0f, -0.0f, -1.0f, 1.0f, 2.0f,
    std::cout << "---- simd" << '\n'
    << "<- pf = " << pf << '\n'
    << "-> cbrt[pf > 1.0](pf) = " << eve::cbrt[pf > 1.0](pf) << '\n';
    return 0;
    }