1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.9999999604026631461195506744843441992998:\\
\;\;\;\;\log \left(\frac{e^{1}}{1 - \frac{x - y}{1 - y}}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\mathsf{fma}\left(\frac{1}{y}, \frac{x}{y}, \frac{x}{y} - \frac{1}{y}\right)\right)\\
\end{array}double f(double x, double y) {
double r19460796 = 1.0;
double r19460797 = x;
double r19460798 = y;
double r19460799 = r19460797 - r19460798;
double r19460800 = r19460796 - r19460798;
double r19460801 = r19460799 / r19460800;
double r19460802 = r19460796 - r19460801;
double r19460803 = log(r19460802);
double r19460804 = r19460796 - r19460803;
return r19460804;
}
double f(double x, double y) {
double r19460805 = x;
double r19460806 = y;
double r19460807 = r19460805 - r19460806;
double r19460808 = 1.0;
double r19460809 = r19460808 - r19460806;
double r19460810 = r19460807 / r19460809;
double r19460811 = 0.9999999604026631;
bool r19460812 = r19460810 <= r19460811;
double r19460813 = exp(r19460808);
double r19460814 = r19460808 - r19460810;
double r19460815 = r19460813 / r19460814;
double r19460816 = log(r19460815);
double r19460817 = r19460808 / r19460806;
double r19460818 = r19460805 / r19460806;
double r19460819 = r19460818 - r19460817;
double r19460820 = fma(r19460817, r19460818, r19460819);
double r19460821 = log(r19460820);
double r19460822 = r19460808 - r19460821;
double r19460823 = r19460812 ? r19460816 : r19460822;
return r19460823;
}




Bits error versus x




Bits error versus y
| Original | 18.7 |
|---|---|
| Target | 0.1 |
| Herbie | 0.2 |
if (/ (- x y) (- 1.0 y)) < 0.9999999604026631Initial program 0.1
rmApplied add-log-exp0.1
Applied diff-log0.2
if 0.9999999604026631 < (/ (- x y) (- 1.0 y)) Initial program 62.5
Taylor expanded around inf 0.2
Simplified0.2
Final simplification0.2
herbie shell --seed 2019169 +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))))))