\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\begin{array}{l}
\mathbf{if}\;a \le -9.934676971669404208720627952544604223213 \cdot 10^{152}:\\
\;\;\;\;a\\
\mathbf{elif}\;a \le 1.254801113357911761699987310927986626165 \cdot 10^{126}:\\
\;\;\;\;\left(y + x\right) \cdot \frac{z}{t + \left(x + y\right)} + \frac{\mathsf{fma}\left(t, a, \left(a - b\right) \cdot y\right)}{t + \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}double f(double x, double y, double z, double t, double a, double b) {
double r646235 = x;
double r646236 = y;
double r646237 = r646235 + r646236;
double r646238 = z;
double r646239 = r646237 * r646238;
double r646240 = t;
double r646241 = r646240 + r646236;
double r646242 = a;
double r646243 = r646241 * r646242;
double r646244 = r646239 + r646243;
double r646245 = b;
double r646246 = r646236 * r646245;
double r646247 = r646244 - r646246;
double r646248 = r646235 + r646240;
double r646249 = r646248 + r646236;
double r646250 = r646247 / r646249;
return r646250;
}
double f(double x, double y, double z, double t, double a, double b) {
double r646251 = a;
double r646252 = -9.934676971669404e+152;
bool r646253 = r646251 <= r646252;
double r646254 = 1.2548011133579118e+126;
bool r646255 = r646251 <= r646254;
double r646256 = y;
double r646257 = x;
double r646258 = r646256 + r646257;
double r646259 = z;
double r646260 = t;
double r646261 = r646257 + r646256;
double r646262 = r646260 + r646261;
double r646263 = r646259 / r646262;
double r646264 = r646258 * r646263;
double r646265 = b;
double r646266 = r646251 - r646265;
double r646267 = r646266 * r646256;
double r646268 = fma(r646260, r646251, r646267);
double r646269 = r646268 / r646262;
double r646270 = r646264 + r646269;
double r646271 = r646255 ? r646270 : r646251;
double r646272 = r646253 ? r646251 : r646271;
return r646272;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a




Bits error versus b
| Original | 26.1 |
|---|---|
| Target | 11.2 |
| Herbie | 18.1 |
if a < -9.934676971669404e+152 or 1.2548011133579118e+126 < a Initial program 41.1
Simplified41.1
Taylor expanded around 0 27.6
if -9.934676971669404e+152 < a < 1.2548011133579118e+126Initial program 20.3
Simplified20.3
rmApplied add-cube-cbrt20.5
Applied add-cube-cbrt20.6
Applied prod-diff20.6
Applied distribute-lft-in20.6
Simplified20.4
Simplified20.4
rmApplied clear-num20.5
Simplified20.4
rmApplied div-inv20.5
Applied add-cube-cbrt20.5
Applied times-frac20.5
Simplified20.5
Simplified20.4
rmApplied fma-udef20.4
Applied distribute-lft-in20.4
Simplified14.4
Simplified14.3
Final simplification18.1
herbie shell --seed 2019212 +o rules:numerics
(FPCore (x y z t a b)
:name "AI.Clustering.Hierarchical.Internal:ward from clustering-0.2.1"
:precision binary64
:herbie-target
(if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) -3.5813117084150564e153) (- (+ z a) b) (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) 1.2285964308315609e82) (/ 1 (/ (+ (+ x t) y) (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)))) (- (+ z a) b)))
(/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))