32 #ifndef MCKL_MATH_ERF_HPP 33 #define MCKL_MATH_ERF_HPP 48 return -const_inf<T>();
51 return const_inf<T>();
54 constexpr T a =
static_cast<T
>(0.70771);
55 constexpr T b =
static_cast<T
>(2.30753);
56 constexpr T c =
static_cast<T
>(0.27061);
57 constexpr T d =
static_cast<T
>(0.99229);
58 constexpr T e =
static_cast<T
>(0.04481);
59 constexpr T f =
static_cast<T
>(1.12837916709551257);
61 T z = y < 1 ? y : 2 - y;
63 T x = -a * ((b + t * c) / (1 + t * (d + t * e)) - t);
64 for (
int i = 0; i != 2; ++i) {
66 x += err / (f *
std::exp(-(x * x)) - x * err);
69 return y < 1 ? x : -x;
77 return erfcinv<T>(1 - y);
82 #endif // MCKL_MATH_ERF_HPP T erfcinv(T y)
Inverse complement error function.
void log(std::size_t n, const float *a, float *y)
void sqrt(std::size_t n, const float *a, float *y)
void exp(std::size_t n, const float *a, float *y)
T erfinv(T y)
Inverse error function.
void erfc(std::size_t n, const float *a, float *y)