1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.5599263830433665:\\
\;\;\;\;\log \left(\frac{e^{1}}{1 - \frac{x - y}{1 - y}}\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(\frac{e^{1}}{1 \cdot \left(\frac{x}{{y}^{2}} - \frac{1}{y}\right) + \frac{x}{y}}\right)\\
\end{array}double f(double x, double y) {
double r428658 = 1.0;
double r428659 = x;
double r428660 = y;
double r428661 = r428659 - r428660;
double r428662 = r428658 - r428660;
double r428663 = r428661 / r428662;
double r428664 = r428658 - r428663;
double r428665 = log(r428664);
double r428666 = r428658 - r428665;
return r428666;
}
double f(double x, double y) {
double r428667 = x;
double r428668 = y;
double r428669 = r428667 - r428668;
double r428670 = 1.0;
double r428671 = r428670 - r428668;
double r428672 = r428669 / r428671;
double r428673 = 0.5599263830433665;
bool r428674 = r428672 <= r428673;
double r428675 = exp(r428670);
double r428676 = r428670 - r428672;
double r428677 = r428675 / r428676;
double r428678 = log(r428677);
double r428679 = 2.0;
double r428680 = pow(r428668, r428679);
double r428681 = r428667 / r428680;
double r428682 = 1.0;
double r428683 = r428682 / r428668;
double r428684 = r428681 - r428683;
double r428685 = r428670 * r428684;
double r428686 = r428667 / r428668;
double r428687 = r428685 + r428686;
double r428688 = r428675 / r428687;
double r428689 = log(r428688);
double r428690 = r428674 ? r428678 : r428689;
return r428690;
}




Bits error versus x




Bits error versus y
Results
| Original | 18.7 |
|---|---|
| Target | 0.1 |
| Herbie | 0.3 |
if (/ (- x y) (- 1.0 y)) < 0.5599263830433665Initial program 0.0
rmApplied add-log-exp0.0
Applied diff-log0.0
if 0.5599263830433665 < (/ (- x y) (- 1.0 y)) Initial program 61.4
rmApplied add-log-exp61.4
Applied diff-log61.4
Taylor expanded around inf 0.8
Simplified0.8
Final simplification0.3
herbie shell --seed 2020003
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, B"
:precision binary64
:herbie-target
(if (< y -81284752.61947241) (- 1 (log (- (/ x (* y y)) (- (/ 1 y) (/ x y))))) (if (< y 3.0094271212461764e+25) (log (/ (exp 1) (- 1 (/ (- x y) (- 1 y))))) (- 1 (log (- (/ x (* y y)) (- (/ 1 y) (/ x y)))))))
(- 1 (log (- 1 (/ (- x y) (- 1 y))))))