1 - \left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|} \cdot \left(0.25482959199999999 + \frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|} \cdot \left(-0.284496735999999972 + \frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|} \cdot \left(1.42141374100000006 + \frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|} \cdot \left(-1.45315202700000001 + \frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|} \cdot 1.0614054289999999\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}\frac{{\left(\frac{1}{e^{{\left(\left|x\right|\right)}^{2}}} \cdot \left(\frac{0.284496735999999972}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{2}} - \frac{1.42141374100000006}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{3}}\right) - \frac{1}{e^{{\left(\left|x\right|\right)}^{2}}} \cdot \left(\frac{1.0614054289999999}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{5}} + \frac{0.25482959199999999}{\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)}\right)\right)}^{3} + {\left(\mathsf{fma}\left(1.45315202700000001, \frac{\frac{1}{e^{{\left(\left|x\right|\right)}^{2}}}}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{4}}, 1\right)\right)}^{3}}{\left(\frac{1}{e^{{\left(\left|x\right|\right)}^{2}}} \cdot \left(\frac{0.284496735999999972}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{2}} - \frac{1.42141374100000006}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{3}}\right) - \frac{1}{e^{{\left(\left|x\right|\right)}^{2}}} \cdot \left(\frac{1.0614054289999999}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{5}} + \frac{0.25482959199999999}{\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)}\right)\right) \cdot \left(\frac{1}{e^{{\left(\left|x\right|\right)}^{2}}} \cdot \left(\frac{0.284496735999999972}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{2}} - \frac{1.42141374100000006}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{3}}\right) - \frac{1}{e^{{\left(\left|x\right|\right)}^{2}}} \cdot \left(\frac{1.0614054289999999}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{5}} + \frac{0.25482959199999999}{\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)}\right)\right) + \left(\mathsf{fma}\left(1.45315202700000001, \frac{\frac{1}{e^{{\left(\left|x\right|\right)}^{2}}}}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{4}}, 1\right) \cdot \mathsf{fma}\left(1.45315202700000001, \frac{\frac{1}{e^{{\left(\left|x\right|\right)}^{2}}}}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{4}}, 1\right) - \left(\frac{1}{e^{{\left(\left|x\right|\right)}^{2}}} \cdot \left(\frac{0.284496735999999972}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{2}} - \frac{1.42141374100000006}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{3}}\right) - \frac{1}{e^{{\left(\left|x\right|\right)}^{2}}} \cdot \left(\frac{1.0614054289999999}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{5}} + \frac{0.25482959199999999}{\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)}\right)\right) \cdot \mathsf{fma}\left(1.45315202700000001, \frac{\frac{1}{e^{{\left(\left|x\right|\right)}^{2}}}}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{4}}, 1\right)\right)}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 ((pow((((1.0 / exp(pow(fabs(x), 2.0))) * ((0.284496736 / pow(fma(0.3275911, fabs(x), 1.0), 2.0)) - (1.421413741 / pow(fma(0.3275911, fabs(x), 1.0), 3.0)))) - ((1.0 / exp(pow(fabs(x), 2.0))) * ((1.061405429 / pow(fma(0.3275911, fabs(x), 1.0), 5.0)) + (0.254829592 / fma(0.3275911, fabs(x), 1.0))))), 3.0) + pow(fma(1.453152027, ((1.0 / exp(pow(fabs(x), 2.0))) / pow(fma(0.3275911, fabs(x), 1.0), 4.0)), 1.0), 3.0)) / (((((1.0 / exp(pow(fabs(x), 2.0))) * ((0.284496736 / pow(fma(0.3275911, fabs(x), 1.0), 2.0)) - (1.421413741 / pow(fma(0.3275911, fabs(x), 1.0), 3.0)))) - ((1.0 / exp(pow(fabs(x), 2.0))) * ((1.061405429 / pow(fma(0.3275911, fabs(x), 1.0), 5.0)) + (0.254829592 / fma(0.3275911, fabs(x), 1.0))))) * (((1.0 / exp(pow(fabs(x), 2.0))) * ((0.284496736 / pow(fma(0.3275911, fabs(x), 1.0), 2.0)) - (1.421413741 / pow(fma(0.3275911, fabs(x), 1.0), 3.0)))) - ((1.0 / exp(pow(fabs(x), 2.0))) * ((1.061405429 / pow(fma(0.3275911, fabs(x), 1.0), 5.0)) + (0.254829592 / fma(0.3275911, fabs(x), 1.0)))))) + ((fma(1.453152027, ((1.0 / exp(pow(fabs(x), 2.0))) / pow(fma(0.3275911, fabs(x), 1.0), 4.0)), 1.0) * fma(1.453152027, ((1.0 / exp(pow(fabs(x), 2.0))) / pow(fma(0.3275911, fabs(x), 1.0), 4.0)), 1.0)) - ((((1.0 / exp(pow(fabs(x), 2.0))) * ((0.284496736 / pow(fma(0.3275911, fabs(x), 1.0), 2.0)) - (1.421413741 / pow(fma(0.3275911, fabs(x), 1.0), 3.0)))) - ((1.0 / exp(pow(fabs(x), 2.0))) * ((1.061405429 / pow(fma(0.3275911, fabs(x), 1.0), 5.0)) + (0.254829592 / fma(0.3275911, fabs(x), 1.0))))) * fma(1.453152027, ((1.0 / exp(pow(fabs(x), 2.0))) / pow(fma(0.3275911, fabs(x), 1.0), 4.0)), 1.0)))));
}



Bits error versus x
Results
Initial program 13.9
Simplified13.9
Taylor expanded around 0 14.6
Simplified13.9
Taylor expanded around 0 13.9
Simplified13.9
rmApplied flip3-+13.8
Final simplification13.8
herbie shell --seed 2020071 +o rules:numerics
(FPCore (x)
:name "Jmat.Real.erf"
:precision binary64
(- 1 (* (* (/ 1 (+ 1 (* 0.3275911 (fabs x)))) (+ 0.254829592 (* (/ 1 (+ 1 (* 0.3275911 (fabs x)))) (+ -0.284496736 (* (/ 1 (+ 1 (* 0.3275911 (fabs x)))) (+ 1.421413741 (* (/ 1 (+ 1 (* 0.3275911 (fabs x)))) (+ -1.453152027 (* (/ 1 (+ 1 (* 0.3275911 (fabs x)))) 1.061405429))))))))) (exp (- (* (fabs x) (fabs x)))))))