1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.999963631452672641053425195423187687993:\\
\;\;\;\;\log \left(\frac{e^{1}}{1 - \frac{x - y}{1 - y}}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\left(\frac{1 \cdot x}{y \cdot y} + \frac{x}{y}\right) - \frac{1}{y}\right)\\
\end{array}double f(double x, double y) {
double r7717882 = 1.0;
double r7717883 = x;
double r7717884 = y;
double r7717885 = r7717883 - r7717884;
double r7717886 = r7717882 - r7717884;
double r7717887 = r7717885 / r7717886;
double r7717888 = r7717882 - r7717887;
double r7717889 = log(r7717888);
double r7717890 = r7717882 - r7717889;
return r7717890;
}
double f(double x, double y) {
double r7717891 = x;
double r7717892 = y;
double r7717893 = r7717891 - r7717892;
double r7717894 = 1.0;
double r7717895 = r7717894 - r7717892;
double r7717896 = r7717893 / r7717895;
double r7717897 = 0.9999636314526726;
bool r7717898 = r7717896 <= r7717897;
double r7717899 = exp(r7717894);
double r7717900 = r7717894 - r7717896;
double r7717901 = r7717899 / r7717900;
double r7717902 = log(r7717901);
double r7717903 = r7717894 * r7717891;
double r7717904 = r7717892 * r7717892;
double r7717905 = r7717903 / r7717904;
double r7717906 = r7717891 / r7717892;
double r7717907 = r7717905 + r7717906;
double r7717908 = r7717894 / r7717892;
double r7717909 = r7717907 - r7717908;
double r7717910 = log(r7717909);
double r7717911 = r7717894 - r7717910;
double r7717912 = r7717898 ? r7717902 : r7717911;
return r7717912;
}




Bits error versus x




Bits error versus y
Results
| Original | 18.4 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
if (/ (- x y) (- 1.0 y)) < 0.9999636314526726Initial program 0.1
rmApplied add-log-exp0.1
Applied diff-log0.1
if 0.9999636314526726 < (/ (- x y) (- 1.0 y)) Initial program 62.4
Taylor expanded around inf 0.3
Simplified0.3
Final simplification0.1
herbie shell --seed 2019179
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, B"
:herbie-target
(if (< y -81284752.61947241) (- 1.0 (log (- (/ x (* y y)) (- (/ 1.0 y) (/ x y))))) (if (< y 3.0094271212461764e+25) (log (/ (exp 1.0) (- 1.0 (/ (- x y) (- 1.0 y))))) (- 1.0 (log (- (/ x (* y y)) (- (/ 1.0 y) (/ x y)))))))
(- 1.0 (log (- 1.0 (/ (- x y) (- 1.0 y))))))