1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.999970095902279254573841171804815530777:\\
\;\;\;\;1 - \log \left(1 - \left(x - y\right) \cdot \frac{1}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\mathsf{fma}\left(1, \frac{x}{{y}^{2}}, \frac{x}{y}\right) - \frac{1}{y}\right)\\
\end{array}double f(double x, double y) {
double r256487 = 1.0;
double r256488 = x;
double r256489 = y;
double r256490 = r256488 - r256489;
double r256491 = r256487 - r256489;
double r256492 = r256490 / r256491;
double r256493 = r256487 - r256492;
double r256494 = log(r256493);
double r256495 = r256487 - r256494;
return r256495;
}
double f(double x, double y) {
double r256496 = x;
double r256497 = y;
double r256498 = r256496 - r256497;
double r256499 = 1.0;
double r256500 = r256499 - r256497;
double r256501 = r256498 / r256500;
double r256502 = 0.9999700959022793;
bool r256503 = r256501 <= r256502;
double r256504 = 1.0;
double r256505 = r256504 / r256500;
double r256506 = r256498 * r256505;
double r256507 = r256499 - r256506;
double r256508 = log(r256507);
double r256509 = r256499 - r256508;
double r256510 = 2.0;
double r256511 = pow(r256497, r256510);
double r256512 = r256496 / r256511;
double r256513 = r256496 / r256497;
double r256514 = fma(r256499, r256512, r256513);
double r256515 = r256499 / r256497;
double r256516 = r256514 - r256515;
double r256517 = log(r256516);
double r256518 = r256499 - r256517;
double r256519 = r256503 ? r256509 : r256518;
return r256519;
}




Bits error versus x




Bits error versus y
| Original | 18.9 |
|---|---|
| Target | 0.1 |
| Herbie | 0.2 |
if (/ (- x y) (- 1.0 y)) < 0.9999700959022793Initial program 0.1
rmApplied div-inv0.1
if 0.9999700959022793 < (/ (- x y) (- 1.0 y)) Initial program 62.4
Taylor expanded around inf 0.4
Simplified0.4
Final simplification0.2
herbie shell --seed 2019235 +o rules:numerics
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, B"
:precision binary64
:herbie-target
(if (< y -81284752.619472414) (- 1 (log (- (/ x (* y y)) (- (/ 1 y) (/ x y))))) (if (< y 3.0094271212461764e25) (log (/ (exp 1) (- 1 (/ (- x y) (- 1 y))))) (- 1 (log (- (/ x (* y y)) (- (/ 1 y) (/ x y)))))))
(- 1 (log (- 1 (/ (- x y) (- 1 y))))))