1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.9679400613876859571504951418319251388311:\\
\;\;\;\;\log \left(\frac{e^{1}}{1 - \frac{x - y}{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 r270937 = 1.0;
double r270938 = x;
double r270939 = y;
double r270940 = r270938 - r270939;
double r270941 = r270937 - r270939;
double r270942 = r270940 / r270941;
double r270943 = r270937 - r270942;
double r270944 = log(r270943);
double r270945 = r270937 - r270944;
return r270945;
}
double f(double x, double y) {
double r270946 = x;
double r270947 = y;
double r270948 = r270946 - r270947;
double r270949 = 1.0;
double r270950 = r270949 - r270947;
double r270951 = r270948 / r270950;
double r270952 = 0.967940061387686;
bool r270953 = r270951 <= r270952;
double r270954 = exp(r270949);
double r270955 = r270949 - r270951;
double r270956 = r270954 / r270955;
double r270957 = log(r270956);
double r270958 = 1.0;
double r270959 = r270949 / r270947;
double r270960 = r270958 + r270959;
double r270961 = r270946 / r270947;
double r270962 = r270960 * r270961;
double r270963 = r270962 - r270959;
double r270964 = log(r270963);
double r270965 = r270949 - r270964;
double r270966 = r270953 ? r270957 : r270965;
return r270966;
}




Bits error versus x




Bits error versus y
Results
| Original | 18.8 |
|---|---|
| Target | 0.1 |
| Herbie | 0.2 |
if (/ (- x y) (- 1.0 y)) < 0.967940061387686Initial program 0.0
rmApplied add-log-exp0.0
Applied diff-log0.0
if 0.967940061387686 < (/ (- x y) (- 1.0 y)) Initial program 61.9
Taylor expanded around inf 0.5
Simplified0.5
Final simplification0.2
herbie shell --seed 2019325
(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))))))