\frac{e^{x}}{e^{x} - 1}\begin{array}{l}
\mathbf{if}\;e^{x} \le 1.47962565206442419 \cdot 10^{-13} \lor \neg \left(e^{x} \le 1.00035730044387416\right):\\
\;\;\;\;\frac{\frac{1}{1 + \frac{\sqrt{1}}{\sqrt{e^{x}}}}}{1 - \frac{\sqrt{1}}{\sqrt{e^{x}}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2} + \left(\frac{1}{12} \cdot x + \frac{1}{x}\right)\\
\end{array}double f(double x) {
double r118475 = x;
double r118476 = exp(r118475);
double r118477 = 1.0;
double r118478 = r118476 - r118477;
double r118479 = r118476 / r118478;
return r118479;
}
double f(double x) {
double r118480 = x;
double r118481 = exp(r118480);
double r118482 = 1.4796256520644242e-13;
bool r118483 = r118481 <= r118482;
double r118484 = 1.0003573004438742;
bool r118485 = r118481 <= r118484;
double r118486 = !r118485;
bool r118487 = r118483 || r118486;
double r118488 = 1.0;
double r118489 = 1.0;
double r118490 = sqrt(r118489);
double r118491 = sqrt(r118481);
double r118492 = r118490 / r118491;
double r118493 = r118488 + r118492;
double r118494 = r118488 / r118493;
double r118495 = r118488 - r118492;
double r118496 = r118494 / r118495;
double r118497 = 0.5;
double r118498 = 0.08333333333333333;
double r118499 = r118498 * r118480;
double r118500 = r118488 / r118480;
double r118501 = r118499 + r118500;
double r118502 = r118497 + r118501;
double r118503 = r118487 ? r118496 : r118502;
return r118503;
}




Bits error versus x
Results
| Original | 41.4 |
|---|---|
| Target | 41.1 |
| Herbie | 0.2 |
if (exp x) < 1.4796256520644242e-13 or 1.0003573004438742 < (exp x) Initial program 1.2
rmApplied clear-num1.2
Simplified0.1
rmApplied add-sqr-sqrt0.1
Applied add-sqr-sqrt0.1
Applied times-frac0.1
Applied *-un-lft-identity0.1
Applied difference-of-squares0.1
Applied associate-/r*0.1
if 1.4796256520644242e-13 < (exp x) < 1.0003573004438742Initial program 62.2
Taylor expanded around 0 0.3
Final simplification0.2
herbie shell --seed 2020035
(FPCore (x)
:name "expq2 (section 3.11)"
:precision binary64
:herbie-target
(/ 1 (- 1 (exp (- x))))
(/ (exp x) (- (exp x) 1)))