Average Error: 38.5 → 0.4
Time: 8.2s
Precision: 64
$e^{x} - 1$
$\begin{array}{l} \mathbf{if}\;x \le -1.446298005470316198547986452638269838644 \cdot 10^{-4}:\\ \;\;\;\;\frac{e^{x + x} - 1 \cdot 1}{e^{x} + 1}\\ \mathbf{else}:\\ \;\;\;\;x + {x}^{2} \cdot \left(\frac{1}{6} \cdot x + \frac{1}{2}\right)\\ \end{array}$
e^{x} - 1
\begin{array}{l}
\mathbf{if}\;x \le -1.446298005470316198547986452638269838644 \cdot 10^{-4}:\\
\;\;\;\;\frac{e^{x + x} - 1 \cdot 1}{e^{x} + 1}\\

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

\end{array}
double f(double x) {
double r102580 = x;
double r102581 = exp(r102580);
double r102582 = 1.0;
double r102583 = r102581 - r102582;
return r102583;
}


double f(double x) {
double r102584 = x;
double r102585 = -0.00014462980054703162;
bool r102586 = r102584 <= r102585;
double r102587 = r102584 + r102584;
double r102588 = exp(r102587);
double r102589 = 1.0;
double r102590 = r102589 * r102589;
double r102591 = r102588 - r102590;
double r102592 = exp(r102584);
double r102593 = r102592 + r102589;
double r102594 = r102591 / r102593;
double r102595 = 2.0;
double r102596 = pow(r102584, r102595);
double r102597 = 0.16666666666666666;
double r102598 = r102597 * r102584;
double r102599 = 0.5;
double r102600 = r102598 + r102599;
double r102601 = r102596 * r102600;
double r102602 = r102584 + r102601;
double r102603 = r102586 ? r102594 : r102602;
return r102603;
}



Try it out

Results

 In Out
Enter valid numbers for all inputs

Derivation

1. Split input into 2 regimes
2. if x < -0.00014462980054703162

1. Initial program 0.1

$e^{x} - 1$
2. Using strategy rm
3. Applied flip--0.1

$\leadsto \color{blue}{\frac{e^{x} \cdot e^{x} - 1 \cdot 1}{e^{x} + 1}}$
4. Simplified0.0

$\leadsto \frac{\color{blue}{e^{x + x} - 1 \cdot 1}}{e^{x} + 1}$

if -0.00014462980054703162 < x

1. Initial program 58.4

$e^{x} - 1$
2. Taylor expanded around 0 0.5

$\leadsto \color{blue}{\frac{1}{2} \cdot {x}^{2} + \left(x + \frac{1}{6} \cdot {x}^{3}\right)}$
3. Simplified0.5

$\leadsto \color{blue}{x + {x}^{2} \cdot \left(\frac{1}{6} \cdot x + \frac{1}{2}\right)}$
3. Recombined 2 regimes into one program.
4. Final simplification0.4

$\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.446298005470316198547986452638269838644 \cdot 10^{-4}:\\ \;\;\;\;\frac{e^{x + x} - 1 \cdot 1}{e^{x} + 1}\\ \mathbf{else}:\\ \;\;\;\;x + {x}^{2} \cdot \left(\frac{1}{6} \cdot x + \frac{1}{2}\right)\\ \end{array}$

Reproduce

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