Average Error: 26.3 → 0.5
Time: 10.6s
Precision: binary64
Cost: 16712
\[\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 := \frac{\left(z \cdot \left(x + y\right) + a \cdot \left(y + t\right)\right) - y \cdot b}{y + \left(x + t\right)}\\ t_2 := x + \left(y + t\right)\\ t_3 := y \cdot \frac{z - b}{t_2} + \mathsf{fma}\left(a, \frac{y}{t_2} + \frac{t}{t_2}, z \cdot \frac{x}{t_2}\right)\\ \mathbf{if}\;t_1 \leq -5 \cdot 10^{+290}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t_1 \leq 4 \cdot 10^{+285}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, z - b, \mathsf{fma}\left(y + t, a, x \cdot z\right)\right)}{t_2}\\ \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 (/ (- (+ (* z (+ x y)) (* a (+ y t))) (* y b)) (+ y (+ x t))))
        (t_2 (+ x (+ y t)))
        (t_3
         (+
          (* y (/ (- z b) t_2))
          (fma a (+ (/ y t_2) (/ t t_2)) (* z (/ x t_2))))))
   (if (<= t_1 -5e+290)
     t_3
     (if (<= t_1 4e+285)
       (/ (fma y (- z b) (fma (+ y t) a (* x z))) t_2)
       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 = (((z * (x + y)) + (a * (y + t))) - (y * b)) / (y + (x + t));
	double t_2 = x + (y + t);
	double t_3 = (y * ((z - b) / t_2)) + fma(a, ((y / t_2) + (t / t_2)), (z * (x / t_2)));
	double tmp;
	if (t_1 <= -5e+290) {
		tmp = t_3;
	} else if (t_1 <= 4e+285) {
		tmp = fma(y, (z - b), fma((y + t), a, (x * z))) / t_2;
	} else {
		tmp = t_3;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y))
end
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(Float64(Float64(z * Float64(x + y)) + Float64(a * Float64(y + t))) - Float64(y * b)) / Float64(y + Float64(x + t)))
	t_2 = Float64(x + Float64(y + t))
	t_3 = Float64(Float64(y * Float64(Float64(z - b) / t_2)) + fma(a, Float64(Float64(y / t_2) + Float64(t / t_2)), Float64(z * Float64(x / t_2))))
	tmp = 0.0
	if (t_1 <= -5e+290)
		tmp = t_3;
	elseif (t_1 <= 4e+285)
		tmp = Float64(fma(y, Float64(z - b), fma(Float64(y + t), a, Float64(x * z))) / t_2);
	else
		tmp = t_3;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(a * N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(y + t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y * N[(N[(z - b), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[(y / t$95$2), $MachinePrecision] + N[(t / t$95$2), $MachinePrecision]), $MachinePrecision] + N[(z * N[(x / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+290], t$95$3, If[LessEqual[t$95$1, 4e+285], N[(N[(y * N[(z - b), $MachinePrecision] + N[(N[(y + t), $MachinePrecision] * a + N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], t$95$3]]]]]
\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 := \frac{\left(z \cdot \left(x + y\right) + a \cdot \left(y + t\right)\right) - y \cdot b}{y + \left(x + t\right)}\\
t_2 := x + \left(y + t\right)\\
t_3 := y \cdot \frac{z - b}{t_2} + \mathsf{fma}\left(a, \frac{y}{t_2} + \frac{t}{t_2}, z \cdot \frac{x}{t_2}\right)\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{+290}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;t_1 \leq 4 \cdot 10^{+285}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, z - b, \mathsf{fma}\left(y + t, a, x \cdot z\right)\right)}{t_2}\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}

Error

Target

Original26.3
Target11.4
Herbie0.5
\[\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} < -3.5813117084150564 \cdot 10^{+153}:\\ \;\;\;\;\left(z + a\right) - b\\ \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} < 1.2285964308315609 \cdot 10^{+82}:\\ \;\;\;\;\frac{1}{\frac{\left(x + t\right) + y}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\left(z + a\right) - b\\ \end{array} \]

Derivation

  1. Split input into 2 regimes
  2. if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -4.9999999999999998e290 or 3.9999999999999999e285 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y))

    1. Initial program 62.8

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \]
    2. Simplified62.8

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, z - b, \mathsf{fma}\left(y + t, a, x \cdot z\right)\right)}{x + \left(y + t\right)}} \]
      Proof
      (/.f64 (fma.f64 y (-.f64 z b) (fma.f64 (+.f64 y t) a (*.f64 x z))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 y (-.f64 z b) (fma.f64 (Rewrite<= +-commutative_binary64 (+.f64 t y)) a (*.f64 x z))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 y (-.f64 z b) (fma.f64 (+.f64 t y) a (Rewrite<= *-commutative_binary64 (*.f64 z x)))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 y (-.f64 z b) (Rewrite<= fma-def_binary64 (+.f64 (*.f64 (+.f64 t y) a) (*.f64 z x)))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 y (-.f64 z b) (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 z x) (*.f64 (+.f64 t y) a)))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= fma-def_binary64 (+.f64 (*.f64 y (-.f64 z b)) (+.f64 (*.f64 z x) (*.f64 (+.f64 t y) a)))) (+.f64 x (+.f64 y t))): 2 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (Rewrite<= distribute-lft-out--_binary64 (-.f64 (*.f64 y z) (*.f64 y b))) (+.f64 (*.f64 z x) (*.f64 (+.f64 t y) a))) (+.f64 x (+.f64 y t))): 1 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (Rewrite<= unsub-neg_binary64 (+.f64 (*.f64 y z) (neg.f64 (*.f64 y b)))) (+.f64 (*.f64 z x) (*.f64 (+.f64 t y) a))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (Rewrite=> +-commutative_binary64 (+.f64 (neg.f64 (*.f64 y b)) (*.f64 y z))) (+.f64 (*.f64 z x) (*.f64 (+.f64 t y) a))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= associate-+r+_binary64 (+.f64 (neg.f64 (*.f64 y b)) (+.f64 (*.f64 y z) (+.f64 (*.f64 z x) (*.f64 (+.f64 t y) a))))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 (*.f64 y b)) (+.f64 (*.f64 y z) (+.f64 (Rewrite=> *-commutative_binary64 (*.f64 x z)) (*.f64 (+.f64 t y) a)))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 (*.f64 y b)) (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 (*.f64 y z) (*.f64 x z)) (*.f64 (+.f64 t y) a)))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 (*.f64 y b)) (+.f64 (Rewrite<= distribute-rgt-in_binary64 (*.f64 z (+.f64 y x))) (*.f64 (+.f64 t y) a))) (+.f64 x (+.f64 y t))): 0 points increase in error, 1 points decrease in error
      (/.f64 (+.f64 (neg.f64 (*.f64 y b)) (+.f64 (*.f64 z (Rewrite<= +-commutative_binary64 (+.f64 x y))) (*.f64 (+.f64 t y) a))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 (*.f64 y b)) (+.f64 (Rewrite<= *-commutative_binary64 (*.f64 (+.f64 x y) z)) (*.f64 (+.f64 t y) a))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= +-commutative_binary64 (+.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (neg.f64 (*.f64 y b)))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= sub-neg_binary64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 x (Rewrite<= +-commutative_binary64 (+.f64 t y)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 x t) y))): 0 points increase in error, 0 points decrease in error
    3. Taylor expanded in a around 0 43.1

      \[\leadsto \color{blue}{\frac{\left(z - b\right) \cdot y}{y + \left(t + x\right)} + \left(\frac{z \cdot x}{y + \left(t + x\right)} + a \cdot \left(\frac{y}{y + \left(t + x\right)} + \frac{t}{y + \left(t + x\right)}\right)\right)} \]
    4. Simplified0.8

      \[\leadsto \color{blue}{\frac{z - b}{x + \left(t + y\right)} \cdot y + \mathsf{fma}\left(a, \frac{y}{x + \left(t + y\right)} + \frac{t}{x + \left(t + y\right)}, \frac{x}{x + \left(t + y\right)} \cdot z\right)} \]
      Proof
      (+.f64 (*.f64 (/.f64 (-.f64 z b) (+.f64 x (+.f64 t y))) y) (fma.f64 a (+.f64 (/.f64 y (+.f64 x (+.f64 t y))) (/.f64 t (+.f64 x (+.f64 t y)))) (*.f64 (/.f64 x (+.f64 x (+.f64 t y))) z))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 (/.f64 (-.f64 z b) (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 x t) y))) y) (fma.f64 a (+.f64 (/.f64 y (+.f64 x (+.f64 t y))) (/.f64 t (+.f64 x (+.f64 t y)))) (*.f64 (/.f64 x (+.f64 x (+.f64 t y))) z))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 (/.f64 (-.f64 z b) (+.f64 (Rewrite<= +-commutative_binary64 (+.f64 t x)) y)) y) (fma.f64 a (+.f64 (/.f64 y (+.f64 x (+.f64 t y))) (/.f64 t (+.f64 x (+.f64 t y)))) (*.f64 (/.f64 x (+.f64 x (+.f64 t y))) z))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 (/.f64 (-.f64 z b) (Rewrite<= +-commutative_binary64 (+.f64 y (+.f64 t x)))) y) (fma.f64 a (+.f64 (/.f64 y (+.f64 x (+.f64 t y))) (/.f64 t (+.f64 x (+.f64 t y)))) (*.f64 (/.f64 x (+.f64 x (+.f64 t y))) z))): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= associate-/r/_binary64 (/.f64 (-.f64 z b) (/.f64 (+.f64 y (+.f64 t x)) y))) (fma.f64 a (+.f64 (/.f64 y (+.f64 x (+.f64 t y))) (/.f64 t (+.f64 x (+.f64 t y)))) (*.f64 (/.f64 x (+.f64 x (+.f64 t y))) z))): 10 points increase in error, 16 points decrease in error
      (+.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 (-.f64 z b) y) (+.f64 y (+.f64 t x)))) (fma.f64 a (+.f64 (/.f64 y (+.f64 x (+.f64 t y))) (/.f64 t (+.f64 x (+.f64 t y)))) (*.f64 (/.f64 x (+.f64 x (+.f64 t y))) z))): 49 points increase in error, 12 points decrease in error
      (+.f64 (/.f64 (*.f64 (-.f64 z b) y) (+.f64 y (+.f64 t x))) (fma.f64 a (+.f64 (/.f64 y (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 x t) y))) (/.f64 t (+.f64 x (+.f64 t y)))) (*.f64 (/.f64 x (+.f64 x (+.f64 t y))) z))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 (*.f64 (-.f64 z b) y) (+.f64 y (+.f64 t x))) (fma.f64 a (+.f64 (/.f64 y (+.f64 (Rewrite<= +-commutative_binary64 (+.f64 t x)) y)) (/.f64 t (+.f64 x (+.f64 t y)))) (*.f64 (/.f64 x (+.f64 x (+.f64 t y))) z))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 (*.f64 (-.f64 z b) y) (+.f64 y (+.f64 t x))) (fma.f64 a (+.f64 (/.f64 y (Rewrite<= +-commutative_binary64 (+.f64 y (+.f64 t x)))) (/.f64 t (+.f64 x (+.f64 t y)))) (*.f64 (/.f64 x (+.f64 x (+.f64 t y))) z))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 (*.f64 (-.f64 z b) y) (+.f64 y (+.f64 t x))) (fma.f64 a (+.f64 (/.f64 y (+.f64 y (+.f64 t x))) (/.f64 t (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 x t) y)))) (*.f64 (/.f64 x (+.f64 x (+.f64 t y))) z))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 (*.f64 (-.f64 z b) y) (+.f64 y (+.f64 t x))) (fma.f64 a (+.f64 (/.f64 y (+.f64 y (+.f64 t x))) (/.f64 t (+.f64 (Rewrite<= +-commutative_binary64 (+.f64 t x)) y))) (*.f64 (/.f64 x (+.f64 x (+.f64 t y))) z))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 (*.f64 (-.f64 z b) y) (+.f64 y (+.f64 t x))) (fma.f64 a (+.f64 (/.f64 y (+.f64 y (+.f64 t x))) (/.f64 t (Rewrite<= +-commutative_binary64 (+.f64 y (+.f64 t x))))) (*.f64 (/.f64 x (+.f64 x (+.f64 t y))) z))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 (*.f64 (-.f64 z b) y) (+.f64 y (+.f64 t x))) (fma.f64 a (+.f64 (/.f64 y (+.f64 y (+.f64 t x))) (/.f64 t (+.f64 y (+.f64 t x)))) (*.f64 (/.f64 x (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 x t) y))) z))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 (*.f64 (-.f64 z b) y) (+.f64 y (+.f64 t x))) (fma.f64 a (+.f64 (/.f64 y (+.f64 y (+.f64 t x))) (/.f64 t (+.f64 y (+.f64 t x)))) (*.f64 (/.f64 x (+.f64 (Rewrite<= +-commutative_binary64 (+.f64 t x)) y)) z))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 (*.f64 (-.f64 z b) y) (+.f64 y (+.f64 t x))) (fma.f64 a (+.f64 (/.f64 y (+.f64 y (+.f64 t x))) (/.f64 t (+.f64 y (+.f64 t x)))) (*.f64 (/.f64 x (Rewrite<= +-commutative_binary64 (+.f64 y (+.f64 t x)))) z))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 (*.f64 (-.f64 z b) y) (+.f64 y (+.f64 t x))) (fma.f64 a (+.f64 (/.f64 y (+.f64 y (+.f64 t x))) (/.f64 t (+.f64 y (+.f64 t x)))) (Rewrite<= associate-/r/_binary64 (/.f64 x (/.f64 (+.f64 y (+.f64 t x)) z))))): 16 points increase in error, 5 points decrease in error
      (+.f64 (/.f64 (*.f64 (-.f64 z b) y) (+.f64 y (+.f64 t x))) (fma.f64 a (+.f64 (/.f64 y (+.f64 y (+.f64 t x))) (/.f64 t (+.f64 y (+.f64 t x)))) (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 x z) (+.f64 y (+.f64 t x)))))): 28 points increase in error, 14 points decrease in error
      (+.f64 (/.f64 (*.f64 (-.f64 z b) y) (+.f64 y (+.f64 t x))) (fma.f64 a (+.f64 (/.f64 y (+.f64 y (+.f64 t x))) (/.f64 t (+.f64 y (+.f64 t x)))) (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 z x)) (+.f64 y (+.f64 t x))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 (*.f64 (-.f64 z b) y) (+.f64 y (+.f64 t x))) (Rewrite<= fma-def_binary64 (+.f64 (*.f64 a (+.f64 (/.f64 y (+.f64 y (+.f64 t x))) (/.f64 t (+.f64 y (+.f64 t x))))) (/.f64 (*.f64 z x) (+.f64 y (+.f64 t x)))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 (*.f64 (-.f64 z b) y) (+.f64 y (+.f64 t x))) (Rewrite<= +-commutative_binary64 (+.f64 (/.f64 (*.f64 z x) (+.f64 y (+.f64 t x))) (*.f64 a (+.f64 (/.f64 y (+.f64 y (+.f64 t x))) (/.f64 t (+.f64 y (+.f64 t x)))))))): 0 points increase in error, 0 points decrease in error

    if -4.9999999999999998e290 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 3.9999999999999999e285

    1. Initial program 0.3

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \]
    2. Simplified0.3

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, z - b, \mathsf{fma}\left(y + t, a, x \cdot z\right)\right)}{x + \left(y + t\right)}} \]
      Proof
      (/.f64 (fma.f64 y (-.f64 z b) (fma.f64 (+.f64 y t) a (*.f64 x z))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 y (-.f64 z b) (fma.f64 (Rewrite<= +-commutative_binary64 (+.f64 t y)) a (*.f64 x z))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 y (-.f64 z b) (fma.f64 (+.f64 t y) a (Rewrite<= *-commutative_binary64 (*.f64 z x)))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 y (-.f64 z b) (Rewrite<= fma-def_binary64 (+.f64 (*.f64 (+.f64 t y) a) (*.f64 z x)))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 y (-.f64 z b) (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 z x) (*.f64 (+.f64 t y) a)))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= fma-def_binary64 (+.f64 (*.f64 y (-.f64 z b)) (+.f64 (*.f64 z x) (*.f64 (+.f64 t y) a)))) (+.f64 x (+.f64 y t))): 2 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (Rewrite<= distribute-lft-out--_binary64 (-.f64 (*.f64 y z) (*.f64 y b))) (+.f64 (*.f64 z x) (*.f64 (+.f64 t y) a))) (+.f64 x (+.f64 y t))): 1 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (Rewrite<= unsub-neg_binary64 (+.f64 (*.f64 y z) (neg.f64 (*.f64 y b)))) (+.f64 (*.f64 z x) (*.f64 (+.f64 t y) a))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (Rewrite=> +-commutative_binary64 (+.f64 (neg.f64 (*.f64 y b)) (*.f64 y z))) (+.f64 (*.f64 z x) (*.f64 (+.f64 t y) a))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= associate-+r+_binary64 (+.f64 (neg.f64 (*.f64 y b)) (+.f64 (*.f64 y z) (+.f64 (*.f64 z x) (*.f64 (+.f64 t y) a))))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 (*.f64 y b)) (+.f64 (*.f64 y z) (+.f64 (Rewrite=> *-commutative_binary64 (*.f64 x z)) (*.f64 (+.f64 t y) a)))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 (*.f64 y b)) (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 (*.f64 y z) (*.f64 x z)) (*.f64 (+.f64 t y) a)))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 (*.f64 y b)) (+.f64 (Rewrite<= distribute-rgt-in_binary64 (*.f64 z (+.f64 y x))) (*.f64 (+.f64 t y) a))) (+.f64 x (+.f64 y t))): 0 points increase in error, 1 points decrease in error
      (/.f64 (+.f64 (neg.f64 (*.f64 y b)) (+.f64 (*.f64 z (Rewrite<= +-commutative_binary64 (+.f64 x y))) (*.f64 (+.f64 t y) a))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 (*.f64 y b)) (+.f64 (Rewrite<= *-commutative_binary64 (*.f64 (+.f64 x y) z)) (*.f64 (+.f64 t y) a))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= +-commutative_binary64 (+.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (neg.f64 (*.f64 y b)))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= sub-neg_binary64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b))) (+.f64 x (+.f64 y t))): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 x (Rewrite<= +-commutative_binary64 (+.f64 t y)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 x t) y))): 0 points increase in error, 0 points decrease in error
  3. Recombined 2 regimes into one program.
  4. Final simplification0.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left(z \cdot \left(x + y\right) + a \cdot \left(y + t\right)\right) - y \cdot b}{y + \left(x + t\right)} \leq -5 \cdot 10^{+290}:\\ \;\;\;\;y \cdot \frac{z - b}{x + \left(y + t\right)} + \mathsf{fma}\left(a, \frac{y}{x + \left(y + t\right)} + \frac{t}{x + \left(y + t\right)}, z \cdot \frac{x}{x + \left(y + t\right)}\right)\\ \mathbf{elif}\;\frac{\left(z \cdot \left(x + y\right) + a \cdot \left(y + t\right)\right) - y \cdot b}{y + \left(x + t\right)} \leq 4 \cdot 10^{+285}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, z - b, \mathsf{fma}\left(y + t, a, x \cdot z\right)\right)}{x + \left(y + t\right)}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{z - b}{x + \left(y + t\right)} + \mathsf{fma}\left(a, \frac{y}{x + \left(y + t\right)} + \frac{t}{x + \left(y + t\right)}, z \cdot \frac{x}{x + \left(y + t\right)}\right)\\ \end{array} \]

Alternatives

Alternative 1
Error7.6
Cost4936
\[\begin{array}{l} t_1 := a \cdot \left(y + t\right)\\ t_2 := y + \left(x + t\right)\\ t_3 := z \cdot \left(x + y\right)\\ t_4 := \frac{\left(t_3 + t_1\right) - y \cdot b}{t_2}\\ \mathbf{if}\;t_4 \leq -5 \cdot 10^{+290}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{elif}\;t_4 \leq 4 \cdot 10^{+285}:\\ \;\;\;\;\left(\frac{t_3}{t_2} + \frac{t_1}{t_2}\right) - \frac{y \cdot b}{t_2}\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot \frac{z - b}{x + \left(y + t\right)}\\ \end{array} \]
Alternative 2
Error32.5
Cost720
\[\begin{array}{l} \mathbf{if}\;y \leq -2.2186464085103262 \cdot 10^{+231}:\\ \;\;\;\;z + a\\ \mathbf{elif}\;y \leq -5.150333838628968 \cdot 10^{+165}:\\ \;\;\;\;-b\\ \mathbf{elif}\;y \leq -4.916081773966536 \cdot 10^{-140}:\\ \;\;\;\;z + a\\ \mathbf{elif}\;y \leq -5.667863688664977 \cdot 10^{-235}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;z + a\\ \end{array} \]
Alternative 3
Error42.9
Cost64
\[z \]

Error

Reproduce

herbie shell --seed 2022291 
(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)))