\frac{e^{x}}{e^{x} - 1}
\begin{array}{l}
t_0 := \sqrt{e^{x}}\\
t_0 \cdot \frac{t_0}{\mathsf{expm1}\left(x\right)}
\end{array}
(FPCore (x) :precision binary64 (/ (exp x) (- (exp x) 1.0)))
(FPCore (x) :precision binary64 (let* ((t_0 (sqrt (exp x)))) (* t_0 (/ t_0 (expm1 x)))))
double code(double x) {
return exp(x) / (exp(x) - 1.0);
}
double code(double x) {
double t_0 = sqrt(exp(x));
return t_0 * (t_0 / expm1(x));
}




Bits error versus x
Results
| Original | 41.7 |
|---|---|
| Target | 41.2 |
| Herbie | 0.5 |
Initial program 41.7
Simplified0.4
Applied egg-rr0.5
Final simplification0.5
herbie shell --seed 2022125
(FPCore (x)
:name "expq2 (section 3.11)"
:precision binary64
:herbie-target
(/ 1.0 (- 1.0 (exp (- x))))
(/ (exp x) (- (exp x) 1.0)))