◆ pow()

IEEEValue boost::simd::pow ( IEEEValue const &  x,
Value const &  y 
)

This function object computes \(x^y\).

Header <boost/simd/function/pow.hpp>
Decorators
  • std_ decorator calls std:pow
  • raw_ decorator almost nearly uses the naive formula ( \(e^{y\log x}\)) and so does not care for limits and leads to lower accuracy
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 = {3.0f, -2.0f, -3.0f, 5.0f};
pack_ft qf = {4.0f, -1.0f, -3.0f, 0.0f};
std::cout << "---- simd" << '\n'
<< " <- pf = " << pf << '\n'
<< " <- qf = " << qf << '\n'
<< " -> bs::pow(pf, qf) = " << bs::pow(pf, qf) << '\n';
float xf = 3.0f, yf = 4.0f;
std::cout << "---- scalar" << '\n'
<< " xf = " << xf << '\n'
<< " yf = " << yf << '\n'
<< " -> bs::pow(xf, yf) = " << bs::pow(xf, yf) << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (3, -2, -3, 5)
<- qf = (4, -1, -3, 0)
-> bs::pow(pf, qf) = (81, -0.5, -0.037037, 1)
---- scalar
xf = 3
yf = 4
-> bs::pow(xf, yf) = 81