Average Error: 41.4 → 1.2
Time: 29.8s
Precision: 64
\[\frac{\left(1 - e^{\left(-2\right) \cdot x}\right) - \left(2 \cdot x\right) \cdot e^{-x}}{2 \cdot {x}^{3}}\]
\[\begin{array}{l} \mathbf{if}\;x \le 0.002769707279409536031244964959796561743133:\\ \;\;\;\;\left(\log \left(e^{0.09166666666666667406815349750104360282421 \cdot {x}^{2}}\right) + 0.1666666666666666296592325124947819858789\right) - 0.1666666666666666574148081281236954964697 \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\frac{1 - e^{\left(-2\right) \cdot x}}{2}} + \frac{\sqrt{x}}{\sqrt{e^{x}}}}{{x}^{\left(\frac{3}{2}\right)}} \cdot \frac{\sqrt{\frac{1 - e^{\left(-2\right) \cdot x}}{2}} - \frac{\sqrt{x}}{\sqrt{e^{x}}}}{{x}^{\left(\frac{3}{2}\right)}}\\ \end{array}\]
\frac{\left(1 - e^{\left(-2\right) \cdot x}\right) - \left(2 \cdot x\right) \cdot e^{-x}}{2 \cdot {x}^{3}}
\begin{array}{l}
\mathbf{if}\;x \le 0.002769707279409536031244964959796561743133:\\
\;\;\;\;\left(\log \left(e^{0.09166666666666667406815349750104360282421 \cdot {x}^{2}}\right) + 0.1666666666666666296592325124947819858789\right) - 0.1666666666666666574148081281236954964697 \cdot x\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\frac{1 - e^{\left(-2\right) \cdot x}}{2}} + \frac{\sqrt{x}}{\sqrt{e^{x}}}}{{x}^{\left(\frac{3}{2}\right)}} \cdot \frac{\sqrt{\frac{1 - e^{\left(-2\right) \cdot x}}{2}} - \frac{\sqrt{x}}{\sqrt{e^{x}}}}{{x}^{\left(\frac{3}{2}\right)}}\\

\end{array}
double f(double x) {
        double r682452 = 1.0;
        double r682453 = 2.0;
        double r682454 = -r682453;
        double r682455 = x;
        double r682456 = r682454 * r682455;
        double r682457 = exp(r682456);
        double r682458 = r682452 - r682457;
        double r682459 = r682453 * r682455;
        double r682460 = -r682455;
        double r682461 = exp(r682460);
        double r682462 = r682459 * r682461;
        double r682463 = r682458 - r682462;
        double r682464 = 3.0;
        double r682465 = pow(r682455, r682464);
        double r682466 = r682453 * r682465;
        double r682467 = r682463 / r682466;
        return r682467;
}

double f(double x) {
        double r682468 = x;
        double r682469 = 0.002769707279409536;
        bool r682470 = r682468 <= r682469;
        double r682471 = 0.09166666666666667;
        double r682472 = 2.0;
        double r682473 = pow(r682468, r682472);
        double r682474 = r682471 * r682473;
        double r682475 = exp(r682474);
        double r682476 = log(r682475);
        double r682477 = 0.16666666666666663;
        double r682478 = r682476 + r682477;
        double r682479 = 0.16666666666666666;
        double r682480 = r682479 * r682468;
        double r682481 = r682478 - r682480;
        double r682482 = 1.0;
        double r682483 = 2.0;
        double r682484 = -r682483;
        double r682485 = r682484 * r682468;
        double r682486 = exp(r682485);
        double r682487 = r682482 - r682486;
        double r682488 = r682487 / r682483;
        double r682489 = sqrt(r682488);
        double r682490 = sqrt(r682468);
        double r682491 = exp(r682468);
        double r682492 = sqrt(r682491);
        double r682493 = r682490 / r682492;
        double r682494 = r682489 + r682493;
        double r682495 = 3.0;
        double r682496 = r682495 / r682472;
        double r682497 = pow(r682468, r682496);
        double r682498 = r682494 / r682497;
        double r682499 = r682489 - r682493;
        double r682500 = r682499 / r682497;
        double r682501 = r682498 * r682500;
        double r682502 = r682470 ? r682481 : r682501;
        return r682502;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < 0.002769707279409536

    1. Initial program 62.8

      \[\frac{\left(1 - e^{\left(-2\right) \cdot x}\right) - \left(2 \cdot x\right) \cdot e^{-x}}{2 \cdot {x}^{3}}\]
    2. Simplified62.8

      \[\leadsto \color{blue}{\frac{\frac{1 - e^{\left(-2\right) \cdot x}}{2} - \frac{x}{e^{x}}}{{x}^{3}}}\]
    3. Taylor expanded around 0 1.6

      \[\leadsto \color{blue}{\left(0.09166666666666667406815349750104360282421 \cdot {x}^{2} + 0.1666666666666666296592325124947819858789\right) - 0.1666666666666666574148081281236954964697 \cdot x}\]
    4. Using strategy rm
    5. Applied add-log-exp1.6

      \[\leadsto \left(\color{blue}{\log \left(e^{0.09166666666666667406815349750104360282421 \cdot {x}^{2}}\right)} + 0.1666666666666666296592325124947819858789\right) - 0.1666666666666666574148081281236954964697 \cdot x\]

    if 0.002769707279409536 < x

    1. Initial program 0.7

      \[\frac{\left(1 - e^{\left(-2\right) \cdot x}\right) - \left(2 \cdot x\right) \cdot e^{-x}}{2 \cdot {x}^{3}}\]
    2. Simplified0.7

      \[\leadsto \color{blue}{\frac{\frac{1 - e^{\left(-2\right) \cdot x}}{2} - \frac{x}{e^{x}}}{{x}^{3}}}\]
    3. Using strategy rm
    4. Applied sqr-pow0.7

      \[\leadsto \frac{\frac{1 - e^{\left(-2\right) \cdot x}}{2} - \frac{x}{e^{x}}}{\color{blue}{{x}^{\left(\frac{3}{2}\right)} \cdot {x}^{\left(\frac{3}{2}\right)}}}\]
    5. Applied add-sqr-sqrt0.7

      \[\leadsto \frac{\frac{1 - e^{\left(-2\right) \cdot x}}{2} - \frac{x}{\color{blue}{\sqrt{e^{x}} \cdot \sqrt{e^{x}}}}}{{x}^{\left(\frac{3}{2}\right)} \cdot {x}^{\left(\frac{3}{2}\right)}}\]
    6. Applied add-sqr-sqrt0.7

      \[\leadsto \frac{\frac{1 - e^{\left(-2\right) \cdot x}}{2} - \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{\sqrt{e^{x}} \cdot \sqrt{e^{x}}}}{{x}^{\left(\frac{3}{2}\right)} \cdot {x}^{\left(\frac{3}{2}\right)}}\]
    7. Applied times-frac0.7

      \[\leadsto \frac{\frac{1 - e^{\left(-2\right) \cdot x}}{2} - \color{blue}{\frac{\sqrt{x}}{\sqrt{e^{x}}} \cdot \frac{\sqrt{x}}{\sqrt{e^{x}}}}}{{x}^{\left(\frac{3}{2}\right)} \cdot {x}^{\left(\frac{3}{2}\right)}}\]
    8. Applied add-sqr-sqrt1.0

      \[\leadsto \frac{\color{blue}{\sqrt{\frac{1 - e^{\left(-2\right) \cdot x}}{2}} \cdot \sqrt{\frac{1 - e^{\left(-2\right) \cdot x}}{2}}} - \frac{\sqrt{x}}{\sqrt{e^{x}}} \cdot \frac{\sqrt{x}}{\sqrt{e^{x}}}}{{x}^{\left(\frac{3}{2}\right)} \cdot {x}^{\left(\frac{3}{2}\right)}}\]
    9. Applied difference-of-squares1.0

      \[\leadsto \frac{\color{blue}{\left(\sqrt{\frac{1 - e^{\left(-2\right) \cdot x}}{2}} + \frac{\sqrt{x}}{\sqrt{e^{x}}}\right) \cdot \left(\sqrt{\frac{1 - e^{\left(-2\right) \cdot x}}{2}} - \frac{\sqrt{x}}{\sqrt{e^{x}}}\right)}}{{x}^{\left(\frac{3}{2}\right)} \cdot {x}^{\left(\frac{3}{2}\right)}}\]
    10. Applied times-frac0.4

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{1 - e^{\left(-2\right) \cdot x}}{2}} + \frac{\sqrt{x}}{\sqrt{e^{x}}}}{{x}^{\left(\frac{3}{2}\right)}} \cdot \frac{\sqrt{\frac{1 - e^{\left(-2\right) \cdot x}}{2}} - \frac{\sqrt{x}}{\sqrt{e^{x}}}}{{x}^{\left(\frac{3}{2}\right)}}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 0.002769707279409536031244964959796561743133:\\ \;\;\;\;\left(\log \left(e^{0.09166666666666667406815349750104360282421 \cdot {x}^{2}}\right) + 0.1666666666666666296592325124947819858789\right) - 0.1666666666666666574148081281236954964697 \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\frac{1 - e^{\left(-2\right) \cdot x}}{2}} + \frac{\sqrt{x}}{\sqrt{e^{x}}}}{{x}^{\left(\frac{3}{2}\right)}} \cdot \frac{\sqrt{\frac{1 - e^{\left(-2\right) \cdot x}}{2}} - \frac{\sqrt{x}}{\sqrt{e^{x}}}}{{x}^{\left(\frac{3}{2}\right)}}\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (x)
  :name "(1 - exp(-2*x) - 2 * x * exp(-x)) / (2 * pow(x, 3))"
  :precision binary64
  (/ (- (- 1 (exp (* (- 2) x))) (* (* 2 x) (exp (- x)))) (* 2 (pow x 3))))