\frac{e^{x}}{e^{x} - 1}\begin{array}{l}
\mathbf{if}\;x \le -0.0025466853162572313:\\
\;\;\;\;\frac{\sqrt{e^{x}}}{1 + \sqrt{e^{x}}} \cdot \frac{\sqrt{e^{x}}}{\sqrt{e^{x}} - 1}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{x} + \frac{1}{2}\right) + \frac{1}{12} \cdot x\\
\end{array}double f(double x) {
double r2538510 = x;
double r2538511 = exp(r2538510);
double r2538512 = 1.0;
double r2538513 = r2538511 - r2538512;
double r2538514 = r2538511 / r2538513;
return r2538514;
}
double f(double x) {
double r2538515 = x;
double r2538516 = -0.0025466853162572313;
bool r2538517 = r2538515 <= r2538516;
double r2538518 = exp(r2538515);
double r2538519 = sqrt(r2538518);
double r2538520 = 1.0;
double r2538521 = r2538520 + r2538519;
double r2538522 = r2538519 / r2538521;
double r2538523 = r2538519 - r2538520;
double r2538524 = r2538519 / r2538523;
double r2538525 = r2538522 * r2538524;
double r2538526 = r2538520 / r2538515;
double r2538527 = 0.5;
double r2538528 = r2538526 + r2538527;
double r2538529 = 0.08333333333333333;
double r2538530 = r2538529 * r2538515;
double r2538531 = r2538528 + r2538530;
double r2538532 = r2538517 ? r2538525 : r2538531;
return r2538532;
}




Bits error versus x
Results
| Original | 40.5 |
|---|---|
| Target | 40.1 |
| Herbie | 0.7 |
if x < -0.0025466853162572313Initial program 0.0
rmApplied add-log-exp0.0
rmApplied *-un-lft-identity0.0
Applied add-sqr-sqrt0.0
Applied difference-of-squares0.0
Applied exp-prod0.0
Applied log-pow0.0
Applied add-sqr-sqrt0.0
Applied times-frac0.0
Simplified0.0
if -0.0025466853162572313 < x Initial program 60.2
Taylor expanded around 0 1.0
rmApplied *-commutative1.0
Final simplification0.7
herbie shell --seed 2019137
(FPCore (x)
:name "expq2 (section 3.11)"
:herbie-target
(/ 1 (- 1 (exp (- x))))
(/ (exp x) (- (exp x) 1)))