1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;y \leq -1355883538.5742614 \lor \neg \left(y \leq 2.1691322626487524 \cdot 10^{+66}\right):\\
\;\;\;\;1 - \log \left(\frac{-1}{y} + \left(\frac{x}{y \cdot y} + \frac{x}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(\frac{e}{1 - \frac{x - y}{1 - y}}\right)\\
\end{array}(FPCore (x y) :precision binary64 (- 1.0 (log (- 1.0 (/ (- x y) (- 1.0 y))))))
(FPCore (x y) :precision binary64 (if (or (<= y -1355883538.5742614) (not (<= y 2.1691322626487524e+66))) (- 1.0 (log (+ (/ -1.0 y) (+ (/ x (* y y)) (/ x y))))) (log (/ E (- 1.0 (/ (- x y) (- 1.0 y)))))))
double code(double x, double y) {
return 1.0 - log(1.0 - ((x - y) / (1.0 - y)));
}
double code(double x, double y) {
double tmp;
if ((y <= -1355883538.5742614) || !(y <= 2.1691322626487524e+66)) {
tmp = 1.0 - log((-1.0 / y) + ((x / (y * y)) + (x / y)));
} else {
tmp = log(((double) M_E) / (1.0 - ((x - y) / (1.0 - y))));
}
return tmp;
}




Bits error versus x




Bits error versus y
Results
| Original | 18.2 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
if y < -1355883538.57426143 or 2.16913226264875237e66 < y Initial program 48.4
Taylor expanded around inf 0.1
Simplified0.1
if -1355883538.57426143 < y < 2.16913226264875237e66Initial program 0.3
rmApplied add-log-exp_binary64_118140.3
Applied diff-log_binary64_118670.3
Simplified0.3
Final simplification0.2
herbie shell --seed 2020277
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, B"
:precision binary64
: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))))))