1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.9999845807224782001654261875955853611231:\\
\;\;\;\;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 r289297 = 1.0;
double r289298 = x;
double r289299 = y;
double r289300 = r289298 - r289299;
double r289301 = r289297 - r289299;
double r289302 = r289300 / r289301;
double r289303 = r289297 - r289302;
double r289304 = log(r289303);
double r289305 = r289297 - r289304;
return r289305;
}
double f(double x, double y) {
double r289306 = x;
double r289307 = y;
double r289308 = r289306 - r289307;
double r289309 = 1.0;
double r289310 = r289309 - r289307;
double r289311 = r289308 / r289310;
double r289312 = 0.9999845807224782;
bool r289313 = r289311 <= r289312;
double r289314 = 1.0;
double r289315 = r289314 / r289310;
double r289316 = r289308 * r289315;
double r289317 = r289309 - r289316;
double r289318 = log(r289317);
double r289319 = r289309 - r289318;
double r289320 = r289309 / r289307;
double r289321 = r289320 + r289314;
double r289322 = r289306 / r289307;
double r289323 = r289321 * r289322;
double r289324 = r289323 - r289320;
double r289325 = log(r289324);
double r289326 = r289309 - r289325;
double r289327 = r289313 ? r289319 : r289326;
return r289327;
}




Bits error versus x




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