1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\begin{array}{l}
\mathbf{if}\;y \le -13972044976917.6426 \lor \neg \left(y \le 10613960846537648\right):\\
\;\;\;\;\mathsf{fma}\left(1, \frac{x}{{y}^{2}} - \frac{x}{y}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x - 1\right) \cdot y}{y + 1} + 1\\
\end{array}double f(double x, double y) {
double r615572 = 1.0;
double r615573 = x;
double r615574 = r615572 - r615573;
double r615575 = y;
double r615576 = r615574 * r615575;
double r615577 = r615575 + r615572;
double r615578 = r615576 / r615577;
double r615579 = r615572 - r615578;
return r615579;
}
double f(double x, double y) {
double r615580 = y;
double r615581 = -13972044976917.643;
bool r615582 = r615580 <= r615581;
double r615583 = 10613960846537648.0;
bool r615584 = r615580 <= r615583;
double r615585 = !r615584;
bool r615586 = r615582 || r615585;
double r615587 = 1.0;
double r615588 = x;
double r615589 = 2.0;
double r615590 = pow(r615580, r615589);
double r615591 = r615588 / r615590;
double r615592 = r615588 / r615580;
double r615593 = r615591 - r615592;
double r615594 = fma(r615587, r615593, r615588);
double r615595 = r615588 - r615587;
double r615596 = r615595 * r615580;
double r615597 = r615580 + r615587;
double r615598 = r615596 / r615597;
double r615599 = r615598 + r615587;
double r615600 = r615586 ? r615594 : r615599;
return r615600;
}




Bits error versus x




Bits error versus y
| Original | 22.3 |
|---|---|
| Target | 0.2 |
| Herbie | 7.4 |
if y < -13972044976917.643 or 10613960846537648.0 < y Initial program 46.7
Simplified29.5
rmApplied add-cube-cbrt30.3
Applied associate-/r*30.3
Taylor expanded around inf 15.1
Simplified15.1
if -13972044976917.643 < y < 10613960846537648.0Initial program 0.5
Simplified0.5
rmApplied add-cube-cbrt0.6
Applied associate-/r*0.6
rmApplied fma-udef0.6
Simplified0.5
Final simplification7.4
herbie shell --seed 2020100 +o rules:numerics
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, D"
:precision binary64
:herbie-target
(if (< y -3693.8482788297247) (- (/ 1 y) (- (/ x y) x)) (if (< y 6799310503.41891) (- 1 (/ (* (- 1 x) y) (+ y 1))) (- (/ 1 y) (- (/ x y) x))))
(- 1 (/ (* (- 1 x) y) (+ y 1))))