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|}e^{\log \log \left(e^{\left(1 + \frac{e^{-x \cdot x}}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{2}} \cdot \left(0.284496736 + \frac{1.453152027}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{2}}\right)\right) - \left(\frac{1.061405429}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{5} \cdot e^{x \cdot x}} + \frac{e^{-x \cdot x}}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(0.254829592 + \frac{1.421413741}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{2}}\right)\right)}\right)}(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
(exp
(log
(log
(exp
(-
(+
1.0
(*
(/ (exp (- (* x x))) (pow (+ 1.0 (* 0.3275911 (fabs x))) 2.0))
(+
0.284496736
(/ 1.453152027 (pow (+ 1.0 (* 0.3275911 (fabs x))) 2.0)))))
(+
(/
1.061405429
(* (pow (+ 1.0 (* 0.3275911 (fabs x))) 5.0) (exp (* x x))))
(*
(/ (exp (- (* x x))) (+ 1.0 (* 0.3275911 (fabs x))))
(+
0.254829592
(/ 1.421413741 (pow (+ 1.0 (* 0.3275911 (fabs x))) 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) {
return exp(log(log(exp((1.0 + ((exp(-(x * x)) / pow((1.0 + (0.3275911 * fabs(x))), 2.0)) * (0.284496736 + (1.453152027 / pow((1.0 + (0.3275911 * fabs(x))), 2.0))))) - ((1.061405429 / (pow((1.0 + (0.3275911 * fabs(x))), 5.0) * exp(x * x))) + ((exp(-(x * x)) / (1.0 + (0.3275911 * fabs(x)))) * (0.254829592 + (1.421413741 / pow((1.0 + (0.3275911 * fabs(x))), 2.0)))))))));
}



Bits error versus x
Results
Initial program 13.7
Taylor expanded around 0 13.7
Simplified13.7
rmApplied add-exp-log_binary6413.7
Simplified13.7
rmApplied add-log-exp_binary6413.6
Final simplification13.6
herbie shell --seed 2021147
(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)))))))