1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;y \le -119577009.99898484 \lor \neg \left(y \le 25589815.688386947\right):\\
\;\;\;\;\log \left(\frac{e^{1}}{\mathsf{fma}\left(1, \frac{x}{{y}^{2}} - \frac{1}{y}, \frac{x}{y}\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(1 - \left(x - y\right) \cdot \frac{1}{1 - y}\right)\\
\end{array}double f(double x, double y) {
double r349985 = 1.0;
double r349986 = x;
double r349987 = y;
double r349988 = r349986 - r349987;
double r349989 = r349985 - r349987;
double r349990 = r349988 / r349989;
double r349991 = r349985 - r349990;
double r349992 = log(r349991);
double r349993 = r349985 - r349992;
return r349993;
}
double f(double x, double y) {
double r349994 = y;
double r349995 = -119577009.99898484;
bool r349996 = r349994 <= r349995;
double r349997 = 25589815.688386947;
bool r349998 = r349994 <= r349997;
double r349999 = !r349998;
bool r350000 = r349996 || r349999;
double r350001 = 1.0;
double r350002 = exp(r350001);
double r350003 = x;
double r350004 = 2.0;
double r350005 = pow(r349994, r350004);
double r350006 = r350003 / r350005;
double r350007 = 1.0;
double r350008 = r350007 / r349994;
double r350009 = r350006 - r350008;
double r350010 = r350003 / r349994;
double r350011 = fma(r350001, r350009, r350010);
double r350012 = r350002 / r350011;
double r350013 = log(r350012);
double r350014 = r350003 - r349994;
double r350015 = r350001 - r349994;
double r350016 = r350007 / r350015;
double r350017 = r350014 * r350016;
double r350018 = r350001 - r350017;
double r350019 = log(r350018);
double r350020 = r350001 - r350019;
double r350021 = r350000 ? r350013 : r350020;
return r350021;
}




Bits error versus x




Bits error versus y
| Original | 18.5 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
if y < -119577009.99898484 or 25589815.688386947 < y Initial program 46.9
rmApplied add-log-exp46.9
Applied diff-log46.9
Taylor expanded around inf 0.2
Simplified0.2
if -119577009.99898484 < y < 25589815.688386947Initial program 0.1
rmApplied div-inv0.1
Final simplification0.1
herbie shell --seed 2020046 +o rules:numerics
(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))))))