1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;y \le -244170417.415870637 \lor \neg \left(y \le 39316813.46217899\right):\\
\;\;\;\;1 - \log \left(\mathsf{fma}\left(1, \frac{x}{{y}^{2}} - \frac{1}{y}, \frac{x}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\mathsf{expm1}\left(\mathsf{log1p}\left(1 - \frac{x - y}{1 - y}\right)\right)\right)\\
\end{array}double f(double x, double y) {
double r406531 = 1.0;
double r406532 = x;
double r406533 = y;
double r406534 = r406532 - r406533;
double r406535 = r406531 - r406533;
double r406536 = r406534 / r406535;
double r406537 = r406531 - r406536;
double r406538 = log(r406537);
double r406539 = r406531 - r406538;
return r406539;
}
double f(double x, double y) {
double r406540 = y;
double r406541 = -244170417.41587064;
bool r406542 = r406540 <= r406541;
double r406543 = 39316813.46217899;
bool r406544 = r406540 <= r406543;
double r406545 = !r406544;
bool r406546 = r406542 || r406545;
double r406547 = 1.0;
double r406548 = x;
double r406549 = 2.0;
double r406550 = pow(r406540, r406549);
double r406551 = r406548 / r406550;
double r406552 = 1.0;
double r406553 = r406552 / r406540;
double r406554 = r406551 - r406553;
double r406555 = r406548 / r406540;
double r406556 = fma(r406547, r406554, r406555);
double r406557 = log(r406556);
double r406558 = r406547 - r406557;
double r406559 = r406548 - r406540;
double r406560 = r406547 - r406540;
double r406561 = r406559 / r406560;
double r406562 = r406547 - r406561;
double r406563 = log1p(r406562);
double r406564 = expm1(r406563);
double r406565 = log(r406564);
double r406566 = r406547 - r406565;
double r406567 = r406546 ? r406558 : r406566;
return r406567;
}




Bits error versus x




Bits error versus y
| Original | 18.3 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
if y < -244170417.41587064 or 39316813.46217899 < y Initial program 46.4
Taylor expanded around inf 0.1
Simplified0.1
if -244170417.41587064 < y < 39316813.46217899Initial program 0.1
rmApplied expm1-log1p-u0.1
Final simplification0.1
herbie shell --seed 2020060 +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))))))