1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.941146194758038734:\\
\;\;\;\;1 - \log \left(1 - \left(x - y\right) \cdot \frac{1}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\mathsf{fma}\left(1, \frac{x}{{y}^{2}}, \frac{x}{y}\right) - \frac{1}{y}\right)\\
\end{array}double f(double x, double y) {
double r343576 = 1.0;
double r343577 = x;
double r343578 = y;
double r343579 = r343577 - r343578;
double r343580 = r343576 - r343578;
double r343581 = r343579 / r343580;
double r343582 = r343576 - r343581;
double r343583 = log(r343582);
double r343584 = r343576 - r343583;
return r343584;
}
double f(double x, double y) {
double r343585 = x;
double r343586 = y;
double r343587 = r343585 - r343586;
double r343588 = 1.0;
double r343589 = r343588 - r343586;
double r343590 = r343587 / r343589;
double r343591 = 0.9411461947580387;
bool r343592 = r343590 <= r343591;
double r343593 = 1.0;
double r343594 = r343593 / r343589;
double r343595 = r343587 * r343594;
double r343596 = r343588 - r343595;
double r343597 = log(r343596);
double r343598 = r343588 - r343597;
double r343599 = 2.0;
double r343600 = pow(r343586, r343599);
double r343601 = r343585 / r343600;
double r343602 = r343585 / r343586;
double r343603 = fma(r343588, r343601, r343602);
double r343604 = r343588 / r343586;
double r343605 = r343603 - r343604;
double r343606 = log(r343605);
double r343607 = r343588 - r343606;
double r343608 = r343592 ? r343598 : r343607;
return r343608;
}




Bits error versus x




Bits error versus y
| Original | 18.4 |
|---|---|
| Target | 0.1 |
| Herbie | 0.2 |
if (/ (- x y) (- 1.0 y)) < 0.9411461947580387Initial program 0.0
rmApplied div-inv0.0
if 0.9411461947580387 < (/ (- x y) (- 1.0 y)) Initial program 61.4
rmApplied div-inv60.0
Taylor expanded around inf 0.7
Simplified0.7
Final simplification0.2
herbie shell --seed 2020045 +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))))))