Average Error: 13.9 → 13.9
Time: 7.4s
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|}\]
\[\log \left(e^{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right)}{e^{\left|x\right| \cdot \left|x\right|}}, \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-1}{\mathsf{fma}\left(\left|x\right|, 0.32759110000000002, 1\right)}\right)\right), 1\right)}\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|}
\log \left(e^{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right)}{e^{\left|x\right| \cdot \left|x\right|}}, \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-1}{\mathsf{fma}\left(\left|x\right|, 0.32759110000000002, 1\right)}\right)\right), 1\right)}\right)
double f(double x) {
        double r175255 = 1.0;
        double r175256 = 0.3275911;
        double r175257 = x;
        double r175258 = fabs(r175257);
        double r175259 = r175256 * r175258;
        double r175260 = r175255 + r175259;
        double r175261 = r175255 / r175260;
        double r175262 = 0.254829592;
        double r175263 = -0.284496736;
        double r175264 = 1.421413741;
        double r175265 = -1.453152027;
        double r175266 = 1.061405429;
        double r175267 = r175261 * r175266;
        double r175268 = r175265 + r175267;
        double r175269 = r175261 * r175268;
        double r175270 = r175264 + r175269;
        double r175271 = r175261 * r175270;
        double r175272 = r175263 + r175271;
        double r175273 = r175261 * r175272;
        double r175274 = r175262 + r175273;
        double r175275 = r175261 * r175274;
        double r175276 = r175258 * r175258;
        double r175277 = -r175276;
        double r175278 = exp(r175277);
        double r175279 = r175275 * r175278;
        double r175280 = r175255 - r175279;
        return r175280;
}

double f(double x) {
        double r175281 = 1.0;
        double r175282 = 0.3275911;
        double r175283 = x;
        double r175284 = fabs(r175283);
        double r175285 = r175282 * r175284;
        double r175286 = r175281 + r175285;
        double r175287 = r175281 / r175286;
        double r175288 = 1.061405429;
        double r175289 = -1.453152027;
        double r175290 = fma(r175287, r175288, r175289);
        double r175291 = 1.421413741;
        double r175292 = fma(r175287, r175290, r175291);
        double r175293 = -0.284496736;
        double r175294 = fma(r175287, r175292, r175293);
        double r175295 = 0.254829592;
        double r175296 = fma(r175287, r175294, r175295);
        double r175297 = r175284 * r175284;
        double r175298 = exp(r175297);
        double r175299 = r175296 / r175298;
        double r175300 = -r175281;
        double r175301 = fma(r175284, r175282, r175281);
        double r175302 = r175300 / r175301;
        double r175303 = expm1(r175302);
        double r175304 = log1p(r175303);
        double r175305 = fma(r175299, r175304, r175281);
        double r175306 = exp(r175305);
        double r175307 = log(r175306);
        return r175307;
}

Error

Bits error versus x

Derivation

  1. Initial program 13.9

    \[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. Simplified13.9

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right)}{e^{\left|x\right| \cdot \left|x\right|}}, \frac{-1}{\mathsf{fma}\left(\left|x\right|, 0.32759110000000002, 1\right)}, 1\right)}\]
  3. Using strategy rm
  4. Applied add-log-exp13.9

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

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

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

Reproduce

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