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|}1 - \frac{\left(0.254829592 + \frac{\sqrt{1.421413741}}{1 + 0.3275911 \cdot \left|x\right|} \cdot \frac{\sqrt{1.421413741}}{1 + 0.3275911 \cdot \left|x\right|}\right) + \left(\frac{1.061405429}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{4}} - \left(\frac{1.453152027}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{3}} + \frac{0.284496736}{1 + 0.3275911 \cdot \left|x\right|}\right)\right)}{\left(1 + 0.3275911 \cdot \left|x\right|\right) \cdot e^{x \cdot x}}(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
(-
1.0
(/
(+
(+
0.254829592
(*
(/ (sqrt 1.421413741) (+ 1.0 (* 0.3275911 (fabs x))))
(/ (sqrt 1.421413741) (+ 1.0 (* 0.3275911 (fabs x))))))
(-
(/ 1.061405429 (pow (+ 1.0 (* 0.3275911 (fabs x))) 4.0))
(+
(/ 1.453152027 (pow (+ 1.0 (* 0.3275911 (fabs x))) 3.0))
(/ 0.284496736 (+ 1.0 (* 0.3275911 (fabs x)))))))
(* (+ 1.0 (* 0.3275911 (fabs x))) (exp (* x x))))))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 1.0 - (((0.254829592 + ((sqrt(1.421413741) / (1.0 + (0.3275911 * fabs(x)))) * (sqrt(1.421413741) / (1.0 + (0.3275911 * fabs(x)))))) + ((1.061405429 / pow((1.0 + (0.3275911 * fabs(x))), 4.0)) - ((1.453152027 / pow((1.0 + (0.3275911 * fabs(x))), 3.0)) + (0.284496736 / (1.0 + (0.3275911 * fabs(x))))))) / ((1.0 + (0.3275911 * fabs(x))) * exp(x * x)));
}



Bits error versus x
Results
Initial program 13.9
Simplified13.9
Taylor expanded around 0 14.6
Simplified13.9
rmApplied add-sqr-sqrt_binary64_248713.9
Applied unpow-prod-down_binary64_254413.9
Applied add-sqr-sqrt_binary64_248713.9
Applied times-frac_binary64_247113.9
Simplified13.9
Simplified13.9
Final simplification13.9
herbie shell --seed 2020339
(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)))))))