\frac{e^{x}}{e^{x} - 1}\begin{array}{l}
\mathbf{if}\;e^{x} \le 0.994829753668147077:\\
\;\;\;\;\frac{\sqrt[3]{e^{x}} \cdot \sqrt[3]{e^{x}}}{\sqrt[3]{e^{x} - 1} \cdot \sqrt[3]{e^{x} - 1}} \cdot \frac{\sqrt[3]{e^{x}}}{\sqrt[3]{e^{x} - 1}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{12}, x, \frac{1}{x}\right) + \frac{1}{2}\\
\end{array}double code(double x) {
return (exp(x) / (exp(x) - 1.0));
}
double code(double x) {
double VAR;
if ((exp(x) <= 0.9948297536681471)) {
VAR = (((cbrt(exp(x)) * cbrt(exp(x))) / (cbrt((exp(x) - 1.0)) * cbrt((exp(x) - 1.0)))) * (cbrt(exp(x)) / cbrt((exp(x) - 1.0))));
} else {
VAR = (fma(0.08333333333333333, x, (1.0 / x)) + 0.5);
}
return VAR;
}




Bits error versus x
Results
| Original | 41.4 |
|---|---|
| Target | 41.0 |
| Herbie | 0.6 |
if (exp x) < 0.9948297536681471Initial program 0.0
rmApplied add-cube-cbrt0.0
Applied add-cube-cbrt0.0
Applied times-frac0.0
if 0.9948297536681471 < (exp x) Initial program 62.0
Taylor expanded around 0 0.8
Simplified0.8
Final simplification0.6
herbie shell --seed 2020079 +o rules:numerics
(FPCore (x)
:name "expq2 (section 3.11)"
:precision binary64
:herbie-target
(/ 1 (- 1 (exp (- x))))
(/ (exp x) (- (exp x) 1)))