\frac{e^{x}}{e^{x} - 1}\begin{array}{l}
\mathbf{if}\;e^{x} \le 0.0:\\
\;\;\;\;\frac{1}{1 + \sqrt[3]{{\left(\frac{\sqrt{1}}{\sqrt{e^{x}}}\right)}^{3}}} \cdot \frac{1}{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 r72814 = x;
double r72815 = exp(r72814);
double r72816 = 1.0;
double r72817 = r72815 - r72816;
double r72818 = r72815 / r72817;
return r72818;
}
double f(double x) {
double r72819 = x;
double r72820 = exp(r72819);
double r72821 = 0.0;
bool r72822 = r72820 <= r72821;
double r72823 = 1.0;
double r72824 = 1.0;
double r72825 = sqrt(r72824);
double r72826 = sqrt(r72820);
double r72827 = r72825 / r72826;
double r72828 = 3.0;
double r72829 = pow(r72827, r72828);
double r72830 = cbrt(r72829);
double r72831 = r72823 + r72830;
double r72832 = r72823 / r72831;
double r72833 = r72823 - r72827;
double r72834 = r72823 / r72833;
double r72835 = r72832 * r72834;
double r72836 = 0.5;
double r72837 = 0.08333333333333333;
double r72838 = r72837 * r72819;
double r72839 = r72823 / r72819;
double r72840 = r72838 + r72839;
double r72841 = r72836 + r72840;
double r72842 = r72822 ? r72835 : r72841;
return r72842;
}




Bits error versus x
Results
| Original | 41.3 |
|---|---|
| Target | 40.8 |
| Herbie | 1.0 |
if (exp x) < 0.0Initial program 0
rmApplied clear-num0
Simplified0
rmApplied add-sqr-sqrt0
Applied add-sqr-sqrt0
Applied times-frac0
Applied add-sqr-sqrt0
Applied difference-of-squares0
Applied add-cube-cbrt0
Applied times-frac0
Simplified0
Simplified0
rmApplied add-cbrt-cube0
Applied add-cbrt-cube0
Applied cbrt-undiv0
Simplified0
if 0.0 < (exp x) Initial program 61.1
Taylor expanded around 0 1.4
Final simplification1.0
herbie shell --seed 2019306
(FPCore (x)
:name "expq2 (section 3.11)"
:precision binary64
:herbie-target
(/ 1 (- 1 (exp (- x))))
(/ (exp x) (- (exp x) 1)))