\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}\;z \leq -5.718654454912934 \cdot 10^{+211}:\\
\;\;\;\;z - y \cdot \frac{b}{x + \left(y + t\right)}\\
\mathbf{elif}\;z \leq -1.253386679833485 \cdot 10^{+174}:\\
\;\;\;\;\frac{z \cdot \left(y + x\right) + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - y \cdot \frac{b}{x + \left(y + t\right)}\\
\mathbf{elif}\;z \leq -1.4846978434193347 \cdot 10^{+133}:\\
\;\;\;\;z - y \cdot \frac{b}{x + \left(y + t\right)}\\
\mathbf{elif}\;z \leq -2.6301946553516078 \cdot 10^{+109}:\\
\;\;\;\;a - \frac{y}{\frac{x + \left(y + t\right)}{b}}\\
\mathbf{elif}\;z \leq -2.755837165222205 \cdot 10^{-86}:\\
\;\;\;\;\frac{z \cdot \left(y + x\right) + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - y \cdot \frac{b}{x + \left(y + t\right)}\\
\mathbf{elif}\;z \leq -2.857698796196673 \cdot 10^{-162}:\\
\;\;\;\;a - \frac{y}{\frac{x + \left(y + t\right)}{b}}\\
\mathbf{elif}\;z \leq -1.2409296858903545 \cdot 10^{-196}:\\
\;\;\;\;\frac{z \cdot \left(y + x\right) + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - y \cdot \frac{b}{x + \left(y + t\right)}\\
\mathbf{elif}\;z \leq -1.7458862711017074 \cdot 10^{-260}:\\
\;\;\;\;a - \frac{y}{\frac{x + \left(y + t\right)}{b}}\\
\mathbf{elif}\;z \leq -5.7955189878830535 \cdot 10^{-272}:\\
\;\;\;\;\left(\left(z \cdot \left(y + x\right) + \left(y + t\right) \cdot a\right) - y \cdot b\right) \cdot \frac{1}{x + \left(y + t\right)}\\
\mathbf{elif}\;z \leq 2.7687480808701386 \cdot 10^{+84}:\\
\;\;\;\;\frac{z \cdot \left(y + x\right) + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - y \cdot \frac{b}{x + \left(y + t\right)}\\
\mathbf{else}:\\
\;\;\;\;z - y \cdot \frac{b}{x + \left(y + t\right)}\\
\end{array}(FPCore (x y z t a b) :precision binary64 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
(FPCore (x y z t a b)
:precision binary64
(if (<= z -5.718654454912934e+211)
(- z (* y (/ b (+ x (+ y t)))))
(if (<= z -1.253386679833485e+174)
(-
(/ (+ (* z (+ y x)) (* (+ y t) a)) (+ x (+ y t)))
(* y (/ b (+ x (+ y t)))))
(if (<= z -1.4846978434193347e+133)
(- z (* y (/ b (+ x (+ y t)))))
(if (<= z -2.6301946553516078e+109)
(- a (/ y (/ (+ x (+ y t)) b)))
(if (<= z -2.755837165222205e-86)
(-
(/ (+ (* z (+ y x)) (* (+ y t) a)) (+ x (+ y t)))
(* y (/ b (+ x (+ y t)))))
(if (<= z -2.857698796196673e-162)
(- a (/ y (/ (+ x (+ y t)) b)))
(if (<= z -1.2409296858903545e-196)
(-
(/ (+ (* z (+ y x)) (* (+ y t) a)) (+ x (+ y t)))
(* y (/ b (+ x (+ y t)))))
(if (<= z -1.7458862711017074e-260)
(- a (/ y (/ (+ x (+ y t)) b)))
(if (<= z -5.7955189878830535e-272)
(*
(- (+ (* z (+ y x)) (* (+ y t) a)) (* y b))
(/ 1.0 (+ x (+ y t))))
(if (<= z 2.7687480808701386e+84)
(-
(/ (+ (* z (+ y x)) (* (+ y t) a)) (+ x (+ y t)))
(* y (/ b (+ x (+ y t)))))
(- z (* y (/ b (+ x (+ y t))))))))))))))))double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -5.718654454912934e+211) {
tmp = z - (y * (b / (x + (y + t))));
} else if (z <= -1.253386679833485e+174) {
tmp = (((z * (y + x)) + ((y + t) * a)) / (x + (y + t))) - (y * (b / (x + (y + t))));
} else if (z <= -1.4846978434193347e+133) {
tmp = z - (y * (b / (x + (y + t))));
} else if (z <= -2.6301946553516078e+109) {
tmp = a - (y / ((x + (y + t)) / b));
} else if (z <= -2.755837165222205e-86) {
tmp = (((z * (y + x)) + ((y + t) * a)) / (x + (y + t))) - (y * (b / (x + (y + t))));
} else if (z <= -2.857698796196673e-162) {
tmp = a - (y / ((x + (y + t)) / b));
} else if (z <= -1.2409296858903545e-196) {
tmp = (((z * (y + x)) + ((y + t) * a)) / (x + (y + t))) - (y * (b / (x + (y + t))));
} else if (z <= -1.7458862711017074e-260) {
tmp = a - (y / ((x + (y + t)) / b));
} else if (z <= -5.7955189878830535e-272) {
tmp = (((z * (y + x)) + ((y + t) * a)) - (y * b)) * (1.0 / (x + (y + t)));
} else if (z <= 2.7687480808701386e+84) {
tmp = (((z * (y + x)) + ((y + t) * a)) / (x + (y + t))) - (y * (b / (x + (y + t))));
} else {
tmp = z - (y * (b / (x + (y + t))));
}
return tmp;
}




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.3 |
| Herbie | 20.8 |
if z < -5.7186544549129338e211 or -1.25338667983348494e174 < z < -1.48469784341933467e133 or 2.76874808087013858e84 < z Initial program 41.2
rmApplied div-sub_binary6441.2
Simplified41.2
Simplified41.2
rmApplied *-un-lft-identity_binary6441.2
Applied times-frac_binary6441.6
Simplified41.6
Taylor expanded around inf 25.6
if -5.7186544549129338e211 < z < -1.25338667983348494e174 or -2.6301946553516078e109 < z < -2.75583716522220502e-86 or -2.8576987961966729e-162 < z < -1.240929685890355e-196 or -5.7955189878830535e-272 < z < 2.76874808087013858e84Initial program 20.9
rmApplied div-sub_binary6420.9
Simplified20.9
Simplified20.9
rmApplied *-un-lft-identity_binary6420.9
Applied times-frac_binary6417.5
Simplified17.5
if -1.48469784341933467e133 < z < -2.6301946553516078e109 or -2.75583716522220502e-86 < z < -2.8576987961966729e-162 or -1.240929685890355e-196 < z < -1.74588627110170737e-260Initial program 20.2
rmApplied div-sub_binary6420.2
Simplified20.2
Simplified20.2
rmApplied associate-/l*_binary6417.4
Taylor expanded around 0 24.2
if -1.74588627110170737e-260 < z < -5.7955189878830535e-272Initial program 19.8
rmApplied div-inv_binary6420.0
Simplified20.0
Final simplification20.8
herbie shell --seed 2020224
(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)))