\frac{e^{x} - 1}{x}\begin{array}{l}
\mathbf{if}\;x \le -1.484122271439908193491757915083439911541 \cdot 10^{-4}:\\
\;\;\;\;\frac{\log \left(e^{e^{x} - 1}\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{{x}^{2} \cdot \left(x \cdot \frac{1}{6} + \frac{1}{2}\right) + x}{x}\\
\end{array}double f(double x) {
double r46356 = x;
double r46357 = exp(r46356);
double r46358 = 1.0;
double r46359 = r46357 - r46358;
double r46360 = r46359 / r46356;
return r46360;
}
double f(double x) {
double r46361 = x;
double r46362 = -0.00014841222714399082;
bool r46363 = r46361 <= r46362;
double r46364 = exp(r46361);
double r46365 = 1.0;
double r46366 = r46364 - r46365;
double r46367 = exp(r46366);
double r46368 = log(r46367);
double r46369 = r46368 / r46361;
double r46370 = 2.0;
double r46371 = pow(r46361, r46370);
double r46372 = 0.16666666666666666;
double r46373 = r46361 * r46372;
double r46374 = 0.5;
double r46375 = r46373 + r46374;
double r46376 = r46371 * r46375;
double r46377 = r46376 + r46361;
double r46378 = r46377 / r46361;
double r46379 = r46363 ? r46369 : r46378;
return r46379;
}




Bits error versus x
Results
| Original | 39.8 |
|---|---|
| Target | 40.2 |
| Herbie | 0.3 |
if x < -0.00014841222714399082Initial program 0.0
rmApplied add-log-exp0.0
Applied add-log-exp0.0
Applied diff-log0.0
Simplified0.0
if -0.00014841222714399082 < x Initial program 60.2
Taylor expanded around 0 0.4
Simplified0.4
Final simplification0.3
herbie shell --seed 2019298
(FPCore (x)
:name "Kahan's exp quotient"
:precision binary64
:herbie-target
(if (and (< x 1) (> x -1)) (/ (- (exp x) 1) (log (exp x))) (/ (- (exp x) 1) x))
(/ (- (exp x) 1) x))