\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 -3.097554101876184 \cdot 10^{+166}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq -5.0588825569742354 \cdot 10^{-238}:\\
\;\;\;\;\frac{1}{\frac{x + \left(y + t\right)}{\left(z \cdot \left(x + y\right) + \left(y + t\right) \cdot a\right) - y \cdot b}}\\
\mathbf{elif}\;z \leq -7.5621059774623085 \cdot 10^{-264}:\\
\;\;\;\;a\\
\mathbf{elif}\;z \leq 8.670749435847924 \cdot 10^{+98}:\\
\;\;\;\;\frac{1}{\frac{x + \left(y + t\right)}{\left(z \cdot \left(x + y\right) + \left(y + t\right) \cdot a\right) - y \cdot b}}\\
\mathbf{else}:\\
\;\;\;\;z\\
\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 -3.097554101876184e+166)
z
(if (<= z -5.0588825569742354e-238)
(/ 1.0 (/ (+ x (+ y t)) (- (+ (* z (+ x y)) (* (+ y t) a)) (* y b))))
(if (<= z -7.5621059774623085e-264)
a
(if (<= z 8.670749435847924e+98)
(/ 1.0 (/ (+ x (+ y t)) (- (+ (* z (+ x y)) (* (+ y t) a)) (* y b))))
z)))))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 <= -3.097554101876184e+166) {
tmp = z;
} else if (z <= -5.0588825569742354e-238) {
tmp = 1.0 / ((x + (y + t)) / (((z * (x + y)) + ((y + t) * a)) - (y * b)));
} else if (z <= -7.5621059774623085e-264) {
tmp = a;
} else if (z <= 8.670749435847924e+98) {
tmp = 1.0 / ((x + (y + t)) / (((z * (x + y)) + ((y + t) * a)) - (y * b)));
} else {
tmp = z;
}
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.2 |
| Herbie | 23.8 |
if z < -3.09755410187618414e166 or 8.6707494358479242e98 < z Initial program 41.1
Taylor expanded around inf 28.7
if -3.09755410187618414e166 < z < -5.0588825569742354e-238 or -7.56210597746230853e-264 < z < 8.6707494358479242e98Initial program 21.3
rmApplied clear-num_binary6421.4
Simplified21.4
if -5.0588825569742354e-238 < z < -7.56210597746230853e-264Initial program 19.9
Taylor expanded around 0 36.2
Final simplification23.8
herbie shell --seed 2020220
(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)))