\frac{e^{x}}{e^{x} - 1}
\frac{1}{\mathsf{expm1}\left(x\right)} \cdot e^{x}
(FPCore (x) :precision binary64 (/ (exp x) (- (exp x) 1.0)))
(FPCore (x) :precision binary64 (* (/ 1.0 (expm1 x)) (exp x)))
double code(double x) {
return exp(x) / (exp(x) - 1.0);
}
double code(double x) {
return (1.0 / expm1(x)) * exp(x);
}




Bits error versus x
Results
| Original | 41.4 |
|---|---|
| Target | 41.0 |
| Herbie | 0.4 |
Initial program 41.4
Simplified0.4
Applied add-sqr-sqrt_binary640.4
Applied associate-/l*_binary640.4
Applied div-inv_binary640.4
Applied *-un-lft-identity_binary640.4
Applied sqrt-prod_binary640.4
Applied times-frac_binary640.4
Simplified0.4
Simplified0.4
Final simplification0.4
herbie shell --seed 2022081
(FPCore (x)
:name "expq2 (section 3.11)"
:precision binary64
:herbie-target
(/ 1.0 (- 1.0 (exp (- x))))
(/ (exp x) (- (exp x) 1.0)))