\frac{e^{x}}{e^{x} - 1}\begin{array}{l}
\mathbf{if}\;x \leq -0.0019484732184867164:\\
\;\;\;\;\frac{1}{\log \left(\log \left(e^{\frac{e}{e^{e^{-x}}}}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;0.5 + \left(x \cdot 0.08333333333333333 + \frac{1}{x}\right)\\
\end{array}(FPCore (x) :precision binary64 (/ (exp x) (- (exp x) 1.0)))
(FPCore (x) :precision binary64 (if (<= x -0.0019484732184867164) (/ 1.0 (log (log (exp (/ E (exp (exp (- x)))))))) (+ 0.5 (+ (* x 0.08333333333333333) (/ 1.0 x)))))
double code(double x) {
return (((double) exp(x)) / ((double) (((double) exp(x)) - 1.0)));
}
double code(double x) {
double tmp;
if ((x <= -0.0019484732184867164)) {
tmp = (1.0 / ((double) log(((double) log(((double) exp((((double) M_E) / ((double) exp(((double) exp(((double) -(x))))))))))))));
} else {
tmp = ((double) (0.5 + ((double) (((double) (x * 0.08333333333333333)) + (1.0 / x)))));
}
return tmp;
}




Bits error versus x
Results
| Original | 41.3 |
|---|---|
| Target | 41.0 |
| Herbie | 0.7 |
if x < -0.00194847321848671639Initial program 0.0
rmApplied clear-num_binary640.0
Simplified0.0
rmApplied add-log-exp_binary640.5
Applied add-log-exp_binary640.5
Applied diff-log_binary640.5
Simplified0.5
rmApplied add-log-exp_binary640.5
if -0.00194847321848671639 < x Initial program 61.9
Taylor expanded around 0 0.7
Simplified0.7
Final simplification0.7
herbie shell --seed 2020210
(FPCore (x)
:name "expq2 (section 3.11)"
:precision binary64
:herbie-target
(/ 1.0 (- 1.0 (exp (- x))))
(/ (exp x) (- (exp x) 1.0)))