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




Bits error versus x
Results
| Original | 39.9 |
|---|---|
| Target | 40.3 |
| Herbie | 0.3 |
if x < -1.39024268186127917e-4Initial program 0.1
rmApplied add-log-exp_binary640.1
Applied add-log-exp_binary640.1
Applied diff-log_binary640.1
Simplified0.1
if -1.39024268186127917e-4 < x Initial program 60.0
Taylor expanded around 0 0.4
Simplified0.4
rmApplied add-log-exp_binary640.4
Simplified0.4
Final simplification0.3
herbie shell --seed 2020204
(FPCore (x)
:name "Kahan's exp quotient"
:precision binary64
:herbie-target
(if (and (< x 1.0) (> x -1.0)) (/ (- (exp x) 1.0) (log (exp x))) (/ (- (exp x) 1.0) x))
(/ (- (exp x) 1.0) x))