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

\mathbf{elif}\;t_4 \leq 4 \cdot 10^{+285}:\\
\;\;\;\;\left(\frac{t_1}{t_2} + \frac{t_3}{t_2}\right) - \frac{y \cdot b}{t_2}\\

\mathbf{else}:\\
\;\;\;\;t_6\\


\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. Taylor expanded in z around inf 0.3

      \[\leadsto \color{blue}{\left(\frac{\left(y + x\right) \cdot z}{y + \left(t + x\right)} + \frac{a \cdot \left(y + t\right)}{y + \left(t + x\right)}\right) - \frac{y \cdot b}{y + \left(t + x\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left(\left(y + t\right) \cdot a + \left(x + y\right) \cdot z\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(\left(y + t\right) \cdot a + \left(x + y\right) \cdot z\right) - y \cdot b}{y + \left(x + t\right)} \leq 4 \cdot 10^{+285}:\\ \;\;\;\;\left(\frac{\left(x + y\right) \cdot z}{y + \left(x + t\right)} + \frac{\left(y + t\right) \cdot a}{y + \left(x + t\right)}\right) - \frac{y \cdot b}{y + \left(x + 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 := \left(x + y\right) \cdot z\\ t_2 := y + \left(x + t\right)\\ t_3 := \left(y + t\right) \cdot a\\ 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_1}{t_2} + \frac{t_3}{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
Error7.6
Cost4168
\[\begin{array}{l} t_1 := \frac{\left(\left(y + t\right) \cdot a + \left(x + y\right) \cdot z\right) - y \cdot b}{y + \left(x + t\right)}\\ \mathbf{if}\;t_1 \leq -5 \cdot 10^{+290}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{elif}\;t_1 \leq 4 \cdot 10^{+285}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot \frac{z - b}{x + \left(y + t\right)}\\ \end{array} \]
Alternative 3
Error28.0
Cost2288
\[\begin{array}{l} t_1 := \left(z + a\right) - b\\ t_2 := \frac{x \cdot z + t \cdot a}{x + t}\\ \mathbf{if}\;a \leq -1.0240634146392284 \cdot 10^{+141}:\\ \;\;\;\;\frac{a}{\frac{y + \left(x + t\right)}{y + t}}\\ \mathbf{elif}\;a \leq -5.758483003095011 \cdot 10^{+91}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -213.82463569613984:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq -6.277541919383589 \cdot 10^{-35}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -1.174624996523852 \cdot 10^{-65}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq -1.2455357705253977 \cdot 10^{-116}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -8.026972750495834 \cdot 10^{-180}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq 1.0327283602533678 \cdot 10^{-68}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 1.3385920074529525 \cdot 10^{-24}:\\ \;\;\;\;a + \frac{y}{\frac{\left(x + y\right) + t}{z}}\\ \mathbf{elif}\;a \leq 1699948.2691966933:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 2.1467021672381024 \cdot 10^{+60}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq 1.4884780063366977 \cdot 10^{+138}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\left(y + t\right) \cdot \frac{a}{x + \left(y + t\right)}\\ \end{array} \]
Alternative 4
Error29.4
Cost2092
\[\begin{array}{l} t_1 := \left(z + a\right) - b\\ \mathbf{if}\;y \leq -3.185124999122142 \cdot 10^{-84}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.6826286054260478 \cdot 10^{-110}:\\ \;\;\;\;a + \frac{y \cdot \left(z - b\right)}{t}\\ \mathbf{elif}\;y \leq -4.470409328396437 \cdot 10^{-163}:\\ \;\;\;\;\frac{x}{\frac{x + t}{z}}\\ \mathbf{elif}\;y \leq -2.1530404929477084 \cdot 10^{-187}:\\ \;\;\;\;a\\ \mathbf{elif}\;y \leq 8.492790126075642 \cdot 10^{-308}:\\ \;\;\;\;z + \frac{t \cdot a}{x}\\ \mathbf{elif}\;y \leq 1.8406599102428092 \cdot 10^{-153}:\\ \;\;\;\;a \cdot \frac{t}{x + t}\\ \mathbf{elif}\;y \leq 6.082060908897087 \cdot 10^{-79}:\\ \;\;\;\;z + \frac{y \cdot \left(a - b\right)}{x}\\ \mathbf{elif}\;y \leq 410254315650671900:\\ \;\;\;\;z + a\\ \mathbf{elif}\;y \leq 9.3860274878408 \cdot 10^{+109}:\\ \;\;\;\;\frac{x + y}{\frac{x + \left(y + t\right)}{z}}\\ \mathbf{elif}\;y \leq 6.783576916879499 \cdot 10^{+124}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.9425436519275104 \cdot 10^{+139}:\\ \;\;\;\;\frac{-b}{\frac{y + \left(x + t\right)}{y}}\\ \mathbf{elif}\;y \leq 3.6884448296899867 \cdot 10^{+168}:\\ \;\;\;\;y \cdot \frac{a}{x + y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error29.3
Cost2092
\[\begin{array}{l} t_1 := \left(z + a\right) - b\\ t_2 := y + \left(x + t\right)\\ \mathbf{if}\;y \leq -3.185124999122142 \cdot 10^{-84}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.6826286054260478 \cdot 10^{-110}:\\ \;\;\;\;a + \frac{y \cdot \left(z - b\right)}{t}\\ \mathbf{elif}\;y \leq -4.470409328396437 \cdot 10^{-163}:\\ \;\;\;\;\frac{x}{\frac{x + t}{z}}\\ \mathbf{elif}\;y \leq -2.1530404929477084 \cdot 10^{-187}:\\ \;\;\;\;a\\ \mathbf{elif}\;y \leq 8.492790126075642 \cdot 10^{-308}:\\ \;\;\;\;z + \frac{t \cdot a}{x}\\ \mathbf{elif}\;y \leq 1.8406599102428092 \cdot 10^{-153}:\\ \;\;\;\;\frac{a}{\frac{t_2}{y + t}}\\ \mathbf{elif}\;y \leq 6.082060908897087 \cdot 10^{-79}:\\ \;\;\;\;z + \frac{y \cdot \left(a - b\right)}{x}\\ \mathbf{elif}\;y \leq 410254315650671900:\\ \;\;\;\;z + a\\ \mathbf{elif}\;y \leq 9.3860274878408 \cdot 10^{+109}:\\ \;\;\;\;\frac{x + y}{\frac{x + \left(y + t\right)}{z}}\\ \mathbf{elif}\;y \leq 6.783576916879499 \cdot 10^{+124}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.9425436519275104 \cdot 10^{+139}:\\ \;\;\;\;\frac{-b}{\frac{t_2}{y}}\\ \mathbf{elif}\;y \leq 3.6884448296899867 \cdot 10^{+168}:\\ \;\;\;\;y \cdot \frac{a}{x + y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error22.1
Cost1888
\[\begin{array}{l} t_1 := x + \left(y + t\right)\\ t_2 := a + y \cdot \frac{z - b}{t_1}\\ \mathbf{if}\;y \leq -1.6826286054260478 \cdot 10^{-110}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -2.9360001434768103 \cdot 10^{-125}:\\ \;\;\;\;z - y \cdot \frac{b}{x}\\ \mathbf{elif}\;y \leq -4.34033044329712 \cdot 10^{-132}:\\ \;\;\;\;a + \frac{y \cdot z}{t}\\ \mathbf{elif}\;y \leq 2.38633590905089 \cdot 10^{-150}:\\ \;\;\;\;\frac{x \cdot z + t \cdot a}{x + t}\\ \mathbf{elif}\;y \leq 6.254333179526408 \cdot 10^{-20}:\\ \;\;\;\;z + a\\ \mathbf{elif}\;y \leq 1.1161298373753981 \cdot 10^{+27}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 2.5442431582794946 \cdot 10^{+111}:\\ \;\;\;\;\frac{x + y}{\frac{t_1}{z}}\\ \mathbf{elif}\;y \leq 6.783576916879499 \cdot 10^{+124}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 7
Error22.4
Cost1888
\[\begin{array}{l} t_1 := x + \left(y + t\right)\\ t_2 := a + y \cdot \frac{z - b}{t_1}\\ \mathbf{if}\;y \leq -1.6826286054260478 \cdot 10^{-110}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -2.9360001434768103 \cdot 10^{-125}:\\ \;\;\;\;z - y \cdot \frac{b}{x}\\ \mathbf{elif}\;y \leq -4.34033044329712 \cdot 10^{-132}:\\ \;\;\;\;a + \frac{y \cdot z}{t}\\ \mathbf{elif}\;y \leq 2.38633590905089 \cdot 10^{-150}:\\ \;\;\;\;\frac{x \cdot z + t \cdot a}{x + t}\\ \mathbf{elif}\;y \leq 2.1616544700087862 \cdot 10^{-13}:\\ \;\;\;\;z + a\\ \mathbf{elif}\;y \leq 6.555685291700913 \cdot 10^{+63}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z - y \cdot b}{y + \left(x + t\right)}\\ \mathbf{elif}\;y \leq 2.5442431582794946 \cdot 10^{+111}:\\ \;\;\;\;\frac{x + y}{\frac{t_1}{z}}\\ \mathbf{elif}\;y \leq 6.783576916879499 \cdot 10^{+124}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 8
Error25.7
Cost1240
\[\begin{array}{l} t_1 := \left(z + a\right) - b\\ t_2 := z - y \cdot \frac{b}{x}\\ \mathbf{if}\;x \leq -2.047040115037817 \cdot 10^{+228}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.3795598315342576 \cdot 10^{-157}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.2124533205718665 \cdot 10^{-307}:\\ \;\;\;\;a + \frac{y}{\frac{y + t}{z}}\\ \mathbf{elif}\;x \leq 4.204282016287969 \cdot 10^{+112}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 7.245611499510396 \cdot 10^{+170}:\\ \;\;\;\;z + a \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq 1.7941381133198787 \cdot 10^{+215}:\\ \;\;\;\;z + a\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 9
Error25.8
Cost976
\[\begin{array}{l} t_1 := z - y \cdot \frac{b}{x}\\ \mathbf{if}\;x \leq -2.047040115037817 \cdot 10^{+228}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 4.204282016287969 \cdot 10^{+112}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{elif}\;x \leq 7.245611499510396 \cdot 10^{+170}:\\ \;\;\;\;z + a \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq 1.7941381133198787 \cdot 10^{+215}:\\ \;\;\;\;z + a\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error37.4
Cost856
\[\begin{array}{l} \mathbf{if}\;z \leq -1.8788602290671334 \cdot 10^{+107}:\\ \;\;\;\;z\\ \mathbf{elif}\;z \leq -1.5256924595481015 \cdot 10^{-182}:\\ \;\;\;\;a\\ \mathbf{elif}\;z \leq -2.0862150641315954 \cdot 10^{-217}:\\ \;\;\;\;-b\\ \mathbf{elif}\;z \leq 5.129830845771621 \cdot 10^{-95}:\\ \;\;\;\;a\\ \mathbf{elif}\;z \leq 1.3747534939545556 \cdot 10^{+37}:\\ \;\;\;\;z\\ \mathbf{elif}\;z \leq 3.8471384577298874 \cdot 10^{+119}:\\ \;\;\;\;a\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \]
Alternative 11
Error24.4
Cost840
\[\begin{array}{l} t_1 := a + y \cdot \frac{z - b}{t}\\ \mathbf{if}\;t \leq -6.012558218188993 \cdot 10^{+175}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 9.728751273109411 \cdot 10^{+112}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 12
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 13
Error25.6
Cost712
\[\begin{array}{l} t_1 := z - y \cdot \frac{b}{x}\\ \mathbf{if}\;x \leq -2.047040115037817 \cdot 10^{+228}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 6.3259513989606 \cdot 10^{+106}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 14
Error25.7
Cost712
\[\begin{array}{l} t_1 := a + y \cdot \frac{z}{t}\\ \mathbf{if}\;t \leq -2.2272211673119065 \cdot 10^{+127}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 4.329874416699287 \cdot 10^{+160}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 15
Error37.1
Cost592
\[\begin{array}{l} \mathbf{if}\;z \leq -1.8788602290671334 \cdot 10^{+107}:\\ \;\;\;\;z\\ \mathbf{elif}\;z \leq 5.129830845771621 \cdot 10^{-95}:\\ \;\;\;\;a\\ \mathbf{elif}\;z \leq 1.3747534939545556 \cdot 10^{+37}:\\ \;\;\;\;z\\ \mathbf{elif}\;z \leq 3.8471384577298874 \cdot 10^{+119}:\\ \;\;\;\;a\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \]
Alternative 16
Error27.0
Cost584
\[\begin{array}{l} \mathbf{if}\;t \leq -1.1569608629554738 \cdot 10^{+145}:\\ \;\;\;\;z + a\\ \mathbf{elif}\;t \leq 4.329874416699287 \cdot 10^{+160}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{1}{a}}\\ \end{array} \]
Alternative 17
Error43.3
Cost64
\[a \]

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)))