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 r428919 = 1.0;
double r428920 = x;
double r428921 = y;
double r428922 = r428920 - r428921;
double r428923 = r428919 - r428921;
double r428924 = r428922 / r428923;
double r428925 = r428919 - r428924;
double r428926 = log(r428925);
double r428927 = r428919 - r428926;
return r428927;
}
double f(double x, double y) {
double r428928 = x;
double r428929 = y;
double r428930 = r428928 - r428929;
double r428931 = 1.0;
double r428932 = r428931 - r428929;
double r428933 = r428930 / r428932;
double r428934 = 0.9999980457670699;
bool r428935 = r428933 <= r428934;
double r428936 = 1.0;
double r428937 = r428936 / r428932;
double r428938 = r428930 * r428937;
double r428939 = r428931 - r428938;
double r428940 = log(r428939);
double r428941 = r428931 - r428940;
double r428942 = r428931 / r428929;
double r428943 = r428942 + r428936;
double r428944 = r428928 / r428929;
double r428945 = r428943 * r428944;
double r428946 = r428945 - r428942;
double r428947 = log(r428946);
double r428948 = r428931 - r428947;
double r428949 = r428935 ? r428941 : r428948;
return r428949;
}




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))))))