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.5242927222148749:\\
\;\;\;\;\log \left(\frac{e^{1.0}}{1.0 - \frac{x - y}{1.0 - y}}\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(\frac{e^{1.0}}{\mathsf{fma}\left(1.0, \frac{x}{y \cdot y}, \frac{x}{y}\right) - \frac{1.0}{y}}\right)\\
\end{array}double f(double x, double y) {
double r6020741 = 1.0;
double r6020742 = x;
double r6020743 = y;
double r6020744 = r6020742 - r6020743;
double r6020745 = r6020741 - r6020743;
double r6020746 = r6020744 / r6020745;
double r6020747 = r6020741 - r6020746;
double r6020748 = log(r6020747);
double r6020749 = r6020741 - r6020748;
return r6020749;
}
double f(double x, double y) {
double r6020750 = x;
double r6020751 = y;
double r6020752 = r6020750 - r6020751;
double r6020753 = 1.0;
double r6020754 = r6020753 - r6020751;
double r6020755 = r6020752 / r6020754;
double r6020756 = 0.5242927222148749;
bool r6020757 = r6020755 <= r6020756;
double r6020758 = exp(r6020753);
double r6020759 = r6020753 - r6020755;
double r6020760 = r6020758 / r6020759;
double r6020761 = log(r6020760);
double r6020762 = r6020751 * r6020751;
double r6020763 = r6020750 / r6020762;
double r6020764 = r6020750 / r6020751;
double r6020765 = fma(r6020753, r6020763, r6020764);
double r6020766 = r6020753 / r6020751;
double r6020767 = r6020765 - r6020766;
double r6020768 = r6020758 / r6020767;
double r6020769 = log(r6020768);
double r6020770 = r6020757 ? r6020761 : r6020769;
return r6020770;
}




Bits error versus x




Bits error versus y
| Original | 17.5 |
|---|---|
| Target | 0.1 |
| Herbie | 0.3 |
if (/ (- x y) (- 1.0 y)) < 0.5242927222148749Initial program 0.0
rmApplied add-log-exp0.0
Applied diff-log0.0
if 0.5242927222148749 < (/ (- x y) (- 1.0 y)) Initial program 59.0
rmApplied add-log-exp59.0
Applied diff-log59.0
Taylor expanded around inf 0.9
Simplified0.9
Final simplification0.3
herbie shell --seed 2019156 +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))))))