Average Error: 13.6 → 13.6
Time: 9.3s
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{\frac{1}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{\frac{1}{2}}} \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{log1p}\left(\mathsf{expm1}\left({\left(\sqrt[3]{\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}}\right)}^{3}\right)\right), \mathsf{fma}\left(\frac{1}{\mathsf{fma}\left(\left|x\right|, 0.32759110000000002, 1\right)}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), \frac{1}{\mathsf{fma}\left(\left|x\right|, 0.32759110000000002, 1\right)}, -0.284496735999999972\right)}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{\frac{1}{2}}} + 0.25482959199999999}{e^{\left|x\right| \cdot \left|x\right|}}, \frac{-1}{\mathsf{fma}\left(\left|x\right|, 0.32759110000000002, 1\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{\frac{1}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{\frac{1}{2}}} \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{log1p}\left(\mathsf{expm1}\left({\left(\sqrt[3]{\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}}\right)}^{3}\right)\right), \mathsf{fma}\left(\frac{1}{\mathsf{fma}\left(\left|x\right|, 0.32759110000000002, 1\right)}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), \frac{1}{\mathsf{fma}\left(\left|x\right|, 0.32759110000000002, 1\right)}, -0.284496735999999972\right)}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{\frac{1}{2}}} + 0.25482959199999999}{e^{\left|x\right| \cdot \left|x\right|}}, \frac{-1}{\mathsf{fma}\left(\left|x\right|, 0.32759110000000002, 1\right)}, 1\right)}\right)
double f(double x) {
        double r207247 = 1.0;
        double r207248 = 0.3275911;
        double r207249 = x;
        double r207250 = fabs(r207249);
        double r207251 = r207248 * r207250;
        double r207252 = r207247 + r207251;
        double r207253 = r207247 / r207252;
        double r207254 = 0.254829592;
        double r207255 = -0.284496736;
        double r207256 = 1.421413741;
        double r207257 = -1.453152027;
        double r207258 = 1.061405429;
        double r207259 = r207253 * r207258;
        double r207260 = r207257 + r207259;
        double r207261 = r207253 * r207260;
        double r207262 = r207256 + r207261;
        double r207263 = r207253 * r207262;
        double r207264 = r207255 + r207263;
        double r207265 = r207253 * r207264;
        double r207266 = r207254 + r207265;
        double r207267 = r207253 * r207266;
        double r207268 = r207250 * r207250;
        double r207269 = -r207268;
        double r207270 = exp(r207269);
        double r207271 = r207267 * r207270;
        double r207272 = r207247 - r207271;
        return r207272;
}

double f(double x) {
        double r207273 = 1.0;
        double r207274 = 0.3275911;
        double r207275 = x;
        double r207276 = fabs(r207275);
        double r207277 = fma(r207274, r207276, r207273);
        double r207278 = 0.5;
        double r207279 = pow(r207277, r207278);
        double r207280 = r207273 / r207279;
        double r207281 = r207274 * r207276;
        double r207282 = r207273 + r207281;
        double r207283 = r207273 / r207282;
        double r207284 = cbrt(r207283);
        double r207285 = 3.0;
        double r207286 = pow(r207284, r207285);
        double r207287 = expm1(r207286);
        double r207288 = log1p(r207287);
        double r207289 = fma(r207276, r207274, r207273);
        double r207290 = r207273 / r207289;
        double r207291 = 1.061405429;
        double r207292 = -1.453152027;
        double r207293 = fma(r207290, r207291, r207292);
        double r207294 = 1.421413741;
        double r207295 = fma(r207288, r207293, r207294);
        double r207296 = -0.284496736;
        double r207297 = fma(r207295, r207290, r207296);
        double r207298 = r207297 / r207279;
        double r207299 = r207280 * r207298;
        double r207300 = 0.254829592;
        double r207301 = r207299 + r207300;
        double r207302 = r207276 * r207276;
        double r207303 = exp(r207302);
        double r207304 = r207301 / r207303;
        double r207305 = -r207273;
        double r207306 = r207305 / r207289;
        double r207307 = fma(r207304, r207306, r207273);
        double r207308 = exp(r207307);
        double r207309 = log(r207308);
        return r207309;
}

Error

Bits error versus x

Derivation

  1. Initial program 13.6

    \[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.6

    \[\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-cube-cbrt13.6

    \[\leadsto \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(\color{blue}{\left(\sqrt[3]{\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}} \cdot \sqrt[3]{\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}}\right) \cdot \sqrt[3]{\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)\]
  5. Using strategy rm
  6. Applied add-log-exp13.6

    \[\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(\left(\sqrt[3]{\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}} \cdot \sqrt[3]{\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}}\right) \cdot \sqrt[3]{\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)}\]
  7. Using strategy rm
  8. Applied fma-udef13.6

    \[\leadsto \log \left(e^{\mathsf{fma}\left(\frac{\color{blue}{\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|} \cdot \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\left(\sqrt[3]{\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}} \cdot \sqrt[3]{\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}}\right) \cdot \sqrt[3]{\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}}{e^{\left|x\right| \cdot \left|x\right|}}, \frac{-1}{\mathsf{fma}\left(\left|x\right|, 0.32759110000000002, 1\right)}, 1\right)}\right)\]
  9. Simplified13.6

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

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

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

Reproduce

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