1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.99999804576706985:\\
\;\;\;\;1 - \log \left(1 - \left(x - y\right) \cdot \frac{1}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\left(\frac{1}{y} + 1\right) \cdot \frac{x}{y} - \frac{1}{y}\right)\\
\end{array}double f(double x, double y) {
double r443354 = 1.0;
double r443355 = x;
double r443356 = y;
double r443357 = r443355 - r443356;
double r443358 = r443354 - r443356;
double r443359 = r443357 / r443358;
double r443360 = r443354 - r443359;
double r443361 = log(r443360);
double r443362 = r443354 - r443361;
return r443362;
}
double f(double x, double y) {
double r443363 = x;
double r443364 = y;
double r443365 = r443363 - r443364;
double r443366 = 1.0;
double r443367 = r443366 - r443364;
double r443368 = r443365 / r443367;
double r443369 = 0.9999980457670699;
bool r443370 = r443368 <= r443369;
double r443371 = 1.0;
double r443372 = r443371 / r443367;
double r443373 = r443365 * r443372;
double r443374 = r443366 - r443373;
double r443375 = log(r443374);
double r443376 = r443366 - r443375;
double r443377 = r443366 / r443364;
double r443378 = r443377 + r443371;
double r443379 = r443363 / r443364;
double r443380 = r443378 * r443379;
double r443381 = r443380 - r443377;
double r443382 = log(r443381);
double r443383 = r443366 - r443382;
double r443384 = r443370 ? r443376 : r443383;
return r443384;
}




Bits error versus x




Bits error versus y
Results
| Original | 18.2 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
if (/ (- x y) (- 1.0 y)) < 0.9999980457670699Initial program 0.1
rmApplied div-inv0.1
if 0.9999980457670699 < (/ (- x y) (- 1.0 y)) Initial program 62.3
Taylor expanded around inf 0.3
Simplified0.3
Final simplification0.1
herbie shell --seed 2020042
(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))))))