1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;y \le -166149344.053797900676727294921875:\\
\;\;\;\;1 - \log \left(\left(1 + \frac{1}{y}\right) \cdot \frac{x}{y} - \frac{1}{y}\right)\\
\mathbf{elif}\;y \le 89236118.13017952442169189453125:\\
\;\;\;\;\left(1 - \log \left(\sqrt{1 - \frac{x - y}{1 - y}}\right)\right) - \log \left(1 - \frac{x - y}{1 - y}\right) \cdot \frac{1}{2}\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\left(1 + \frac{1}{y}\right) \cdot \frac{x}{y} - \frac{1}{y}\right)\\
\end{array}double f(double x, double y) {
double r18080537 = 1.0;
double r18080538 = x;
double r18080539 = y;
double r18080540 = r18080538 - r18080539;
double r18080541 = r18080537 - r18080539;
double r18080542 = r18080540 / r18080541;
double r18080543 = r18080537 - r18080542;
double r18080544 = log(r18080543);
double r18080545 = r18080537 - r18080544;
return r18080545;
}
double f(double x, double y) {
double r18080546 = y;
double r18080547 = -166149344.0537979;
bool r18080548 = r18080546 <= r18080547;
double r18080549 = 1.0;
double r18080550 = 1.0;
double r18080551 = r18080549 / r18080546;
double r18080552 = r18080550 + r18080551;
double r18080553 = x;
double r18080554 = r18080553 / r18080546;
double r18080555 = r18080552 * r18080554;
double r18080556 = r18080555 - r18080551;
double r18080557 = log(r18080556);
double r18080558 = r18080549 - r18080557;
double r18080559 = 89236118.13017952;
bool r18080560 = r18080546 <= r18080559;
double r18080561 = r18080553 - r18080546;
double r18080562 = r18080549 - r18080546;
double r18080563 = r18080561 / r18080562;
double r18080564 = r18080549 - r18080563;
double r18080565 = sqrt(r18080564);
double r18080566 = log(r18080565);
double r18080567 = r18080549 - r18080566;
double r18080568 = log(r18080564);
double r18080569 = 0.5;
double r18080570 = r18080568 * r18080569;
double r18080571 = r18080567 - r18080570;
double r18080572 = r18080560 ? r18080571 : r18080558;
double r18080573 = r18080548 ? r18080558 : r18080572;
return r18080573;
}




Bits error versus x




Bits error versus y
Results
| Original | 18.0 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
if y < -166149344.0537979 or 89236118.13017952 < y Initial program 46.3
Taylor expanded around inf 0.1
Simplified0.1
if -166149344.0537979 < y < 89236118.13017952Initial program 0.1
rmApplied add-sqr-sqrt0.1
Applied log-prod0.1
Applied associate--r+0.1
rmApplied pow1/20.1
Applied log-pow0.1
Final simplification0.1
herbie shell --seed 2019172
(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))))))