◆ expx2()

IEEEValue boost::simd::expx2 ( IEEEValue const &  x,
IEEEValue const &  s = 1 
)

This function object returns the exponential of the square of its argument or its inverse: \(e^{x^2}\) or \(e^{-x^2}\).

The sign chosen is -1 if and only if the sign bit of the second argument is not zero.

Header <boost/simd/function/expx2.hpp>
Note:
provisions are made for obtaining more accurate results for large x. The second argument s defaults to 1.
See also
exp
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::expx2(pf) = " << bs::expx2(pf) << '\n';
float xf = 2.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> bs::expx2(xf) = " << bs::expx2(xf) << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (1, 2, -1, 0.5)
-> bs::expx2(pf) = (2.71828, 54.5982, 2.71828, 1.28403)
---- scalar
<- xf = 2
-> bs::expx2(xf) = 54.5982