1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 1.537598818068412357583554970976054410148 \cdot 10^{-9}:\\
\;\;\;\;\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 r301506 = 1.0;
double r301507 = x;
double r301508 = y;
double r301509 = r301507 - r301508;
double r301510 = r301506 - r301508;
double r301511 = r301509 / r301510;
double r301512 = r301506 - r301511;
double r301513 = log(r301512);
double r301514 = r301506 - r301513;
return r301514;
}
double f(double x, double y) {
double r301515 = x;
double r301516 = y;
double r301517 = r301515 - r301516;
double r301518 = 1.0;
double r301519 = r301518 - r301516;
double r301520 = r301517 / r301519;
double r301521 = 1.5375988180684124e-09;
bool r301522 = r301520 <= r301521;
double r301523 = exp(r301518);
double r301524 = r301518 - r301520;
double r301525 = r301523 / r301524;
double r301526 = log(r301525);
double r301527 = r301518 * r301515;
double r301528 = r301516 * r301516;
double r301529 = r301527 / r301528;
double r301530 = r301515 / r301516;
double r301531 = r301518 / r301516;
double r301532 = r301530 - r301531;
double r301533 = r301529 + r301532;
double r301534 = r301523 / r301533;
double r301535 = log(r301534);
double r301536 = r301522 ? r301526 : r301535;
return r301536;
}




Bits error versus x




Bits error versus y
Results
| Original | 18.7 |
|---|---|
| Target | 0.1 |
| Herbie | 0.9 |
if (/ (- x y) (- 1.0 y)) < 1.5375988180684124e-09Initial program 0.0
rmApplied add-log-exp0.0
Applied diff-log0.0
if 1.5375988180684124e-09 < (/ (- x y) (- 1.0 y)) Initial program 59.1
rmApplied add-log-exp59.1
Applied diff-log59.1
Taylor expanded around inf 2.9
Simplified2.9
Final simplification0.9
herbie shell --seed 2019194
(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))))))