Average Error: 13.8 → 13.1
Time: 12.1s
Precision: 64
\[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{\mathsf{fma}\left(-{\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}\right)}^{3} \cdot \mathsf{log1p}\left(\mathsf{expm1}\left({\left(\mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right)\right)}^{3}\right)\right), {\left(\frac{1}{e^{{\left(\left|x\right|\right)}^{2}}}\right)}^{3}, {1}^{3}\right)}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right) \cdot 1}{\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)}, e^{-{\left(\left|x\right|\right)}^{2}} \cdot \mathsf{fma}\left(\frac{1}{e^{{\left(\left|x\right|\right)}^{2}}} \cdot \frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right), 1\right), 1 \cdot 1\right)}\]
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{\mathsf{fma}\left(-{\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}\right)}^{3} \cdot \mathsf{log1p}\left(\mathsf{expm1}\left({\left(\mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right)\right)}^{3}\right)\right), {\left(\frac{1}{e^{{\left(\left|x\right|\right)}^{2}}}\right)}^{3}, {1}^{3}\right)}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right) \cdot 1}{\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)}, e^{-{\left(\left|x\right|\right)}^{2}} \cdot \mathsf{fma}\left(\frac{1}{e^{{\left(\left|x\right|\right)}^{2}}} \cdot \frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right), 1\right), 1 \cdot 1\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 (fma(-(pow((1.0 / ((0.3275911 * fabs(x)) + 1.0)), 3.0) * log1p(expm1(pow(fma((1.0 / ((0.3275911 * fabs(x)) + 1.0)), fma((1.0 / ((0.3275911 * fabs(x)) + 1.0)), fma((1.0 / ((0.3275911 * fabs(x)) + 1.0)), fma((1.0 / ((0.3275911 * fabs(x)) + 1.0)), 1.061405429, -1.453152027), 1.421413741), -0.284496736), 0.254829592), 3.0)))), pow((1.0 / exp(pow(fabs(x), 2.0))), 3.0), pow(1.0, 3.0)) / fma(((fma((1.0 / ((0.3275911 * fabs(x)) + 1.0)), fma((1.0 / ((0.3275911 * fabs(x)) + 1.0)), fma((1.0 / ((0.3275911 * fabs(x)) + 1.0)), fma((1.0 / ((0.3275911 * fabs(x)) + 1.0)), 1.061405429, -1.453152027), 1.421413741), -0.284496736), 0.254829592) * 1.0) / fma(0.3275911, fabs(x), 1.0)), (exp(-pow(fabs(x), 2.0)) * fma(((1.0 / exp(pow(fabs(x), 2.0))) * (1.0 / (1.0 + (0.3275911 * fabs(x))))), fma((1.0 / ((0.3275911 * fabs(x)) + 1.0)), fma((1.0 / ((0.3275911 * fabs(x)) + 1.0)), fma((1.0 / ((0.3275911 * fabs(x)) + 1.0)), fma((1.0 / ((0.3275911 * fabs(x)) + 1.0)), 1.061405429, -1.453152027), 1.421413741), -0.284496736), 0.254829592), 1.0)), (1.0 * 1.0)));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 13.8

    \[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|}\]
  2. Using strategy rm
  3. Applied flip3--13.8

    \[\leadsto \color{blue}{\frac{{1}^{3} - {\left(\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|}\right)}^{3}}{1 \cdot 1 + \left(\left(\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|}\right) \cdot \left(\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|}\right) + 1 \cdot \left(\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|}\right)\right)}}\]
  4. Simplified13.8

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-{\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}\right)}^{3} \cdot {\left(\mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right)\right)}^{3}, {\left(\frac{1}{e^{{\left(\left|x\right|\right)}^{2}}}\right)}^{3}, {1}^{3}\right)}}{1 \cdot 1 + \left(\left(\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|}\right) \cdot \left(\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|}\right) + 1 \cdot \left(\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|}\right)\right)}\]
  5. Simplified13.8

    \[\leadsto \frac{\mathsf{fma}\left(-{\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}\right)}^{3} \cdot {\left(\mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right)\right)}^{3}, {\left(\frac{1}{e^{{\left(\left|x\right|\right)}^{2}}}\right)}^{3}, {1}^{3}\right)}{\color{blue}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right) \cdot 1}{\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)}, e^{-{\left(\left|x\right|\right)}^{2}} \cdot \mathsf{fma}\left(\frac{1}{e^{{\left(\left|x\right|\right)}^{2}}} \cdot \frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right), 1\right), 1 \cdot 1\right)}}\]
  6. Using strategy rm
  7. Applied log1p-expm1-u13.1

    \[\leadsto \frac{\mathsf{fma}\left(-{\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}\right)}^{3} \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left({\left(\mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right)\right)}^{3}\right)\right)}, {\left(\frac{1}{e^{{\left(\left|x\right|\right)}^{2}}}\right)}^{3}, {1}^{3}\right)}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right) \cdot 1}{\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)}, e^{-{\left(\left|x\right|\right)}^{2}} \cdot \mathsf{fma}\left(\frac{1}{e^{{\left(\left|x\right|\right)}^{2}}} \cdot \frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right), 1\right), 1 \cdot 1\right)}\]
  8. Final simplification13.1

    \[\leadsto \frac{\mathsf{fma}\left(-{\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}\right)}^{3} \cdot \mathsf{log1p}\left(\mathsf{expm1}\left({\left(\mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right)\right)}^{3}\right)\right), {\left(\frac{1}{e^{{\left(\left|x\right|\right)}^{2}}}\right)}^{3}, {1}^{3}\right)}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right) \cdot 1}{\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)}, e^{-{\left(\left|x\right|\right)}^{2}} \cdot \mathsf{fma}\left(\frac{1}{e^{{\left(\left|x\right|\right)}^{2}}} \cdot \frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, \mathsf{fma}\left(\frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right), 1\right), 1 \cdot 1\right)}\]

Reproduce

herbie shell --seed 2020091 +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)))))))