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}}{\left(\frac{x}{y} \cdot \frac{1.0}{y} - \frac{1.0}{y}\right) + \frac{x}{y}}\right)\\
\end{array}double f(double x, double y) {
double r8169375 = 1.0;
double r8169376 = x;
double r8169377 = y;
double r8169378 = r8169376 - r8169377;
double r8169379 = r8169375 - r8169377;
double r8169380 = r8169378 / r8169379;
double r8169381 = r8169375 - r8169380;
double r8169382 = log(r8169381);
double r8169383 = r8169375 - r8169382;
return r8169383;
}
double f(double x, double y) {
double r8169384 = x;
double r8169385 = y;
double r8169386 = r8169384 - r8169385;
double r8169387 = 1.0;
double r8169388 = r8169387 - r8169385;
double r8169389 = r8169386 / r8169388;
double r8169390 = 0.5242927222148749;
bool r8169391 = r8169389 <= r8169390;
double r8169392 = exp(r8169387);
double r8169393 = r8169387 - r8169389;
double r8169394 = r8169392 / r8169393;
double r8169395 = log(r8169394);
double r8169396 = r8169384 / r8169385;
double r8169397 = r8169387 / r8169385;
double r8169398 = r8169396 * r8169397;
double r8169399 = r8169398 - r8169397;
double r8169400 = r8169399 + r8169396;
double r8169401 = r8169392 / r8169400;
double r8169402 = log(r8169401);
double r8169403 = r8169391 ? r8169395 : r8169402;
return r8169403;
}




Bits error versus x




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