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 r319536 = 1.0;
double r319537 = x;
double r319538 = y;
double r319539 = r319537 - r319538;
double r319540 = r319536 - r319538;
double r319541 = r319539 / r319540;
double r319542 = r319536 - r319541;
double r319543 = log(r319542);
double r319544 = r319536 - r319543;
return r319544;
}
double f(double x, double y) {
double r319545 = x;
double r319546 = y;
double r319547 = r319545 - r319546;
double r319548 = 1.0;
double r319549 = r319548 - r319546;
double r319550 = r319547 / r319549;
double r319551 = 1.5375988180684124e-09;
bool r319552 = r319550 <= r319551;
double r319553 = exp(r319548);
double r319554 = r319548 - r319550;
double r319555 = r319553 / r319554;
double r319556 = log(r319555);
double r319557 = r319548 * r319545;
double r319558 = r319546 * r319546;
double r319559 = r319557 / r319558;
double r319560 = r319545 / r319546;
double r319561 = r319548 / r319546;
double r319562 = r319560 - r319561;
double r319563 = r319559 + r319562;
double r319564 = r319553 / r319563;
double r319565 = log(r319564);
double r319566 = r319552 ? r319556 : r319565;
return r319566;
}




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))))))