1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.99999804576706985:\\
\;\;\;\;1 - \log \left(1 - \left(x - y\right) \cdot \frac{1}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\left(1 + \frac{1}{y}\right) \cdot \frac{x}{y} - \frac{1}{y}\right)\\
\end{array}double f(double x, double y) {
double r413723 = 1.0;
double r413724 = x;
double r413725 = y;
double r413726 = r413724 - r413725;
double r413727 = r413723 - r413725;
double r413728 = r413726 / r413727;
double r413729 = r413723 - r413728;
double r413730 = log(r413729);
double r413731 = r413723 - r413730;
return r413731;
}
double f(double x, double y) {
double r413732 = x;
double r413733 = y;
double r413734 = r413732 - r413733;
double r413735 = 1.0;
double r413736 = r413735 - r413733;
double r413737 = r413734 / r413736;
double r413738 = 0.9999980457670699;
bool r413739 = r413737 <= r413738;
double r413740 = 1.0;
double r413741 = r413740 / r413736;
double r413742 = r413734 * r413741;
double r413743 = r413735 - r413742;
double r413744 = log(r413743);
double r413745 = r413735 - r413744;
double r413746 = r413735 / r413733;
double r413747 = r413740 + r413746;
double r413748 = r413732 / r413733;
double r413749 = r413747 * r413748;
double r413750 = r413749 - r413746;
double r413751 = log(r413750);
double r413752 = r413735 - r413751;
double r413753 = r413739 ? r413745 : r413752;
return r413753;
}




Bits error versus x




Bits error versus y
Results
| Original | 18.2 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
if (/ (- x y) (- 1.0 y)) < 0.9999980457670699Initial program 0.1
rmApplied div-inv0.1
if 0.9999980457670699 < (/ (- x y) (- 1.0 y)) Initial program 62.3
rmApplied div-inv60.8
Taylor expanded around inf 0.3
Simplified0.3
Final simplification0.1
herbie shell --seed 2020042 +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))))))