\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}
t_1 := y + \left(x + t\right)\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(y + t\right) \cdot a\right) - y \cdot b}{t_1}\\
t_3 := \left(z + a\right) - b\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t_2 \leq 6.302495604699535 \cdot 10^{+274}:\\
\;\;\;\;\left(\frac{y \cdot z}{t_1} + \left(\frac{a}{\frac{t_1}{y}} + \left(\frac{x \cdot z}{t_1} + \frac{t \cdot a}{t_1}\right)\right)\right) - b \cdot \frac{y}{t_1}\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\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
(let* ((t_1 (+ y (+ x t)))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ y t) a)) (* y b)) t_1))
(t_3 (- (+ z a) b)))
(if (<= t_2 (- INFINITY))
t_3
(if (<= t_2 6.302495604699535e+274)
(-
(+
(/ (* y z) t_1)
(+ (/ a (/ t_1 y)) (+ (/ (* x z) t_1) (/ (* t a) t_1))))
(* b (/ y t_1)))
t_3))))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 t_1 = y + (x + t);
double t_2 = ((((x + y) * z) + ((y + t) * a)) - (y * b)) / t_1;
double t_3 = (z + a) - b;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_2 <= 6.302495604699535e+274) {
tmp = (((y * z) / t_1) + ((a / (t_1 / y)) + (((x * z) / t_1) + ((t * a) / t_1)))) - (b * (y / t_1));
} else {
tmp = t_3;
}
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.9 |
|---|---|
| Target | 11.8 |
| Herbie | 8.4 |
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0 or 6.30249560469953504e274 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 63.1
Taylor expanded in y around inf 18.4
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 6.30249560469953504e274Initial program 0.3
Taylor expanded in z around 0 0.3
Applied associate-/l*_binary642.2
Applied associate-/l*_binary642.3
Applied associate-/r/_binary641.1
Final simplification8.4
herbie shell --seed 2022125
(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)))