\frac{e^{x}}{e^{x} - 1}\begin{array}{l}
\mathbf{if}\;x \le -0.0018711434362285975:\\
\;\;\;\;\frac{\frac{\frac{1}{\sqrt[3]{1 - e^{\log 1 - x}}}}{\sqrt[3]{1 - e^{\log 1 - x}}}}{\sqrt[3]{1 - e^{\log 1 - x}}}\\
\mathbf{elif}\;x \le 9.641487078301664 \cdot 10^{-4}:\\
\;\;\;\;\frac{1}{2} + \left(\frac{1}{12} \cdot x + \frac{1}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1 - \frac{{\left(e^{2}\right)}^{\left(\log 1 - x\right)}}{1}}{1 + \frac{1}{e^{x}}}}\\
\end{array}double f(double x) {
double r87991 = x;
double r87992 = exp(r87991);
double r87993 = 1.0;
double r87994 = r87992 - r87993;
double r87995 = r87992 / r87994;
return r87995;
}
double f(double x) {
double r87996 = x;
double r87997 = -0.0018711434362285975;
bool r87998 = r87996 <= r87997;
double r87999 = 1.0;
double r88000 = 1.0;
double r88001 = log(r88000);
double r88002 = r88001 - r87996;
double r88003 = exp(r88002);
double r88004 = r87999 - r88003;
double r88005 = cbrt(r88004);
double r88006 = r87999 / r88005;
double r88007 = r88006 / r88005;
double r88008 = r88007 / r88005;
double r88009 = 0.0009641487078301664;
bool r88010 = r87996 <= r88009;
double r88011 = 0.5;
double r88012 = 0.08333333333333333;
double r88013 = r88012 * r87996;
double r88014 = r87999 / r87996;
double r88015 = r88013 + r88014;
double r88016 = r88011 + r88015;
double r88017 = 2.0;
double r88018 = exp(r88017);
double r88019 = pow(r88018, r88002);
double r88020 = r88019 / r87999;
double r88021 = r87999 - r88020;
double r88022 = exp(r87996);
double r88023 = r88000 / r88022;
double r88024 = r87999 + r88023;
double r88025 = r88021 / r88024;
double r88026 = r87999 / r88025;
double r88027 = r88010 ? r88016 : r88026;
double r88028 = r87998 ? r88008 : r88027;
return r88028;
}




Bits error versus x
Results
| Original | 40.3 |
|---|---|
| Target | 39.8 |
| Herbie | 0.0 |
if x < -0.0018711434362285975Initial program 0.0
rmApplied clear-num0.0
Simplified0.0
rmApplied add-exp-log0.0
Applied div-exp0.0
rmApplied add-cube-cbrt0.0
Applied associate-/r*0.0
Simplified0.0
if -0.0018711434362285975 < x < 0.0009641487078301664Initial program 62.4
Taylor expanded around 0 0.0
if 0.0009641487078301664 < x Initial program 35.8
rmApplied clear-num35.8
Simplified1.1
rmApplied add-exp-log1.1
Applied div-exp0.7
rmApplied flip--0.7
Simplified0.6
Simplified0.6
Final simplification0.0
herbie shell --seed 2020025
(FPCore (x)
:name "expq2 (section 3.11)"
:precision binary64
:herbie-target
(/ 1 (- 1 (exp (- x))))
(/ (exp x) (- (exp x) 1)))