AI.Clustering.Hierarchical.Internal:ward from clustering-0.2.1

?

Percentage Accurate: 60.4% → 88.3%
Time: 12.6s
Precision: binary64
Cost: 2244

?

\[\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(t + x\right)\\ t_2 := \frac{y + x}{\frac{t_1}{z}}\\ \mathbf{if}\;t \leq -1.05 \cdot 10^{+28}:\\ \;\;\;\;\left(t_2 + \frac{t + y}{\frac{t_1}{a}}\right) - \frac{y \cdot b}{t_1}\\ \mathbf{elif}\;t \leq 128000000:\\ \;\;\;\;z + \left(\frac{t \cdot a}{t_1} + \frac{y}{t_1} \cdot \left(a - b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_2 + \left(a + \frac{y}{\frac{t_1}{a - b}}\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
 (let* ((t_1 (+ y (+ t x))) (t_2 (/ (+ y x) (/ t_1 z))))
   (if (<= t -1.05e+28)
     (- (+ t_2 (/ (+ t y) (/ t_1 a))) (/ (* y b) t_1))
     (if (<= t 128000000.0)
       (+ z (+ (/ (* t a) t_1) (* (/ y t_1) (- a b))))
       (+ t_2 (+ a (/ y (/ t_1 (- a b)))))))))
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 + (t + x);
	double t_2 = (y + x) / (t_1 / z);
	double tmp;
	if (t <= -1.05e+28) {
		tmp = (t_2 + ((t + y) / (t_1 / a))) - ((y * b) / t_1);
	} else if (t <= 128000000.0) {
		tmp = z + (((t * a) / t_1) + ((y / t_1) * (a - b)));
	} else {
		tmp = t_2 + (a + (y / (t_1 / (a - b))));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
end function
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = y + (t + x)
    t_2 = (y + x) / (t_1 / z)
    if (t <= (-1.05d+28)) then
        tmp = (t_2 + ((t + y) / (t_1 / a))) - ((y * b) / t_1)
    else if (t <= 128000000.0d0) then
        tmp = z + (((t * a) / t_1) + ((y / t_1) * (a - b)))
    else
        tmp = t_2 + (a + (y / (t_1 / (a - b))))
    end if
    code = tmp
end function
public static 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);
}
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = y + (t + x);
	double t_2 = (y + x) / (t_1 / z);
	double tmp;
	if (t <= -1.05e+28) {
		tmp = (t_2 + ((t + y) / (t_1 / a))) - ((y * b) / t_1);
	} else if (t <= 128000000.0) {
		tmp = z + (((t * a) / t_1) + ((y / t_1) * (a - b)));
	} else {
		tmp = t_2 + (a + (y / (t_1 / (a - b))));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
def code(x, y, z, t, a, b):
	t_1 = y + (t + x)
	t_2 = (y + x) / (t_1 / z)
	tmp = 0
	if t <= -1.05e+28:
		tmp = (t_2 + ((t + y) / (t_1 / a))) - ((y * b) / t_1)
	elif t <= 128000000.0:
		tmp = z + (((t * a) / t_1) + ((y / t_1) * (a - b)))
	else:
		tmp = t_2 + (a + (y / (t_1 / (a - b))))
	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(y + Float64(t + x))
	t_2 = Float64(Float64(y + x) / Float64(t_1 / z))
	tmp = 0.0
	if (t <= -1.05e+28)
		tmp = Float64(Float64(t_2 + Float64(Float64(t + y) / Float64(t_1 / a))) - Float64(Float64(y * b) / t_1));
	elseif (t <= 128000000.0)
		tmp = Float64(z + Float64(Float64(Float64(t * a) / t_1) + Float64(Float64(y / t_1) * Float64(a - b))));
	else
		tmp = Float64(t_2 + Float64(a + Float64(y / Float64(t_1 / Float64(a - b)))));
	end
	return tmp
end
function tmp = code(x, y, z, t, a, b)
	tmp = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = y + (t + x);
	t_2 = (y + x) / (t_1 / z);
	tmp = 0.0;
	if (t <= -1.05e+28)
		tmp = (t_2 + ((t + y) / (t_1 / a))) - ((y * b) / t_1);
	elseif (t <= 128000000.0)
		tmp = z + (((t * a) / t_1) + ((y / t_1) * (a - b)));
	else
		tmp = t_2 + (a + (y / (t_1 / (a - b))));
	end
	tmp_2 = 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[(y + N[(t + x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y + x), $MachinePrecision] / N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.05e+28], N[(N[(t$95$2 + N[(N[(t + y), $MachinePrecision] / N[(t$95$1 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(y * b), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 128000000.0], N[(z + N[(N[(N[(t * a), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(N[(y / t$95$1), $MachinePrecision] * N[(a - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(a + N[(y / N[(t$95$1 / N[(a - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\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(t + x\right)\\
t_2 := \frac{y + x}{\frac{t_1}{z}}\\
\mathbf{if}\;t \leq -1.05 \cdot 10^{+28}:\\
\;\;\;\;\left(t_2 + \frac{t + y}{\frac{t_1}{a}}\right) - \frac{y \cdot b}{t_1}\\

\mathbf{elif}\;t \leq 128000000:\\
\;\;\;\;z + \left(\frac{t \cdot a}{t_1} + \frac{y}{t_1} \cdot \left(a - b\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t_2 + \left(a + \frac{y}{\frac{t_1}{a - b}}\right)\\


\end{array}

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Herbie found 11 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Bogosity?

Bogosity

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original60.4%
Target82.4%
Herbie88.3%
\[\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 3 regimes
  2. if t < -1.04999999999999995e28

    1. Initial program 40.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. Simplified41.2%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, a - b, \mathsf{fma}\left(x + y, z, t \cdot a\right)\right)}{x + \left(y + t\right)}} \]
      Step-by-step derivation

      [Start]40.8%

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

      *-commutative [=>]40.8%

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

      distribute-rgt-in [=>]40.3%

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

      associate-+r+ [=>]40.3%

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

      associate--l+ [=>]40.3%

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

      +-commutative [=>]40.3%

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

      +-commutative [=>]40.3%

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

      distribute-lft-out-- [=>]40.5%

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

      fma-def [=>]41.0%

      \[ \frac{\color{blue}{\mathsf{fma}\left(y, a - b, t \cdot a + \left(x + y\right) \cdot z\right)}}{\left(x + t\right) + y} \]

      +-commutative [<=]41.0%

      \[ \frac{\mathsf{fma}\left(y, a - b, \color{blue}{\left(x + y\right) \cdot z + t \cdot a}\right)}{\left(x + t\right) + y} \]

      fma-def [=>]41.2%

      \[ \frac{\mathsf{fma}\left(y, a - b, \color{blue}{\mathsf{fma}\left(x + y, z, t \cdot a\right)}\right)}{\left(x + t\right) + y} \]

      associate-+l+ [=>]41.2%

      \[ \frac{\mathsf{fma}\left(y, a - b, \mathsf{fma}\left(x + y, z, t \cdot a\right)\right)}{\color{blue}{x + \left(t + y\right)}} \]

      +-commutative [=>]41.2%

      \[ \frac{\mathsf{fma}\left(y, a - b, \mathsf{fma}\left(x + y, z, t \cdot a\right)\right)}{x + \color{blue}{\left(y + t\right)}} \]
    3. Taylor expanded in a around -inf 40.8%

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

      \[\leadsto \color{blue}{\left(\frac{y + x}{\frac{y + \left(t + x\right)}{z}} - \frac{\left(-t\right) - y}{\frac{y + \left(t + x\right)}{a}}\right) - \frac{y \cdot b}{y + \left(t + x\right)}} \]
      Step-by-step derivation

      [Start]40.8%

      \[ \frac{\left(y + x\right) \cdot z}{y + \left(t + x\right)} + \left(-1 \cdot \frac{\left(-1 \cdot t + -1 \cdot y\right) \cdot a}{y + \left(t + x\right)} + -1 \cdot \frac{y \cdot b}{y + \left(t + x\right)}\right) \]

      associate-+r+ [=>]40.8%

      \[ \color{blue}{\left(\frac{\left(y + x\right) \cdot z}{y + \left(t + x\right)} + -1 \cdot \frac{\left(-1 \cdot t + -1 \cdot y\right) \cdot a}{y + \left(t + x\right)}\right) + -1 \cdot \frac{y \cdot b}{y + \left(t + x\right)}} \]

      mul-1-neg [=>]40.8%

      \[ \left(\frac{\left(y + x\right) \cdot z}{y + \left(t + x\right)} + -1 \cdot \frac{\left(-1 \cdot t + -1 \cdot y\right) \cdot a}{y + \left(t + x\right)}\right) + \color{blue}{\left(-\frac{y \cdot b}{y + \left(t + x\right)}\right)} \]

      unsub-neg [=>]40.8%

      \[ \color{blue}{\left(\frac{\left(y + x\right) \cdot z}{y + \left(t + x\right)} + -1 \cdot \frac{\left(-1 \cdot t + -1 \cdot y\right) \cdot a}{y + \left(t + x\right)}\right) - \frac{y \cdot b}{y + \left(t + x\right)}} \]

    if -1.04999999999999995e28 < t < 1.28e8

    1. Initial program 61.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. Simplified61.6%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, a - b, \mathsf{fma}\left(x + y, z, t \cdot a\right)\right)}{x + \left(y + t\right)}} \]
      Step-by-step derivation

      [Start]61.3%

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

      *-commutative [=>]61.3%

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

      distribute-rgt-in [=>]61.3%

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

      associate-+r+ [=>]61.3%

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

      associate--l+ [=>]61.3%

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

      +-commutative [=>]61.3%

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

      +-commutative [=>]61.3%

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

      distribute-lft-out-- [=>]61.5%

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

      fma-def [=>]61.6%

      \[ \frac{\color{blue}{\mathsf{fma}\left(y, a - b, t \cdot a + \left(x + y\right) \cdot z\right)}}{\left(x + t\right) + y} \]

      +-commutative [<=]61.6%

      \[ \frac{\mathsf{fma}\left(y, a - b, \color{blue}{\left(x + y\right) \cdot z + t \cdot a}\right)}{\left(x + t\right) + y} \]

      fma-def [=>]61.6%

      \[ \frac{\mathsf{fma}\left(y, a - b, \color{blue}{\mathsf{fma}\left(x + y, z, t \cdot a\right)}\right)}{\left(x + t\right) + y} \]

      associate-+l+ [=>]61.6%

      \[ \frac{\mathsf{fma}\left(y, a - b, \mathsf{fma}\left(x + y, z, t \cdot a\right)\right)}{\color{blue}{x + \left(t + y\right)}} \]

      +-commutative [=>]61.6%

      \[ \frac{\mathsf{fma}\left(y, a - b, \mathsf{fma}\left(x + y, z, t \cdot a\right)\right)}{x + \color{blue}{\left(y + t\right)}} \]
    3. Taylor expanded in z around inf 61.5%

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

      \[\leadsto \color{blue}{\frac{y + x}{\frac{y + \left(t + x\right)}{z}} + \left(\frac{a \cdot t}{y + \left(t + x\right)} + \frac{y}{\frac{y + \left(t + x\right)}{a - b}}\right)} \]
      Step-by-step derivation

      [Start]61.5%

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

      associate-/l* [=>]64.9%

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

      +-commutative [=>]64.9%

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

      associate-/l* [=>]87.2%

      \[ \frac{y + x}{\frac{y + \left(t + x\right)}{z}} + \left(\frac{a \cdot t}{y + \left(t + x\right)} + \color{blue}{\frac{y}{\frac{y + \left(t + x\right)}{a - b}}}\right) \]
    5. Applied egg-rr90.4%

      \[\leadsto \frac{y + x}{\frac{y + \left(t + x\right)}{z}} + \left(\frac{a \cdot t}{y + \left(t + x\right)} + \color{blue}{\frac{y}{y + \left(x + t\right)} \cdot \left(a - b\right)}\right) \]
      Step-by-step derivation

      [Start]87.2%

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

      associate-/r/ [=>]90.4%

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

      +-commutative [<=]90.4%

      \[ \frac{y + x}{\frac{y + \left(t + x\right)}{z}} + \left(\frac{a \cdot t}{y + \left(t + x\right)} + \frac{y}{y + \color{blue}{\left(x + t\right)}} \cdot \left(a - b\right)\right) \]
    6. Taylor expanded in y around inf 97.8%

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

    if 1.28e8 < t

    1. Initial program 58.2%

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, a - b, \mathsf{fma}\left(x + y, z, t \cdot a\right)\right)}{x + \left(y + t\right)}} \]
      Step-by-step derivation

      [Start]58.2%

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

      *-commutative [=>]58.2%

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

      distribute-rgt-in [=>]58.2%

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

      associate-+r+ [=>]58.2%

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

      associate--l+ [=>]58.2%

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

      +-commutative [=>]58.2%

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

      +-commutative [=>]58.2%

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

      distribute-lft-out-- [=>]58.2%

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

      fma-def [=>]58.2%

      \[ \frac{\color{blue}{\mathsf{fma}\left(y, a - b, t \cdot a + \left(x + y\right) \cdot z\right)}}{\left(x + t\right) + y} \]

      +-commutative [<=]58.2%

      \[ \frac{\mathsf{fma}\left(y, a - b, \color{blue}{\left(x + y\right) \cdot z + t \cdot a}\right)}{\left(x + t\right) + y} \]

      fma-def [=>]58.2%

      \[ \frac{\mathsf{fma}\left(y, a - b, \color{blue}{\mathsf{fma}\left(x + y, z, t \cdot a\right)}\right)}{\left(x + t\right) + y} \]

      associate-+l+ [=>]58.2%

      \[ \frac{\mathsf{fma}\left(y, a - b, \mathsf{fma}\left(x + y, z, t \cdot a\right)\right)}{\color{blue}{x + \left(t + y\right)}} \]

      +-commutative [=>]58.2%

      \[ \frac{\mathsf{fma}\left(y, a - b, \mathsf{fma}\left(x + y, z, t \cdot a\right)\right)}{x + \color{blue}{\left(y + t\right)}} \]
    3. Taylor expanded in z around inf 58.2%

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

      \[\leadsto \color{blue}{\frac{y + x}{\frac{y + \left(t + x\right)}{z}} + \left(\frac{a \cdot t}{y + \left(t + x\right)} + \frac{y}{\frac{y + \left(t + x\right)}{a - b}}\right)} \]
      Step-by-step derivation

      [Start]58.2%

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

      associate-/l* [=>]67.5%

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

      +-commutative [=>]67.5%

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

      associate-/l* [=>]73.7%

      \[ \frac{y + x}{\frac{y + \left(t + x\right)}{z}} + \left(\frac{a \cdot t}{y + \left(t + x\right)} + \color{blue}{\frac{y}{\frac{y + \left(t + x\right)}{a - b}}}\right) \]
    5. Taylor expanded in t around inf 96.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.05 \cdot 10^{+28}:\\ \;\;\;\;\left(\frac{y + x}{\frac{y + \left(t + x\right)}{z}} + \frac{t + y}{\frac{y + \left(t + x\right)}{a}}\right) - \frac{y \cdot b}{y + \left(t + x\right)}\\ \mathbf{elif}\;t \leq 128000000:\\ \;\;\;\;z + \left(\frac{t \cdot a}{y + \left(t + x\right)} + \frac{y}{y + \left(t + x\right)} \cdot \left(a - b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y + x}{\frac{y + \left(t + x\right)}{z}} + \left(a + \frac{y}{\frac{y + \left(t + x\right)}{a - b}}\right)\\ \end{array} \]

Alternatives

Alternative 1
Accuracy88.3%
Cost2244
\[\begin{array}{l} t_1 := y + \left(t + x\right)\\ t_2 := \frac{y + x}{\frac{t_1}{z}}\\ \mathbf{if}\;t \leq -1.05 \cdot 10^{+28}:\\ \;\;\;\;\left(t_2 + \frac{t + y}{\frac{t_1}{a}}\right) - \frac{y \cdot b}{t_1}\\ \mathbf{elif}\;t \leq 128000000:\\ \;\;\;\;z + \left(\frac{t \cdot a}{t_1} + \frac{y}{t_1} \cdot \left(a - b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_2 + \left(a + \frac{y}{\frac{t_1}{a - b}}\right)\\ \end{array} \]
Alternative 2
Accuracy87.9%
Cost4169
\[\begin{array}{l} t_1 := \frac{\left(z \cdot \left(y + x\right) + a \cdot \left(t + y\right)\right) - y \cdot b}{y + \left(t + x\right)}\\ \mathbf{if}\;t_1 \leq -2 \cdot 10^{+275} \lor \neg \left(t_1 \leq 2 \cdot 10^{+283}\right):\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Accuracy89.7%
Cost1865
\[\begin{array}{l} t_1 := y + \left(t + x\right)\\ \mathbf{if}\;t \leq -1.6 \cdot 10^{+50} \lor \neg \left(t \leq 122000000\right):\\ \;\;\;\;\frac{y + x}{\frac{t_1}{z}} + \left(a + \frac{y}{\frac{t_1}{a - b}}\right)\\ \mathbf{else}:\\ \;\;\;\;z + \left(\frac{t \cdot a}{t_1} + \frac{y}{t_1} \cdot \left(a - b\right)\right)\\ \end{array} \]
Alternative 4
Accuracy80.4%
Cost1736
\[\begin{array}{l} t_1 := y + \left(t + x\right)\\ \mathbf{if}\;t \leq -3.2 \cdot 10^{+96}:\\ \;\;\;\;\frac{a}{\frac{t_1}{t + y}}\\ \mathbf{elif}\;t \leq 6.4 \cdot 10^{+171}:\\ \;\;\;\;z + \left(\frac{t \cdot a}{t_1} + \frac{y}{t_1} \cdot \left(a - b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{y}{\frac{t}{a}} + \left(a - \frac{y + x}{\frac{t}{a}}\right)\right) - \frac{y}{\frac{t}{b}}\\ \end{array} \]
Alternative 5
Accuracy64.2%
Cost969
\[\begin{array}{l} \mathbf{if}\;y \leq -1.5 \cdot 10^{-95} \lor \neg \left(y \leq 1200\right):\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{else}:\\ \;\;\;\;\frac{t \cdot a + x \cdot z}{t + x}\\ \end{array} \]
Alternative 6
Accuracy59.6%
Cost585
\[\begin{array}{l} \mathbf{if}\;y \leq -8.5 \cdot 10^{-37} \lor \neg \left(y \leq 4.2 \cdot 10^{+81}\right):\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{else}:\\ \;\;\;\;z + a\\ \end{array} \]
Alternative 7
Accuracy52.1%
Cost456
\[\begin{array}{l} \mathbf{if}\;z \leq -0.165:\\ \;\;\;\;z + a\\ \mathbf{elif}\;z \leq 1.76 \cdot 10^{-273}:\\ \;\;\;\;a - b\\ \mathbf{else}:\\ \;\;\;\;z + a\\ \end{array} \]
Alternative 8
Accuracy44.7%
Cost328
\[\begin{array}{l} \mathbf{if}\;z \leq -4.4 \cdot 10^{+19}:\\ \;\;\;\;z\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+75}:\\ \;\;\;\;a\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \]
Alternative 9
Accuracy52.3%
Cost324
\[\begin{array}{l} \mathbf{if}\;x \leq 1.9 \cdot 10^{+234}:\\ \;\;\;\;z + a\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \]
Alternative 10
Accuracy51.7%
Cost324
\[\begin{array}{l} \mathbf{if}\;b \leq 2.6 \cdot 10^{+147}:\\ \;\;\;\;z + a\\ \mathbf{else}:\\ \;\;\;\;z - b\\ \end{array} \]
Alternative 11
Accuracy33.2%
Cost64
\[a \]

Reproduce?

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