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}:\\
\;\;\;\;\log \left(\frac{e^{1}}{\frac{1 \cdot x}{y \cdot y} + \left(\frac{x}{y} - \frac{1}{y}\right)}\right)\\
\end{array}double f(double x, double y) {
double r318674 = 1.0;
double r318675 = x;
double r318676 = y;
double r318677 = r318675 - r318676;
double r318678 = r318674 - r318676;
double r318679 = r318677 / r318678;
double r318680 = r318674 - r318679;
double r318681 = log(r318680);
double r318682 = r318674 - r318681;
return r318682;
}
double f(double x, double y) {
double r318683 = x;
double r318684 = y;
double r318685 = r318683 - r318684;
double r318686 = 1.0;
double r318687 = r318686 - r318684;
double r318688 = r318685 / r318687;
double r318689 = 0.9999636314526726;
bool r318690 = r318688 <= r318689;
double r318691 = exp(r318686);
double r318692 = r318686 - r318688;
double r318693 = r318691 / r318692;
double r318694 = log(r318693);
double r318695 = r318686 * r318683;
double r318696 = r318684 * r318684;
double r318697 = r318695 / r318696;
double r318698 = r318683 / r318684;
double r318699 = r318686 / r318684;
double r318700 = r318698 - r318699;
double r318701 = r318697 + r318700;
double r318702 = r318691 / r318701;
double r318703 = log(r318702);
double r318704 = r318690 ? r318694 : r318703;
return r318704;
}




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
rmApplied add-log-exp62.4
Applied diff-log62.4
Taylor expanded around inf 0.4
Simplified0.4
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))))))