◆ exprecnegc()

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

This function object computes: \(1-e^{-\frac1x}\).

Header <boost/simd/function/exprecnegc.hpp>
Notes
  • result is accurate even for large x
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.0e-20f, 0.5f};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> bs::exprecnegc(pf) = " << bs::exprecnegc(pf) << '\n';
float xf = 2.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> bs::exprecnegc(xf) = " << bs::exprecnegc(xf) << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (1, 2, 1e-20, 0.5)
-> bs::exprecnegc(pf) = (0.632121, 0.393469, 1, 0.864665)
---- scalar
<- xf = 2
-> bs::exprecnegc(xf) = 0.393469