1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;1 - \frac{x - y}{1 - y} \le 4.669598041573408409021794795989990234375 \cdot 10^{-13}:\\
\;\;\;\;1 - \log \left(\left(1 + \frac{1}{y}\right) \cdot \frac{x}{y} - \frac{1}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \left(\log \left(\sqrt{1 - \frac{x - y}{1 - y}}\right) + \log \left(\sqrt{1 - \frac{x - y}{1 - y}}\right)\right)\\
\end{array}double f(double x, double y) {
double r284331 = 1.0;
double r284332 = x;
double r284333 = y;
double r284334 = r284332 - r284333;
double r284335 = r284331 - r284333;
double r284336 = r284334 / r284335;
double r284337 = r284331 - r284336;
double r284338 = log(r284337);
double r284339 = r284331 - r284338;
return r284339;
}
double f(double x, double y) {
double r284340 = 1.0;
double r284341 = x;
double r284342 = y;
double r284343 = r284341 - r284342;
double r284344 = r284340 - r284342;
double r284345 = r284343 / r284344;
double r284346 = r284340 - r284345;
double r284347 = 4.669598041573408e-13;
bool r284348 = r284346 <= r284347;
double r284349 = 1.0;
double r284350 = r284340 / r284342;
double r284351 = r284349 + r284350;
double r284352 = r284341 / r284342;
double r284353 = r284351 * r284352;
double r284354 = r284353 - r284350;
double r284355 = log(r284354);
double r284356 = r284340 - r284355;
double r284357 = sqrt(r284346);
double r284358 = log(r284357);
double r284359 = r284358 + r284358;
double r284360 = r284340 - r284359;
double r284361 = r284348 ? r284356 : r284360;
return r284361;
}




Bits error versus x




Bits error versus y
Results
| Original | 18.2 |
|---|---|
| Target | 0.1 |
| Herbie | 0.3 |
if (- 1.0 (/ (- x y) (- 1.0 y))) < 4.669598041573408e-13Initial program 63.6
Taylor expanded around inf 0.0
Simplified0.0
if 4.669598041573408e-13 < (- 1.0 (/ (- x y) (- 1.0 y))) Initial program 0.3
rmApplied add-sqr-sqrt0.4
Applied log-prod0.4
Final simplification0.3
herbie shell --seed 2019326
(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))))))