Average Error: 30.5 → 0.0
Time: 6.6s
Precision: 64
\[\frac{x}{1 - e^{-x}}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.002030750395893324202617469254050774907228 \lor \neg \left(x \le 0.001695914354802261544280517213678649568465\right):\\ \;\;\;\;\frac{x}{\sqrt[3]{{\left(1 - e^{-x}\right)}^{3}}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{1}{12} \cdot x + \frac{1}{2}\right) + 1\\ \end{array}\]
\frac{x}{1 - e^{-x}}
\begin{array}{l}
\mathbf{if}\;x \le -0.002030750395893324202617469254050774907228 \lor \neg \left(x \le 0.001695914354802261544280517213678649568465\right):\\
\;\;\;\;\frac{x}{\sqrt[3]{{\left(1 - e^{-x}\right)}^{3}}}\\

\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{1}{12} \cdot x + \frac{1}{2}\right) + 1\\

\end{array}
double f(double x) {
        double r1256547 = x;
        double r1256548 = 1.0;
        double r1256549 = -r1256547;
        double r1256550 = exp(r1256549);
        double r1256551 = r1256548 - r1256550;
        double r1256552 = r1256547 / r1256551;
        return r1256552;
}

double f(double x) {
        double r1256553 = x;
        double r1256554 = -0.002030750395893324;
        bool r1256555 = r1256553 <= r1256554;
        double r1256556 = 0.0016959143548022615;
        bool r1256557 = r1256553 <= r1256556;
        double r1256558 = !r1256557;
        bool r1256559 = r1256555 || r1256558;
        double r1256560 = 1.0;
        double r1256561 = -r1256553;
        double r1256562 = exp(r1256561);
        double r1256563 = r1256560 - r1256562;
        double r1256564 = 3.0;
        double r1256565 = pow(r1256563, r1256564);
        double r1256566 = cbrt(r1256565);
        double r1256567 = r1256553 / r1256566;
        double r1256568 = 0.08333333333333333;
        double r1256569 = r1256568 * r1256553;
        double r1256570 = 0.5;
        double r1256571 = r1256569 + r1256570;
        double r1256572 = r1256553 * r1256571;
        double r1256573 = 1.0;
        double r1256574 = r1256572 + r1256573;
        double r1256575 = r1256559 ? r1256567 : r1256574;
        return r1256575;
}

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.002030750395893324 or 0.0016959143548022615 < x

    1. Initial program 0.0

      \[\frac{x}{1 - e^{-x}}\]
    2. Using strategy rm
    3. Applied add-cbrt-cube0.1

      \[\leadsto \frac{x}{\color{blue}{\sqrt[3]{\left(\left(1 - e^{-x}\right) \cdot \left(1 - e^{-x}\right)\right) \cdot \left(1 - e^{-x}\right)}}}\]
    4. Simplified0.1

      \[\leadsto \frac{x}{\sqrt[3]{\color{blue}{{\left(1 - e^{-x}\right)}^{3}}}}\]

    if -0.002030750395893324 < x < 0.0016959143548022615

    1. Initial program 62.3

      \[\frac{x}{1 - e^{-x}}\]
    2. Taylor expanded around 0 0.0

      \[\leadsto \color{blue}{\frac{1}{12} \cdot {x}^{2} + \left(\frac{1}{2} \cdot x + 1\right)}\]
    3. Simplified0.0

      \[\leadsto \color{blue}{x \cdot \left(\frac{1}{12} \cdot x + \frac{1}{2}\right) + 1}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.002030750395893324202617469254050774907228 \lor \neg \left(x \le 0.001695914354802261544280517213678649568465\right):\\ \;\;\;\;\frac{x}{\sqrt[3]{{\left(1 - e^{-x}\right)}^{3}}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{1}{12} \cdot x + \frac{1}{2}\right) + 1\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (x)
  :name "x/(1-exp(-x))"
  :precision binary64
  (/ x (- 1 (exp (- x)))))