◆ exp2()

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

This function object returns the base two exponential of its argument: \(2^{x}\).

Header <boost/simd/function/exp2.hpp>
Note:
  • provisions are made to obtain a flint result from a flint argument
Decorators
  • std_ for floating entries calls std::exp2
See also
exp, exp10, pow, pow2
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, -1.0f, 0.5f};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> bs::exp2(pf) = " << bs::exp2(pf) << '\n';
float xf = 2.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> bs::exp2(xf) = " << bs::exp2(xf) << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (1, 2, -1, 0.5)
-> bs::exp2(pf) = (2, 4, 0.5, 1.41421)
---- scalar
<- xf = 2
-> bs::exp2(xf) = 4