\frac{e^{x}}{e^{x} - 1}\begin{array}{l}
\mathbf{if}\;e^{x} \leq 0.954500155621059:\\
\;\;\;\;\frac{1}{\log \left(\log \left(e^{\frac{e}{e^{\frac{1}{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 (<= (exp x) 0.954500155621059) (/ 1.0 (log (log (exp (/ E (exp (/ 1.0 (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 ((((double) exp(x)) <= 0.954500155621059)) {
tmp = (1.0 / ((double) log(((double) log(((double) exp((((double) M_E) / ((double) exp((1.0 / ((double) exp(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 (exp.f64 x) < 0.95450015562105905Initial program 0.0
rmApplied clear-num_binary640.0
Simplified0.0
rmApplied add-log-exp_binary640.4
Applied add-log-exp_binary640.4
Applied diff-log_binary640.5
Simplified0.5
rmApplied add-log-exp_binary640.5
if 0.95450015562105905 < (exp.f64 x) Initial program 61.8
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)))