◆ cbrt()

IEEEValue boost::simd::cbrt ( IEEEValue const &  x)

This function object returns the cubic root of its argument: \(\sqrt[3]{x}\).

Header <boost/simd/function/cbrt.hpp>
Decorators
  • std_ for floating entries calls std::cbrt
See also
pow, sqrt
Example:
#include <boost/simd/exponential.hpp>
#include <boost/simd/pack.hpp>
#include <iostream>
namespace bs = boost::simd;
using pack_ft = bs::pack<float, 4>;
int main() {
pack_ft pf = {1.0f, -2.0f, -8.0f, 0.5f};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> bs::cbrt(pf) = " << bs::cbrt(pf) << '\n';
float xf = 2.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> bs::cbrt(xf) = " << bs::cbrt(xf) << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (1, -2, -8, 0.5)
-> bs::cbrt(pf) = (1, -1.25992, -2, 0.793701)
---- scalar
<- xf = 2
-> bs::cbrt(xf) = 1.25992