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











Bits error versus x
Results
| Original | 41.0 |
|---|---|
| Target | 40.6 |
| Herbie | 0.8 |
| Alternative 1 | |
|---|---|
| Error | 1.0 |
| Cost | 7232 |
| Alternative 2 | |
|---|---|
| Error | 1.2 |
| Cost | 6976 |
| Alternative 3 | |
|---|---|
| Error | 1.6 |
| Cost | 6592 |
| Alternative 4 | |
|---|---|
| Error | 1.1 |
| Cost | 641 |
| Alternative 5 | |
|---|---|
| Error | 1.6 |
| Cost | 513 |
| Alternative 6 | |
|---|---|
| Error | 41.8 |
| Cost | 64 |
| Alternative 7 | |
|---|---|
| Error | 61.5 |
| Cost | 64 |

if x < -355.97752480991107Initial program 0.1
if -355.97752480991107 < x Initial program 61.4
Taylor expanded around 0 1.2
Simplified1.2
Simplified1.2
Final simplification0.8
herbie shell --seed 2021044
(FPCore (x)
:name "expq2 (section 3.11)"
:precision binary64
:herbie-target
(/ 1.0 (- 1.0 (exp (- x))))
(/ (exp x) (- (exp x) 1.0)))