1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;1 - \frac{x - y}{1 - y} \le 4.669598041573408409021794795989990234375 \cdot 10^{-13}:\\
\;\;\;\;1 - \log \left(\left(1 + \frac{1}{y}\right) \cdot \frac{x}{y} - \frac{1}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \left(\log \left(\sqrt{1 - \frac{x - y}{1 - y}}\right) + \log \left(\sqrt{1 - \frac{x - y}{1 - y}}\right)\right)\\
\end{array}double f(double x, double y) {
double r221656 = 1.0;
double r221657 = x;
double r221658 = y;
double r221659 = r221657 - r221658;
double r221660 = r221656 - r221658;
double r221661 = r221659 / r221660;
double r221662 = r221656 - r221661;
double r221663 = log(r221662);
double r221664 = r221656 - r221663;
return r221664;
}
double f(double x, double y) {
double r221665 = 1.0;
double r221666 = x;
double r221667 = y;
double r221668 = r221666 - r221667;
double r221669 = r221665 - r221667;
double r221670 = r221668 / r221669;
double r221671 = r221665 - r221670;
double r221672 = 4.669598041573408e-13;
bool r221673 = r221671 <= r221672;
double r221674 = 1.0;
double r221675 = r221665 / r221667;
double r221676 = r221674 + r221675;
double r221677 = r221666 / r221667;
double r221678 = r221676 * r221677;
double r221679 = r221678 - r221675;
double r221680 = log(r221679);
double r221681 = r221665 - r221680;
double r221682 = sqrt(r221671);
double r221683 = log(r221682);
double r221684 = r221683 + r221683;
double r221685 = r221665 - r221684;
double r221686 = r221673 ? r221681 : r221685;
return r221686;
}




Bits error versus x




Bits error versus y
Results
| Original | 18.2 |
|---|---|
| Target | 0.1 |
| Herbie | 0.3 |
if (- 1.0 (/ (- x y) (- 1.0 y))) < 4.669598041573408e-13Initial program 63.6
Taylor expanded around inf 0.0
Simplified0.0
if 4.669598041573408e-13 < (- 1.0 (/ (- x y) (- 1.0 y))) Initial program 0.3
rmApplied add-sqr-sqrt0.4
Applied log-prod0.4
Final simplification0.3
herbie shell --seed 2019326
(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))))))