\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}\;\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} = -inf.0:\\
\;\;\;\;z - y \cdot \frac{b}{\left(x + t\right) + y}\\
\mathbf{elif}\;\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \le 3.886814377443112 \cdot 10^{284}:\\
\;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y \cdot b}{\left(x + t\right) + y}\\
\mathbf{else}:\\
\;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\
\end{array}double code(double x, double y, double z, double t, double a, double b) {
return ((double) (((double) (((double) (((double) (((double) (x + y)) * z)) + ((double) (((double) (t + y)) * a)))) - ((double) (y * b)))) / ((double) (((double) (x + t)) + y))));
}
double code(double x, double y, double z, double t, double a, double b) {
double VAR;
if ((((double) (((double) (((double) (((double) (((double) (x + y)) * z)) + ((double) (((double) (t + y)) * a)))) - ((double) (y * b)))) / ((double) (((double) (x + t)) + y)))) <= -inf.0)) {
VAR = ((double) (z - ((double) (y * ((double) (b / ((double) (((double) (x + t)) + y))))))));
} else {
double VAR_1;
if ((((double) (((double) (((double) (((double) (((double) (x + y)) * z)) + ((double) (((double) (t + y)) * a)))) - ((double) (y * b)))) / ((double) (((double) (x + t)) + y)))) <= 3.886814377443112e+284)) {
VAR_1 = ((double) (((double) (((double) (((double) (((double) (x + y)) * z)) + ((double) (((double) (t + y)) * a)))) / ((double) (((double) (x + t)) + y)))) - ((double) (((double) (y * b)) / ((double) (((double) (x + t)) + y))))));
} else {
VAR_1 = ((double) (a - ((double) (y * ((double) (b / ((double) (((double) (x + t)) + y))))))));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a




Bits error versus b
Results
| Original | 26.8 |
|---|---|
| Target | 11.5 |
| Herbie | 12.1 |
if (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) < -inf.0Initial program 64.0
rmApplied div-sub64.0
rmApplied *-un-lft-identity64.0
Applied times-frac54.0
Simplified54.0
Taylor expanded around inf 28.8
if -inf.0 < (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) < 3.886814377443112e+284Initial program 0.2
rmApplied div-sub0.2
if 3.886814377443112e+284 < (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) Initial program 62.8
rmApplied div-sub62.8
rmApplied *-un-lft-identity62.8
Applied times-frac56.2
Simplified56.2
Taylor expanded around 0 28.3
Final simplification12.1
herbie shell --seed 2020147
(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.5813117084150564e+153) (- (+ z a) b) (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) 1.2285964308315609e+82) (/ 1.0 (/ (+ (+ 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)))