1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.99873833734014528:\\
\;\;\;\;1 - \log \left(1 - \left(x - y\right) \cdot \frac{1}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(1 \cdot \left(\frac{x}{{y}^{2}} - \frac{1}{y}\right) + \frac{x}{y}\right)\\
\end{array}double f(double x, double y) {
double r401528 = 1.0;
double r401529 = x;
double r401530 = y;
double r401531 = r401529 - r401530;
double r401532 = r401528 - r401530;
double r401533 = r401531 / r401532;
double r401534 = r401528 - r401533;
double r401535 = log(r401534);
double r401536 = r401528 - r401535;
return r401536;
}
double f(double x, double y) {
double r401537 = x;
double r401538 = y;
double r401539 = r401537 - r401538;
double r401540 = 1.0;
double r401541 = r401540 - r401538;
double r401542 = r401539 / r401541;
double r401543 = 0.9987383373401453;
bool r401544 = r401542 <= r401543;
double r401545 = 1.0;
double r401546 = r401545 / r401541;
double r401547 = r401539 * r401546;
double r401548 = r401540 - r401547;
double r401549 = log(r401548);
double r401550 = r401540 - r401549;
double r401551 = 2.0;
double r401552 = pow(r401538, r401551);
double r401553 = r401537 / r401552;
double r401554 = r401545 / r401538;
double r401555 = r401553 - r401554;
double r401556 = r401540 * r401555;
double r401557 = r401537 / r401538;
double r401558 = r401556 + r401557;
double r401559 = log(r401558);
double r401560 = r401540 - r401559;
double r401561 = r401544 ? r401550 : r401560;
return r401561;
}




Bits error versus x




Bits error versus y
Results
| Original | 18.3 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
if (/ (- x y) (- 1.0 y)) < 0.9987383373401453Initial program 0.0
rmApplied div-inv0.0
if 0.9987383373401453 < (/ (- x y) (- 1.0 y)) Initial program 61.9
Taylor expanded around inf 0.3
Simplified0.3
Final simplification0.1
herbie shell --seed 2020060
(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))))))