CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
approx_erf.h
Go to the documentation of this file.
1 #ifndef APPROX_ERF_H
2 #define APPROX_ERF_H
4 
5 inline
6 float approx_erf(float x) {
7  auto xx = std::min(std::abs(x),5.f);
8  xx*=xx;
9  return std::copysign(std::sqrt(1.f- unsafe_expf<4>(-xx*(1.f+0.2733f/(1.f+0.147f*xx)) )),x);
10  // return std::sqrt(1.f- std::exp(-x*x*(1.f+0.2733f/(1.f+0.147f*x*x)) ));
11 }
12 
13 
14 #endif
float approx_erf(float x)
Definition: approx_erf.h:6
T x() const
Cartesian x coordinate.
T sqrt(T t)
Definition: SSEVec.h:18
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
T min(T a, T b)
Definition: MathUtil.h:58