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(\left(\frac{1.0}{y} \cdot \frac{x}{y} - \frac{1.0}{y}\right) + \frac{x}{y}\right)\\
\end{array}double f(double x, double y) {
double r20202711 = 1.0;
double r20202712 = x;
double r20202713 = y;
double r20202714 = r20202712 - r20202713;
double r20202715 = r20202711 - r20202713;
double r20202716 = r20202714 / r20202715;
double r20202717 = r20202711 - r20202716;
double r20202718 = log(r20202717);
double r20202719 = r20202711 - r20202718;
return r20202719;
}
double f(double x, double y) {
double r20202720 = x;
double r20202721 = y;
double r20202722 = r20202720 - r20202721;
double r20202723 = 1.0;
double r20202724 = r20202723 - r20202721;
double r20202725 = r20202722 / r20202724;
double r20202726 = 0.9999999625628327;
bool r20202727 = r20202725 <= r20202726;
double r20202728 = exp(r20202723);
double r20202729 = r20202723 - r20202725;
double r20202730 = r20202728 / r20202729;
double r20202731 = log(r20202730);
double r20202732 = r20202723 / r20202721;
double r20202733 = r20202720 / r20202721;
double r20202734 = r20202732 * r20202733;
double r20202735 = r20202734 - r20202732;
double r20202736 = r20202735 + r20202733;
double r20202737 = log(r20202736);
double r20202738 = r20202723 - r20202737;
double r20202739 = r20202727 ? r20202731 : r20202738;
return r20202739;
}




Bits error versus x




Bits error versus y
Results
| 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
(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))))))