1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;y \le -270508391.61573327 \lor \neg \left(y \le 148253897.024537414\right):\\
\;\;\;\;\log \left(\frac{e^{1}}{\mathsf{fma}\left(1, \frac{x}{{y}^{2}} - \frac{1}{y}, \frac{x}{y}\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(\frac{e^{1}}{1 - \frac{x - y}{1 - y}}\right)\\
\end{array}double f(double x, double y) {
double r318048 = 1.0;
double r318049 = x;
double r318050 = y;
double r318051 = r318049 - r318050;
double r318052 = r318048 - r318050;
double r318053 = r318051 / r318052;
double r318054 = r318048 - r318053;
double r318055 = log(r318054);
double r318056 = r318048 - r318055;
return r318056;
}
double f(double x, double y) {
double r318057 = y;
double r318058 = -270508391.61573327;
bool r318059 = r318057 <= r318058;
double r318060 = 148253897.0245374;
bool r318061 = r318057 <= r318060;
double r318062 = !r318061;
bool r318063 = r318059 || r318062;
double r318064 = 1.0;
double r318065 = exp(r318064);
double r318066 = x;
double r318067 = 2.0;
double r318068 = pow(r318057, r318067);
double r318069 = r318066 / r318068;
double r318070 = 1.0;
double r318071 = r318070 / r318057;
double r318072 = r318069 - r318071;
double r318073 = r318066 / r318057;
double r318074 = fma(r318064, r318072, r318073);
double r318075 = r318065 / r318074;
double r318076 = log(r318075);
double r318077 = r318066 - r318057;
double r318078 = r318064 - r318057;
double r318079 = r318077 / r318078;
double r318080 = r318064 - r318079;
double r318081 = r318065 / r318080;
double r318082 = log(r318081);
double r318083 = r318063 ? r318076 : r318082;
return r318083;
}




Bits error versus x




Bits error versus y
| Original | 18.4 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
if y < -270508391.61573327 or 148253897.0245374 < y Initial program 47.3
rmApplied add-log-exp47.3
Applied diff-log47.3
Taylor expanded around inf 0.2
Simplified0.2
if -270508391.61573327 < y < 148253897.0245374Initial program 0.1
rmApplied add-log-exp0.1
Applied diff-log0.1
Final simplification0.1
herbie shell --seed 2020036 +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))))))