1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;y \le -119070188.93960175 \lor \neg \left(y \le 12232505.825313114\right):\\
\;\;\;\;1 - \log \left(\mathsf{fma}\left(1, \frac{x}{{y}^{2}} - \frac{1}{y}, \frac{x}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(1 - \left(x - y\right) \cdot \frac{1}{1 - y}\right)\\
\end{array}double f(double x, double y) {
double r449420 = 1.0;
double r449421 = x;
double r449422 = y;
double r449423 = r449421 - r449422;
double r449424 = r449420 - r449422;
double r449425 = r449423 / r449424;
double r449426 = r449420 - r449425;
double r449427 = log(r449426);
double r449428 = r449420 - r449427;
return r449428;
}
double f(double x, double y) {
double r449429 = y;
double r449430 = -119070188.93960175;
bool r449431 = r449429 <= r449430;
double r449432 = 12232505.825313114;
bool r449433 = r449429 <= r449432;
double r449434 = !r449433;
bool r449435 = r449431 || r449434;
double r449436 = 1.0;
double r449437 = x;
double r449438 = 2.0;
double r449439 = pow(r449429, r449438);
double r449440 = r449437 / r449439;
double r449441 = 1.0;
double r449442 = r449441 / r449429;
double r449443 = r449440 - r449442;
double r449444 = r449437 / r449429;
double r449445 = fma(r449436, r449443, r449444);
double r449446 = log(r449445);
double r449447 = r449436 - r449446;
double r449448 = r449437 - r449429;
double r449449 = r449436 - r449429;
double r449450 = r449441 / r449449;
double r449451 = r449448 * r449450;
double r449452 = r449436 - r449451;
double r449453 = log(r449452);
double r449454 = r449436 - r449453;
double r449455 = r449435 ? r449447 : r449454;
return r449455;
}




Bits error versus x




Bits error versus y
| Original | 18.1 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
if y < -119070188.93960175 or 12232505.825313114 < y Initial program 46.8
Taylor expanded around inf 0.1
Simplified0.1
if -119070188.93960175 < y < 12232505.825313114Initial program 0.1
rmApplied div-inv0.1
Final simplification0.1
herbie shell --seed 2020020 +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))))))