1.0 - \log \left(1.0 - \frac{x - y}{1.0 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1.0 - y} \le 0.9999999625628327:\\
\;\;\;\;\log \left(\frac{e^{1.0}}{1.0 - \frac{x - y}{1.0 - y}}\right)\\
\mathbf{else}:\\
\;\;\;\;1.0 - \log \left(\mathsf{fma}\left(\frac{x}{y}, \frac{1.0}{y}, \frac{x}{y} - \frac{1.0}{y}\right)\right)\\
\end{array}double f(double x, double y) {
double r15361885 = 1.0;
double r15361886 = x;
double r15361887 = y;
double r15361888 = r15361886 - r15361887;
double r15361889 = r15361885 - r15361887;
double r15361890 = r15361888 / r15361889;
double r15361891 = r15361885 - r15361890;
double r15361892 = log(r15361891);
double r15361893 = r15361885 - r15361892;
return r15361893;
}
double f(double x, double y) {
double r15361894 = x;
double r15361895 = y;
double r15361896 = r15361894 - r15361895;
double r15361897 = 1.0;
double r15361898 = r15361897 - r15361895;
double r15361899 = r15361896 / r15361898;
double r15361900 = 0.9999999625628327;
bool r15361901 = r15361899 <= r15361900;
double r15361902 = exp(r15361897);
double r15361903 = r15361897 - r15361899;
double r15361904 = r15361902 / r15361903;
double r15361905 = log(r15361904);
double r15361906 = r15361894 / r15361895;
double r15361907 = r15361897 / r15361895;
double r15361908 = r15361906 - r15361907;
double r15361909 = fma(r15361906, r15361907, r15361908);
double r15361910 = log(r15361909);
double r15361911 = r15361897 - r15361910;
double r15361912 = r15361901 ? r15361905 : r15361911;
return r15361912;
}




Bits error versus x




Bits error versus y
| Original | 18.3 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
if (/ (- x y) (- 1.0 y)) < 0.9999999625628327Initial program 0.1
rmApplied add-log-exp0.1
Applied diff-log0.1
if 0.9999999625628327 < (/ (- x y) (- 1.0 y)) Initial program 60.9
Taylor expanded around inf 0.1
Simplified0.1
Final simplification0.1
herbie shell --seed 2019168 +o rules:numerics
(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))))))