1 - \left(\frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(0.254829592 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-0.284496736 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(1.421413741 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-1.453152027 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}
\begin{array}{l}
t_0 := \mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)\\
t_1 := e^{-x \cdot x}\\
t_2 := t_1 \cdot \frac{0.254829592 + \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t_0}}{t_0}}{t_0}}{t_0}}{t_0}\\
\frac{\log \left(1 + \mathsf{expm1}\left(1 - {\left(\frac{0.254829592 + \frac{-0.284496736 + \frac{1.421413741 + \frac{\mathsf{fma}\left(1.061405429, \frac{1}{t_0}, -1.453152027\right)}{t_0}}{t_0}}{t_0}}{t_0} \cdot t_1\right)}^{3}\right)\right)}{1 + \left(t_2 + {t_2}^{2}\right)}
\end{array}
(FPCore (x)
:precision binary64
(-
1.0
(*
(*
(/ 1.0 (+ 1.0 (* 0.3275911 (fabs x))))
(+
0.254829592
(*
(/ 1.0 (+ 1.0 (* 0.3275911 (fabs x))))
(+
-0.284496736
(*
(/ 1.0 (+ 1.0 (* 0.3275911 (fabs x))))
(+
1.421413741
(*
(/ 1.0 (+ 1.0 (* 0.3275911 (fabs x))))
(+
-1.453152027
(* (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x)))) 1.061405429)))))))))
(exp (- (* (fabs x) (fabs x)))))))(FPCore (x)
:precision binary64
(let* ((t_0 (fma 0.3275911 (fabs x) 1.0))
(t_1 (exp (- (* x x))))
(t_2
(*
t_1
(/
(+
0.254829592
(/
(+
-0.284496736
(/
(+ 1.421413741 (/ (+ -1.453152027 (/ 1.061405429 t_0)) t_0))
t_0))
t_0))
t_0))))
(/
(log
(+
1.0
(expm1
(-
1.0
(pow
(*
(/
(+
0.254829592
(/
(+
-0.284496736
(/
(+
1.421413741
(/ (fma 1.061405429 (/ 1.0 t_0) -1.453152027) t_0))
t_0))
t_0))
t_0)
t_1)
3.0)))))
(+ 1.0 (+ t_2 (pow t_2 2.0))))))double code(double x) {
return 1.0 - (((1.0 / (1.0 + (0.3275911 * fabs(x)))) * (0.254829592 + ((1.0 / (1.0 + (0.3275911 * fabs(x)))) * (-0.284496736 + ((1.0 / (1.0 + (0.3275911 * fabs(x)))) * (1.421413741 + ((1.0 / (1.0 + (0.3275911 * fabs(x)))) * (-1.453152027 + ((1.0 / (1.0 + (0.3275911 * fabs(x)))) * 1.061405429))))))))) * exp(-(fabs(x) * fabs(x))));
}
double code(double x) {
double t_0 = fma(0.3275911, fabs(x), 1.0);
double t_1 = exp(-(x * x));
double t_2 = t_1 * ((0.254829592 + ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0)) / t_0);
return log((1.0 + expm1((1.0 - pow((((0.254829592 + ((-0.284496736 + ((1.421413741 + (fma(1.061405429, (1.0 / t_0), -1.453152027) / t_0)) / t_0)) / t_0)) / t_0) * t_1), 3.0))))) / (1.0 + (t_2 + pow(t_2, 2.0)));
}



Bits error versus x
Initial program 13.5
Applied egg-rr13.4
Applied egg-rr12.6
Applied egg-rr12.6
Final simplification12.6
herbie shell --seed 2022130
(FPCore (x)
:name "Jmat.Real.erf"
:precision binary64
(- 1.0 (* (* (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x)))) (+ 0.254829592 (* (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x)))) (+ -0.284496736 (* (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x)))) (+ 1.421413741 (* (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x)))) (+ -1.453152027 (* (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x)))) 1.061405429))))))))) (exp (- (* (fabs x) (fabs x)))))))