1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.9976104054069743209964826746727339923382:\\
\;\;\;\;\left(1 - \log \left(\sqrt{1 - \frac{x - y}{1 - y}}\right)\right) - \log \left(\sqrt{1 - \frac{x - y}{1 - y}}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\left(\frac{x}{y} + \frac{1 \cdot x}{y \cdot y}\right) - \frac{1}{y}\right)\\
\end{array}double f(double x, double y) {
double r317457 = 1.0;
double r317458 = x;
double r317459 = y;
double r317460 = r317458 - r317459;
double r317461 = r317457 - r317459;
double r317462 = r317460 / r317461;
double r317463 = r317457 - r317462;
double r317464 = log(r317463);
double r317465 = r317457 - r317464;
return r317465;
}
double f(double x, double y) {
double r317466 = x;
double r317467 = y;
double r317468 = r317466 - r317467;
double r317469 = 1.0;
double r317470 = r317469 - r317467;
double r317471 = r317468 / r317470;
double r317472 = 0.9976104054069743;
bool r317473 = r317471 <= r317472;
double r317474 = r317469 - r317471;
double r317475 = sqrt(r317474);
double r317476 = log(r317475);
double r317477 = r317469 - r317476;
double r317478 = r317477 - r317476;
double r317479 = r317466 / r317467;
double r317480 = r317469 * r317466;
double r317481 = r317467 * r317467;
double r317482 = r317480 / r317481;
double r317483 = r317479 + r317482;
double r317484 = r317469 / r317467;
double r317485 = r317483 - r317484;
double r317486 = log(r317485);
double r317487 = r317469 - r317486;
double r317488 = r317473 ? r317478 : r317487;
return r317488;
}




Bits error versus x




Bits error versus y
Results
| Original | 17.8 |
|---|---|
| Target | 0.1 |
| Herbie | 0.2 |
if (/ (- x y) (- 1.0 y)) < 0.9976104054069743Initial program 0.0
rmApplied add-sqr-sqrt0.1
Applied log-prod0.1
Applied associate--r+0.1
if 0.9976104054069743 < (/ (- x y) (- 1.0 y)) Initial program 61.6
rmApplied flip--57.0
Applied associate-/r/56.3
Simplified60.1
Taylor expanded around inf 0.5
Simplified0.5
Final simplification0.2
herbie shell --seed 2019195
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, B"
:herbie-target
(if (< y -81284752.61947241) (- 1.0 (log (- (/ x (* y y)) (- (/ 1.0 y) (/ x y))))) (if (< y 3.0094271212461764e+25) (log (/ (exp 1.0) (- 1.0 (/ (- x y) (- 1.0 y))))) (- 1.0 (log (- (/ x (* y y)) (- (/ 1.0 y) (/ x y)))))))
(- 1.0 (log (- 1.0 (/ (- x y) (- 1.0 y))))))