1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.999963631452672641053425195423187687993:\\
\;\;\;\;\log \left(\frac{e^{1}}{1 - \frac{x - y}{1 - y}}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\mathsf{fma}\left(\frac{1}{y}, \frac{x}{y}, \frac{x}{y} - \frac{1}{y}\right)\right)\\
\end{array}double f(double x, double y) {
double r16863407 = 1.0;
double r16863408 = x;
double r16863409 = y;
double r16863410 = r16863408 - r16863409;
double r16863411 = r16863407 - r16863409;
double r16863412 = r16863410 / r16863411;
double r16863413 = r16863407 - r16863412;
double r16863414 = log(r16863413);
double r16863415 = r16863407 - r16863414;
return r16863415;
}
double f(double x, double y) {
double r16863416 = x;
double r16863417 = y;
double r16863418 = r16863416 - r16863417;
double r16863419 = 1.0;
double r16863420 = r16863419 - r16863417;
double r16863421 = r16863418 / r16863420;
double r16863422 = 0.9999636314526726;
bool r16863423 = r16863421 <= r16863422;
double r16863424 = exp(r16863419);
double r16863425 = r16863419 - r16863421;
double r16863426 = r16863424 / r16863425;
double r16863427 = log(r16863426);
double r16863428 = r16863419 / r16863417;
double r16863429 = r16863416 / r16863417;
double r16863430 = r16863429 - r16863428;
double r16863431 = fma(r16863428, r16863429, r16863430);
double r16863432 = log(r16863431);
double r16863433 = r16863419 - r16863432;
double r16863434 = r16863423 ? r16863427 : r16863433;
return r16863434;
}




Bits error versus x




Bits error versus y
| Original | 18.4 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
if (/ (- x y) (- 1.0 y)) < 0.9999636314526726Initial program 0.1
rmApplied add-log-exp0.1
Applied diff-log0.1
if 0.9999636314526726 < (/ (- x y) (- 1.0 y)) Initial program 62.4
Taylor expanded around inf 0.3
Simplified0.3
Final simplification0.1
herbie shell --seed 2019179 +o rules:numerics
(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))))))