◆ erf()

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

This function object computes the error function: \(\displaystyle \frac{2}{\sqrt\pi}\int_0^{x} e^{-t^2}\mbox{d}t\).

Header <boost/simd/function/erf.hpp>
Decorators
  • std_ calls std::erf
See also
erfc, erfcx
Example:
#include <boost/simd/eulerian.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::erf(pf) = " << bs::erf(pf) << '\n';
float xf = 2.0f;
std::cout
<< "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> bs::erf(xf) = " << bs::erf(xf) << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (1, 2, -1, 0.5)
-> bs::erf(pf) = (0.842701, 0.995322, -0.842701, 0.5205)
---- scalar
<- xf = 2
-> bs::erf(xf) = 0.995322