1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\begin{array}{l}
\mathbf{if}\;y \le -3.46847315426235216 \cdot 10^{42} \lor \neg \left(y \le 2.53588463642297086 \cdot 10^{46}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{y}, \frac{1}{y} - 1, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(\frac{y}{y \cdot y - 1 \cdot 1} \cdot \left(y - 1\right)\right), x - 1, 1\right)\\
\end{array}double f(double x, double y) {
double r644004 = 1.0;
double r644005 = x;
double r644006 = r644004 - r644005;
double r644007 = y;
double r644008 = r644006 * r644007;
double r644009 = r644007 + r644004;
double r644010 = r644008 / r644009;
double r644011 = r644004 - r644010;
return r644011;
}
double f(double x, double y) {
double r644012 = y;
double r644013 = -3.468473154262352e+42;
bool r644014 = r644012 <= r644013;
double r644015 = 2.535884636422971e+46;
bool r644016 = r644012 <= r644015;
double r644017 = !r644016;
bool r644018 = r644014 || r644017;
double r644019 = x;
double r644020 = r644019 / r644012;
double r644021 = 1.0;
double r644022 = r644021 / r644012;
double r644023 = r644022 - r644021;
double r644024 = fma(r644020, r644023, r644019);
double r644025 = 1.0;
double r644026 = r644012 * r644012;
double r644027 = r644021 * r644021;
double r644028 = r644026 - r644027;
double r644029 = r644012 / r644028;
double r644030 = r644012 - r644021;
double r644031 = r644029 * r644030;
double r644032 = r644025 * r644031;
double r644033 = r644019 - r644021;
double r644034 = fma(r644032, r644033, r644021);
double r644035 = r644018 ? r644024 : r644034;
return r644035;
}




Bits error versus x




Bits error versus y
| Original | 22.3 |
|---|---|
| Target | 0.2 |
| Herbie | 7.6 |
if y < -3.468473154262352e+42 or 2.535884636422971e+46 < y Initial program 47.9
Simplified29.4
Taylor expanded around inf 13.7
Simplified13.7
if -3.468473154262352e+42 < y < 2.535884636422971e+46Initial program 3.2
Simplified3.0
rmApplied *-un-lft-identity3.0
Applied *-un-lft-identity3.0
Applied times-frac3.0
Simplified3.0
rmApplied flip-+3.0
Applied associate-/r/3.0
Final simplification7.6
herbie shell --seed 2020081 +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))))