1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.9999999604026631461195506744843441992998:\\
\;\;\;\;\log \left(\frac{e^{1}}{1 - \frac{x - y}{1 - y}}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\frac{x}{y} \cdot \left(\frac{1}{y} + 1\right) - \frac{1}{y}\right)\\
\end{array}double f(double x, double y) {
double r17115486 = 1.0;
double r17115487 = x;
double r17115488 = y;
double r17115489 = r17115487 - r17115488;
double r17115490 = r17115486 - r17115488;
double r17115491 = r17115489 / r17115490;
double r17115492 = r17115486 - r17115491;
double r17115493 = log(r17115492);
double r17115494 = r17115486 - r17115493;
return r17115494;
}
double f(double x, double y) {
double r17115495 = x;
double r17115496 = y;
double r17115497 = r17115495 - r17115496;
double r17115498 = 1.0;
double r17115499 = r17115498 - r17115496;
double r17115500 = r17115497 / r17115499;
double r17115501 = 0.9999999604026631;
bool r17115502 = r17115500 <= r17115501;
double r17115503 = exp(r17115498);
double r17115504 = r17115498 - r17115500;
double r17115505 = r17115503 / r17115504;
double r17115506 = log(r17115505);
double r17115507 = r17115495 / r17115496;
double r17115508 = r17115498 / r17115496;
double r17115509 = 1.0;
double r17115510 = r17115508 + r17115509;
double r17115511 = r17115507 * r17115510;
double r17115512 = r17115511 - r17115508;
double r17115513 = log(r17115512);
double r17115514 = r17115498 - r17115513;
double r17115515 = r17115502 ? r17115506 : r17115514;
return r17115515;
}




Bits error versus x




Bits error versus y
Results
| Original | 18.7 |
|---|---|
| Target | 0.1 |
| Herbie | 0.2 |
if (/ (- x y) (- 1.0 y)) < 0.9999999604026631Initial program 0.1
rmApplied add-log-exp0.1
Applied diff-log0.2
if 0.9999999604026631 < (/ (- x y) (- 1.0 y)) Initial program 62.5
Taylor expanded around inf 0.2
Simplified0.2
Final simplification0.2
herbie shell --seed 2019169
(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))))))