\frac{e^{x}}{e^{x} - 1}
\begin{array}{l}
t_0 := \sqrt{e^{x}}\\
t_0 \cdot \left(t_0 \cdot \frac{1}{\mathsf{expm1}\left(x\right)}\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 (/ 1.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 * (1.0 / expm1(x)));
}




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