1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.99873833734014528:\\
\;\;\;\;1 - \log \left(1 - \left(x - y\right) \cdot \frac{1}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(1 \cdot \left(\frac{x}{{y}^{2}} - \frac{1}{y}\right) + \frac{x}{y}\right)\\
\end{array}double f(double x, double y) {
double r492317 = 1.0;
double r492318 = x;
double r492319 = y;
double r492320 = r492318 - r492319;
double r492321 = r492317 - r492319;
double r492322 = r492320 / r492321;
double r492323 = r492317 - r492322;
double r492324 = log(r492323);
double r492325 = r492317 - r492324;
return r492325;
}
double f(double x, double y) {
double r492326 = x;
double r492327 = y;
double r492328 = r492326 - r492327;
double r492329 = 1.0;
double r492330 = r492329 - r492327;
double r492331 = r492328 / r492330;
double r492332 = 0.9987383373401453;
bool r492333 = r492331 <= r492332;
double r492334 = 1.0;
double r492335 = r492334 / r492330;
double r492336 = r492328 * r492335;
double r492337 = r492329 - r492336;
double r492338 = log(r492337);
double r492339 = r492329 - r492338;
double r492340 = 2.0;
double r492341 = pow(r492327, r492340);
double r492342 = r492326 / r492341;
double r492343 = r492334 / r492327;
double r492344 = r492342 - r492343;
double r492345 = r492329 * r492344;
double r492346 = r492326 / r492327;
double r492347 = r492345 + r492346;
double r492348 = log(r492347);
double r492349 = r492329 - r492348;
double r492350 = r492333 ? r492339 : r492349;
return r492350;
}




Bits error versus x




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