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(\frac{1}{y} + 1\right) \cdot \frac{x}{y} - \frac{1}{y}\right)\\
\end{array}double f(double x, double y) {
double r652995 = 1.0;
double r652996 = x;
double r652997 = y;
double r652998 = r652996 - r652997;
double r652999 = r652995 - r652997;
double r653000 = r652998 / r652999;
double r653001 = r652995 - r653000;
double r653002 = log(r653001);
double r653003 = r652995 - r653002;
return r653003;
}
double f(double x, double y) {
double r653004 = x;
double r653005 = y;
double r653006 = r653004 - r653005;
double r653007 = 1.0;
double r653008 = r653007 - r653005;
double r653009 = r653006 / r653008;
double r653010 = 0.9999980457670699;
bool r653011 = r653009 <= r653010;
double r653012 = 1.0;
double r653013 = r653012 / r653008;
double r653014 = r653006 * r653013;
double r653015 = r653007 - r653014;
double r653016 = log(r653015);
double r653017 = r653007 - r653016;
double r653018 = r653007 / r653005;
double r653019 = r653018 + r653012;
double r653020 = r653004 / r653005;
double r653021 = r653019 * r653020;
double r653022 = r653021 - r653018;
double r653023 = log(r653022);
double r653024 = r653007 - r653023;
double r653025 = r653011 ? r653017 : r653024;
return r653025;
}




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
Taylor expanded around inf 0.3
Simplified0.3
Final simplification0.1
herbie shell --seed 2020042
(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))))))