1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;y \le -173788009.49411574 \lor \neg \left(y \le 98105251.590079397\right):\\
\;\;\;\;\log \left(\frac{e^{1}}{\mathsf{fma}\left(1, \frac{x}{{y}^{2}}, \frac{x}{y}\right) - \frac{1}{y}}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(1 - \frac{x - y}{1 - y}\right)\\
\end{array}double f(double x, double y) {
double r372413 = 1.0;
double r372414 = x;
double r372415 = y;
double r372416 = r372414 - r372415;
double r372417 = r372413 - r372415;
double r372418 = r372416 / r372417;
double r372419 = r372413 - r372418;
double r372420 = log(r372419);
double r372421 = r372413 - r372420;
return r372421;
}
double f(double x, double y) {
double r372422 = y;
double r372423 = -173788009.49411574;
bool r372424 = r372422 <= r372423;
double r372425 = 98105251.5900794;
bool r372426 = r372422 <= r372425;
double r372427 = !r372426;
bool r372428 = r372424 || r372427;
double r372429 = 1.0;
double r372430 = exp(r372429);
double r372431 = x;
double r372432 = 2.0;
double r372433 = pow(r372422, r372432);
double r372434 = r372431 / r372433;
double r372435 = r372431 / r372422;
double r372436 = fma(r372429, r372434, r372435);
double r372437 = r372429 / r372422;
double r372438 = r372436 - r372437;
double r372439 = r372430 / r372438;
double r372440 = log(r372439);
double r372441 = r372431 - r372422;
double r372442 = r372429 - r372422;
double r372443 = r372441 / r372442;
double r372444 = r372429 - r372443;
double r372445 = log(r372444);
double r372446 = r372429 - r372445;
double r372447 = r372428 ? r372440 : r372446;
return r372447;
}




Bits error versus x




Bits error versus y
| Original | 18.2 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
if y < -173788009.49411574 or 98105251.5900794 < y Initial program 47.1
rmApplied add-log-exp47.1
Applied diff-log47.1
Taylor expanded around inf 0.1
Simplified0.1
if -173788009.49411574 < y < 98105251.5900794Initial program 0.1
rmApplied add-log-exp0.1
Applied diff-log0.1
rmApplied log-div0.1
Simplified0.1
Final simplification0.1
herbie shell --seed 2020047 +o rules:numerics
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, B"
:precision binary64
:herbie-target
(if (< y -81284752.61947241) (- 1 (log (- (/ x (* y y)) (- (/ 1 y) (/ x y))))) (if (< y 3.0094271212461764e+25) (log (/ (exp 1) (- 1 (/ (- x y) (- 1 y))))) (- 1 (log (- (/ x (* y y)) (- (/ 1 y) (/ x y)))))))
(- 1 (log (- 1 (/ (- x y) (- 1 y))))))