1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;y \le -231188405.8267842233180999755859375 \lor \neg \left(y \le 6764068.6677209436893463134765625\right):\\
\;\;\;\;1 - \log \left(\left(1 + \frac{1}{y}\right) \cdot \frac{x}{y} - \frac{1}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(\frac{e^{1}}{1 - \frac{x - y}{1 - y}}\right)\\
\end{array}double f(double x, double y) {
double r327397 = 1.0;
double r327398 = x;
double r327399 = y;
double r327400 = r327398 - r327399;
double r327401 = r327397 - r327399;
double r327402 = r327400 / r327401;
double r327403 = r327397 - r327402;
double r327404 = log(r327403);
double r327405 = r327397 - r327404;
return r327405;
}
double f(double x, double y) {
double r327406 = y;
double r327407 = -231188405.82678422;
bool r327408 = r327406 <= r327407;
double r327409 = 6764068.667720944;
bool r327410 = r327406 <= r327409;
double r327411 = !r327410;
bool r327412 = r327408 || r327411;
double r327413 = 1.0;
double r327414 = 1.0;
double r327415 = r327413 / r327406;
double r327416 = r327414 + r327415;
double r327417 = x;
double r327418 = r327417 / r327406;
double r327419 = r327416 * r327418;
double r327420 = r327419 - r327415;
double r327421 = log(r327420);
double r327422 = r327413 - r327421;
double r327423 = exp(r327413);
double r327424 = r327417 - r327406;
double r327425 = r327413 - r327406;
double r327426 = r327424 / r327425;
double r327427 = r327413 - r327426;
double r327428 = r327423 / r327427;
double r327429 = log(r327428);
double r327430 = r327412 ? r327422 : r327429;
return r327430;
}




Bits error versus x




Bits error versus y
Results
| Original | 18.4 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
if y < -231188405.82678422 or 6764068.667720944 < y Initial program 47.1
Taylor expanded around inf 0.1
Simplified0.1
if -231188405.82678422 < y < 6764068.667720944Initial program 0.1
rmApplied add-log-exp0.1
Applied diff-log0.1
Final simplification0.1
herbie shell --seed 2019304
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, B"
:precision binary64
:herbie-target
(if (< y -81284752.619472414) (- 1 (log (- (/ x (* y y)) (- (/ 1 y) (/ x y))))) (if (< y 3.0094271212461764e25) (log (/ (exp 1) (- 1 (/ (- x y) (- 1 y))))) (- 1 (log (- (/ x (* y y)) (- (/ 1 y) (/ x y)))))))
(- 1 (log (- 1 (/ (- x y) (- 1 y))))))