◆ tenpower()

Value boost::simd::tenpower ( IntegerValue const &  n)

Function object implementing tenpower capabilities.

Returns \(10^n\) in the floating type associated to the integral type of parameter n

Header <boost/simd/function/tenpower.hpp>
semantic:
For any given value n of integral type I
as_floating_t<I> r = tenpower(n);

code is similar to:

auto r = exp10(as_floating_t<I>(n));
Note:

This function is not defined for floating entries and intended to be used for small integer values.

See also
exp10
Example:
#include <boost/simd/arithmetic.hpp>
#include <boost/simd/pack.hpp>
#include <iostream>
namespace bs = boost::simd;
using pack_ft = bs::pack <float, 4>;
using pack_it = bs::pack <std::int32_t,4>;
int main()
{
pack_it pi = {-1, 2, -3, 4 };
std::cout
<< "---- simd" << '\n'
<< "<- pi = " << pi << '\n'
<< "-> bs::tenpower(pi) = " << bs::tenpower(pi) << '\n';
std::int32_t xi = 4;
std::cout
<< "---- scalar" << '\n'
<< "<- xi = " << xi << '\n'
<< "-> bs::tenpower(xi) = " << bs::tenpower(xi) << '\n';
return 0;
}
Possible output:
---- simd
<- pi = (-1, 2, -3, 4)
-> bs::tenpower(pi) = (0.1, 100, 0.001, 10000)
---- scalar
<- xi = 4
-> bs::tenpower(xi) = 10000