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

Percentage Accurate: 60.7% → 87.5%
Time: 13.6s
Alternatives: 10
Speedup: 0.8×

Specification

?
\[\begin{array}{l} \\ \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (/ (- (+ (* (+ 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) {
	return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
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
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);
}
def code(x, y, z, t, a, b):
	return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
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 tmp = code(x, y, z, t, a, b)
	tmp = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
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]
\begin{array}{l}

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

Sampling outcomes in binary64 precision:

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.

Accuracy vs Speed?

Herbie found 10 alternatives:

AlternativeAccuracySpeedup
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.

Initial Program: 60.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (/ (- (+ (* (+ 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) {
	return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
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
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);
}
def code(x, y, z, t, a, b):
	return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
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 tmp = code(x, y, z, t, a, b)
	tmp = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
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]
\begin{array}{l}

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

Alternative 1: 87.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\left(z \cdot \left(x + y\right) + \left(y + t\right) \cdot a\right) - y \cdot b}{y + \left(x + t\right)}\\ \mathbf{if}\;t\_1 \leq -1 \cdot 10^{+246} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+292}\right):\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (/ (- (+ (* z (+ x y)) (* (+ y t) a)) (* y b)) (+ y (+ x t)))))
   (if (or (<= t_1 -1e+246) (not (<= t_1 2e+292))) (- (+ z a) b) t_1)))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (((z * (x + y)) + ((y + t) * a)) - (y * b)) / (y + (x + t));
	double tmp;
	if ((t_1 <= -1e+246) || !(t_1 <= 2e+292)) {
		tmp = (z + a) - b;
	} else {
		tmp = t_1;
	}
	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
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (((z * (x + y)) + ((y + t) * a)) - (y * b)) / (y + (x + t))
    if ((t_1 <= (-1d+246)) .or. (.not. (t_1 <= 2d+292))) then
        tmp = (z + a) - b
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (((z * (x + y)) + ((y + t) * a)) - (y * b)) / (y + (x + t));
	double tmp;
	if ((t_1 <= -1e+246) || !(t_1 <= 2e+292)) {
		tmp = (z + a) - b;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = (((z * (x + y)) + ((y + t) * a)) - (y * b)) / (y + (x + t))
	tmp = 0
	if (t_1 <= -1e+246) or not (t_1 <= 2e+292):
		tmp = (z + a) - b
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(Float64(Float64(z * Float64(x + y)) + Float64(Float64(y + t) * a)) - Float64(y * b)) / Float64(y + Float64(x + t)))
	tmp = 0.0
	if ((t_1 <= -1e+246) || !(t_1 <= 2e+292))
		tmp = Float64(Float64(z + a) - b);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = (((z * (x + y)) + ((y + t) * a)) - (y * b)) / (y + (x + t));
	tmp = 0.0;
	if ((t_1 <= -1e+246) || ~((t_1 <= 2e+292)))
		tmp = (z + a) - b;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(N[(y + t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e+246], N[Not[LessEqual[t$95$1, 2e+292]], $MachinePrecision]], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], t$95$1]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{\left(z \cdot \left(x + y\right) + \left(y + t\right) \cdot a\right) - y \cdot b}{y + \left(x + t\right)}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+246} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+292}\right):\\
\;\;\;\;\left(z + a\right) - b\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\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)) < -1.00000000000000007e246 or 2e292 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y))

    1. Initial program 10.7%

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 75.0%

      \[\leadsto \color{blue}{\left(a + z\right) - b} \]

    if -1.00000000000000007e246 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2e292

    1. Initial program 99.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. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification89.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left(z \cdot \left(x + y\right) + \left(y + t\right) \cdot a\right) - y \cdot b}{y + \left(x + t\right)} \leq -1 \cdot 10^{+246} \lor \neg \left(\frac{\left(z \cdot \left(x + y\right) + \left(y + t\right) \cdot a\right) - y \cdot b}{y + \left(x + t\right)} \leq 2 \cdot 10^{+292}\right):\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(z \cdot \left(x + y\right) + \left(y + t\right) \cdot a\right) - y \cdot b}{y + \left(x + t\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 69.0% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.5 \cdot 10^{+47} \lor \neg \left(y \leq 4.6 \cdot 10^{-27}\right):\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(\frac{x}{x + t} + \frac{a}{z} \cdot \frac{t}{x + t}\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= y -2.5e+47) (not (<= y 4.6e-27)))
   (- (+ z a) b)
   (* z (+ (/ x (+ x t)) (* (/ a z) (/ t (+ x t)))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((y <= -2.5e+47) || !(y <= 4.6e-27)) {
		tmp = (z + a) - b;
	} else {
		tmp = z * ((x / (x + t)) + ((a / z) * (t / (x + t))));
	}
	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
    real(8) :: tmp
    if ((y <= (-2.5d+47)) .or. (.not. (y <= 4.6d-27))) then
        tmp = (z + a) - b
    else
        tmp = z * ((x / (x + t)) + ((a / z) * (t / (x + t))))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((y <= -2.5e+47) || !(y <= 4.6e-27)) {
		tmp = (z + a) - b;
	} else {
		tmp = z * ((x / (x + t)) + ((a / z) * (t / (x + t))));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if (y <= -2.5e+47) or not (y <= 4.6e-27):
		tmp = (z + a) - b
	else:
		tmp = z * ((x / (x + t)) + ((a / z) * (t / (x + t))))
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if ((y <= -2.5e+47) || !(y <= 4.6e-27))
		tmp = Float64(Float64(z + a) - b);
	else
		tmp = Float64(z * Float64(Float64(x / Float64(x + t)) + Float64(Float64(a / z) * Float64(t / Float64(x + t)))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if ((y <= -2.5e+47) || ~((y <= 4.6e-27)))
		tmp = (z + a) - b;
	else
		tmp = z * ((x / (x + t)) + ((a / z) * (t / (x + t))));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -2.5e+47], N[Not[LessEqual[y, 4.6e-27]], $MachinePrecision]], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], N[(z * N[(N[(x / N[(x + t), $MachinePrecision]), $MachinePrecision] + N[(N[(a / z), $MachinePrecision] * N[(t / N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{+47} \lor \neg \left(y \leq 4.6 \cdot 10^{-27}\right):\\
\;\;\;\;\left(z + a\right) - b\\

\mathbf{else}:\\
\;\;\;\;z \cdot \left(\frac{x}{x + t} + \frac{a}{z} \cdot \frac{t}{x + t}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.50000000000000011e47 or 4.5999999999999999e-27 < y

    1. Initial program 40.6%

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 77.3%

      \[\leadsto \color{blue}{\left(a + z\right) - b} \]

    if -2.50000000000000011e47 < y < 4.5999999999999999e-27

    1. Initial program 81.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. Add Preprocessing
    3. Taylor expanded in z around inf 83.5%

      \[\leadsto \color{blue}{z \cdot \left(\left(\frac{x}{t + \left(x + y\right)} + \left(\frac{y}{t + \left(x + y\right)} + \frac{a \cdot \left(t + y\right)}{z \cdot \left(t + \left(x + y\right)\right)}\right)\right) - \frac{b \cdot y}{z \cdot \left(t + \left(x + y\right)\right)}\right)} \]
    4. Step-by-step derivation
      1. associate--l+83.5%

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

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

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

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

        \[\leadsto z \cdot \left(\frac{x}{t + \left(y + x\right)} + \left(\left(\frac{y}{t + \left(y + x\right)} + \frac{a}{z} \cdot \frac{t + y}{t + \color{blue}{\left(y + x\right)}}\right) - \frac{b \cdot y}{z \cdot \left(t + \left(x + y\right)\right)}\right)\right) \]
      6. times-frac75.9%

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

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

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

      \[\leadsto \color{blue}{z \cdot \left(\frac{x}{t + x} + \frac{a \cdot t}{z \cdot \left(t + x\right)}\right)} \]
    7. Step-by-step derivation
      1. times-frac67.3%

        \[\leadsto z \cdot \left(\frac{x}{t + x} + \color{blue}{\frac{a}{z} \cdot \frac{t}{t + x}}\right) \]
    8. Simplified67.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.5 \cdot 10^{+47} \lor \neg \left(y \leq 4.6 \cdot 10^{-27}\right):\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(\frac{x}{x + t} + \frac{a}{z} \cdot \frac{t}{x + t}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 64.9% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(z + a\right) - b\\ \mathbf{if}\;y \leq -1.3 \cdot 10^{-19}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 7.7 \cdot 10^{-118}:\\ \;\;\;\;\frac{t \cdot a + x \cdot z}{x + t}\\ \mathbf{elif}\;y \leq 8.2 \cdot 10^{+20}:\\ \;\;\;\;z + \frac{y \cdot \left(a - b\right)}{x + y}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (- (+ z a) b)))
   (if (<= y -1.3e-19)
     t_1
     (if (<= y 7.7e-118)
       (/ (+ (* t a) (* x z)) (+ x t))
       (if (<= y 8.2e+20) (+ z (/ (* y (- a b)) (+ x y))) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (z + a) - b;
	double tmp;
	if (y <= -1.3e-19) {
		tmp = t_1;
	} else if (y <= 7.7e-118) {
		tmp = ((t * a) + (x * z)) / (x + t);
	} else if (y <= 8.2e+20) {
		tmp = z + ((y * (a - b)) / (x + y));
	} else {
		tmp = t_1;
	}
	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
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (z + a) - b
    if (y <= (-1.3d-19)) then
        tmp = t_1
    else if (y <= 7.7d-118) then
        tmp = ((t * a) + (x * z)) / (x + t)
    else if (y <= 8.2d+20) then
        tmp = z + ((y * (a - b)) / (x + y))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (z + a) - b;
	double tmp;
	if (y <= -1.3e-19) {
		tmp = t_1;
	} else if (y <= 7.7e-118) {
		tmp = ((t * a) + (x * z)) / (x + t);
	} else if (y <= 8.2e+20) {
		tmp = z + ((y * (a - b)) / (x + y));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = (z + a) - b
	tmp = 0
	if y <= -1.3e-19:
		tmp = t_1
	elif y <= 7.7e-118:
		tmp = ((t * a) + (x * z)) / (x + t)
	elif y <= 8.2e+20:
		tmp = z + ((y * (a - b)) / (x + y))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(z + a) - b)
	tmp = 0.0
	if (y <= -1.3e-19)
		tmp = t_1;
	elseif (y <= 7.7e-118)
		tmp = Float64(Float64(Float64(t * a) + Float64(x * z)) / Float64(x + t));
	elseif (y <= 8.2e+20)
		tmp = Float64(z + Float64(Float64(y * Float64(a - b)) / Float64(x + y)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = (z + a) - b;
	tmp = 0.0;
	if (y <= -1.3e-19)
		tmp = t_1;
	elseif (y <= 7.7e-118)
		tmp = ((t * a) + (x * z)) / (x + t);
	elseif (y <= 8.2e+20)
		tmp = z + ((y * (a - b)) / (x + y));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[y, -1.3e-19], t$95$1, If[LessEqual[y, 7.7e-118], N[(N[(N[(t * a), $MachinePrecision] + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(x + t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.2e+20], N[(z + N[(N[(y * N[(a - b), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(z + a\right) - b\\
\mathbf{if}\;y \leq -1.3 \cdot 10^{-19}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 7.7 \cdot 10^{-118}:\\
\;\;\;\;\frac{t \cdot a + x \cdot z}{x + t}\\

\mathbf{elif}\;y \leq 8.2 \cdot 10^{+20}:\\
\;\;\;\;z + \frac{y \cdot \left(a - b\right)}{x + y}\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.30000000000000006e-19 or 8.2e20 < y

    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. Add Preprocessing
    3. Taylor expanded in y around inf 76.1%

      \[\leadsto \color{blue}{\left(a + z\right) - b} \]

    if -1.30000000000000006e-19 < y < 7.6999999999999996e-118

    1. Initial program 85.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. Add Preprocessing
    3. Taylor expanded in y around 0 66.6%

      \[\leadsto \color{blue}{\frac{a \cdot t + x \cdot z}{t + x}} \]

    if 7.6999999999999996e-118 < y < 8.2e20

    1. Initial program 68.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. Add Preprocessing
    3. Taylor expanded in t around 0 57.6%

      \[\leadsto \color{blue}{\frac{\left(a \cdot y + z \cdot \left(x + y\right)\right) - b \cdot y}{x + y}} \]
    4. Taylor expanded in a around 0 71.8%

      \[\leadsto \color{blue}{\left(z + \frac{a \cdot y}{x + y}\right) - \frac{b \cdot y}{x + y}} \]
    5. Step-by-step derivation
      1. associate--l+71.8%

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

        \[\leadsto z + \color{blue}{\frac{a \cdot y - b \cdot y}{x + y}} \]
      3. distribute-rgt-out--71.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.3 \cdot 10^{-19}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{elif}\;y \leq 7.7 \cdot 10^{-118}:\\ \;\;\;\;\frac{t \cdot a + x \cdot z}{x + t}\\ \mathbf{elif}\;y \leq 8.2 \cdot 10^{+20}:\\ \;\;\;\;z + \frac{y \cdot \left(a - b\right)}{x + y}\\ \mathbf{else}:\\ \;\;\;\;\left(z + a\right) - b\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 59.6% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(z + a\right) - b\\ \mathbf{if}\;y \leq -1.1 \cdot 10^{-15}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{-231}:\\ \;\;\;\;a \cdot \frac{y + t}{y + \left(x + t\right)}\\ \mathbf{elif}\;y \leq 8.2 \cdot 10^{+20}:\\ \;\;\;\;z + \frac{y \cdot \left(a - b\right)}{x + y}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (- (+ z a) b)))
   (if (<= y -1.1e-15)
     t_1
     (if (<= y 5.2e-231)
       (* a (/ (+ y t) (+ y (+ x t))))
       (if (<= y 8.2e+20) (+ z (/ (* y (- a b)) (+ x y))) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (z + a) - b;
	double tmp;
	if (y <= -1.1e-15) {
		tmp = t_1;
	} else if (y <= 5.2e-231) {
		tmp = a * ((y + t) / (y + (x + t)));
	} else if (y <= 8.2e+20) {
		tmp = z + ((y * (a - b)) / (x + y));
	} else {
		tmp = t_1;
	}
	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
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (z + a) - b
    if (y <= (-1.1d-15)) then
        tmp = t_1
    else if (y <= 5.2d-231) then
        tmp = a * ((y + t) / (y + (x + t)))
    else if (y <= 8.2d+20) then
        tmp = z + ((y * (a - b)) / (x + y))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (z + a) - b;
	double tmp;
	if (y <= -1.1e-15) {
		tmp = t_1;
	} else if (y <= 5.2e-231) {
		tmp = a * ((y + t) / (y + (x + t)));
	} else if (y <= 8.2e+20) {
		tmp = z + ((y * (a - b)) / (x + y));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = (z + a) - b
	tmp = 0
	if y <= -1.1e-15:
		tmp = t_1
	elif y <= 5.2e-231:
		tmp = a * ((y + t) / (y + (x + t)))
	elif y <= 8.2e+20:
		tmp = z + ((y * (a - b)) / (x + y))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(z + a) - b)
	tmp = 0.0
	if (y <= -1.1e-15)
		tmp = t_1;
	elseif (y <= 5.2e-231)
		tmp = Float64(a * Float64(Float64(y + t) / Float64(y + Float64(x + t))));
	elseif (y <= 8.2e+20)
		tmp = Float64(z + Float64(Float64(y * Float64(a - b)) / Float64(x + y)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = (z + a) - b;
	tmp = 0.0;
	if (y <= -1.1e-15)
		tmp = t_1;
	elseif (y <= 5.2e-231)
		tmp = a * ((y + t) / (y + (x + t)));
	elseif (y <= 8.2e+20)
		tmp = z + ((y * (a - b)) / (x + y));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[y, -1.1e-15], t$95$1, If[LessEqual[y, 5.2e-231], N[(a * N[(N[(y + t), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.2e+20], N[(z + N[(N[(y * N[(a - b), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(z + a\right) - b\\
\mathbf{if}\;y \leq -1.1 \cdot 10^{-15}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 5.2 \cdot 10^{-231}:\\
\;\;\;\;a \cdot \frac{y + t}{y + \left(x + t\right)}\\

\mathbf{elif}\;y \leq 8.2 \cdot 10^{+20}:\\
\;\;\;\;z + \frac{y \cdot \left(a - b\right)}{x + y}\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.09999999999999993e-15 or 8.2e20 < y

    1. Initial program 40.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. Add Preprocessing
    3. Taylor expanded in y around inf 76.0%

      \[\leadsto \color{blue}{\left(a + z\right) - b} \]

    if -1.09999999999999993e-15 < y < 5.20000000000000006e-231

    1. Initial program 84.6%

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \]
    2. Add Preprocessing
    3. Taylor expanded in a around inf 47.2%

      \[\leadsto \color{blue}{\frac{a \cdot \left(t + y\right)}{t + \left(x + y\right)}} \]
    4. Step-by-step derivation
      1. associate-/l*54.0%

        \[\leadsto \color{blue}{a \cdot \frac{t + y}{t + \left(x + y\right)}} \]
      2. associate-+r+54.0%

        \[\leadsto a \cdot \frac{t + y}{\color{blue}{\left(t + x\right) + y}} \]
    5. Simplified54.0%

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

    if 5.20000000000000006e-231 < y < 8.2e20

    1. Initial program 78.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. Add Preprocessing
    3. Taylor expanded in t around 0 57.9%

      \[\leadsto \color{blue}{\frac{\left(a \cdot y + z \cdot \left(x + y\right)\right) - b \cdot y}{x + y}} \]
    4. Taylor expanded in a around 0 67.6%

      \[\leadsto \color{blue}{\left(z + \frac{a \cdot y}{x + y}\right) - \frac{b \cdot y}{x + y}} \]
    5. Step-by-step derivation
      1. associate--l+67.6%

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

        \[\leadsto z + \color{blue}{\frac{a \cdot y - b \cdot y}{x + y}} \]
      3. distribute-rgt-out--67.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.1 \cdot 10^{-15}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{-231}:\\ \;\;\;\;a \cdot \frac{y + t}{y + \left(x + t\right)}\\ \mathbf{elif}\;y \leq 8.2 \cdot 10^{+20}:\\ \;\;\;\;z + \frac{y \cdot \left(a - b\right)}{x + y}\\ \mathbf{else}:\\ \;\;\;\;\left(z + a\right) - b\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 57.6% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y + \left(x + t\right)\\ t_2 := \left(z + a\right) - b\\ \mathbf{if}\;y \leq -3.2 \cdot 10^{-15}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq 1.85 \cdot 10^{-169}:\\ \;\;\;\;a \cdot \frac{y + t}{t\_1}\\ \mathbf{elif}\;y \leq 2.05 \cdot 10^{-30}:\\ \;\;\;\;z \cdot \frac{x + y}{t\_1}\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (+ y (+ x t))) (t_2 (- (+ z a) b)))
   (if (<= y -3.2e-15)
     t_2
     (if (<= y 1.85e-169)
       (* a (/ (+ y t) t_1))
       (if (<= y 2.05e-30) (* z (/ (+ x y) t_1)) t_2)))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = y + (x + t);
	double t_2 = (z + a) - b;
	double tmp;
	if (y <= -3.2e-15) {
		tmp = t_2;
	} else if (y <= 1.85e-169) {
		tmp = a * ((y + t) / t_1);
	} else if (y <= 2.05e-30) {
		tmp = z * ((x + y) / t_1);
	} else {
		tmp = t_2;
	}
	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
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = y + (x + t)
    t_2 = (z + a) - b
    if (y <= (-3.2d-15)) then
        tmp = t_2
    else if (y <= 1.85d-169) then
        tmp = a * ((y + t) / t_1)
    else if (y <= 2.05d-30) then
        tmp = z * ((x + y) / t_1)
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = y + (x + t);
	double t_2 = (z + a) - b;
	double tmp;
	if (y <= -3.2e-15) {
		tmp = t_2;
	} else if (y <= 1.85e-169) {
		tmp = a * ((y + t) / t_1);
	} else if (y <= 2.05e-30) {
		tmp = z * ((x + y) / t_1);
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = y + (x + t)
	t_2 = (z + a) - b
	tmp = 0
	if y <= -3.2e-15:
		tmp = t_2
	elif y <= 1.85e-169:
		tmp = a * ((y + t) / t_1)
	elif y <= 2.05e-30:
		tmp = z * ((x + y) / t_1)
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(y + Float64(x + t))
	t_2 = Float64(Float64(z + a) - b)
	tmp = 0.0
	if (y <= -3.2e-15)
		tmp = t_2;
	elseif (y <= 1.85e-169)
		tmp = Float64(a * Float64(Float64(y + t) / t_1));
	elseif (y <= 2.05e-30)
		tmp = Float64(z * Float64(Float64(x + y) / t_1));
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = y + (x + t);
	t_2 = (z + a) - b;
	tmp = 0.0;
	if (y <= -3.2e-15)
		tmp = t_2;
	elseif (y <= 1.85e-169)
		tmp = a * ((y + t) / t_1);
	elseif (y <= 2.05e-30)
		tmp = z * ((x + y) / t_1);
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[y, -3.2e-15], t$95$2, If[LessEqual[y, 1.85e-169], N[(a * N[(N[(y + t), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.05e-30], N[(z * N[(N[(x + y), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := y + \left(x + t\right)\\
t_2 := \left(z + a\right) - b\\
\mathbf{if}\;y \leq -3.2 \cdot 10^{-15}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;y \leq 1.85 \cdot 10^{-169}:\\
\;\;\;\;a \cdot \frac{y + t}{t\_1}\\

\mathbf{elif}\;y \leq 2.05 \cdot 10^{-30}:\\
\;\;\;\;z \cdot \frac{x + y}{t\_1}\\

\mathbf{else}:\\
\;\;\;\;t\_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.1999999999999999e-15 or 2.0500000000000002e-30 < y

    1. Initial program 42.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. Add Preprocessing
    3. Taylor expanded in y around inf 75.6%

      \[\leadsto \color{blue}{\left(a + z\right) - b} \]

    if -3.1999999999999999e-15 < y < 1.8499999999999999e-169

    1. Initial program 85.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. Add Preprocessing
    3. Taylor expanded in a around inf 46.8%

      \[\leadsto \color{blue}{\frac{a \cdot \left(t + y\right)}{t + \left(x + y\right)}} \]
    4. Step-by-step derivation
      1. associate-/l*53.6%

        \[\leadsto \color{blue}{a \cdot \frac{t + y}{t + \left(x + y\right)}} \]
      2. associate-+r+53.6%

        \[\leadsto a \cdot \frac{t + y}{\color{blue}{\left(t + x\right) + y}} \]
    5. Simplified53.6%

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

    if 1.8499999999999999e-169 < y < 2.0500000000000002e-30

    1. Initial program 70.9%

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 41.0%

      \[\leadsto \color{blue}{\frac{z \cdot \left(x + y\right)}{t + \left(x + y\right)}} \]
    4. Step-by-step derivation
      1. associate-/l*60.3%

        \[\leadsto \color{blue}{z \cdot \frac{x + y}{t + \left(x + y\right)}} \]
      2. +-commutative60.3%

        \[\leadsto z \cdot \frac{\color{blue}{y + x}}{t + \left(x + y\right)} \]
      3. associate-+r+60.3%

        \[\leadsto z \cdot \frac{y + x}{\color{blue}{\left(t + x\right) + y}} \]
    5. Simplified60.3%

      \[\leadsto \color{blue}{z \cdot \frac{y + x}{\left(t + x\right) + y}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification65.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{-15}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{elif}\;y \leq 1.85 \cdot 10^{-169}:\\ \;\;\;\;a \cdot \frac{y + t}{y + \left(x + t\right)}\\ \mathbf{elif}\;y \leq 2.05 \cdot 10^{-30}:\\ \;\;\;\;z \cdot \frac{x + y}{y + \left(x + t\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(z + a\right) - b\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 57.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -8.5 \cdot 10^{-16} \lor \neg \left(y \leq 8.5 \cdot 10^{-150}\right):\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{else}:\\ \;\;\;\;a \cdot \frac{y + t}{y + \left(x + t\right)}\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= y -8.5e-16) (not (<= y 8.5e-150)))
   (- (+ z a) b)
   (* a (/ (+ y t) (+ y (+ x t))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((y <= -8.5e-16) || !(y <= 8.5e-150)) {
		tmp = (z + a) - b;
	} else {
		tmp = a * ((y + t) / (y + (x + t)));
	}
	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
    real(8) :: tmp
    if ((y <= (-8.5d-16)) .or. (.not. (y <= 8.5d-150))) then
        tmp = (z + a) - b
    else
        tmp = a * ((y + t) / (y + (x + t)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((y <= -8.5e-16) || !(y <= 8.5e-150)) {
		tmp = (z + a) - b;
	} else {
		tmp = a * ((y + t) / (y + (x + t)));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if (y <= -8.5e-16) or not (y <= 8.5e-150):
		tmp = (z + a) - b
	else:
		tmp = a * ((y + t) / (y + (x + t)))
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if ((y <= -8.5e-16) || !(y <= 8.5e-150))
		tmp = Float64(Float64(z + a) - b);
	else
		tmp = Float64(a * Float64(Float64(y + t) / Float64(y + Float64(x + t))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if ((y <= -8.5e-16) || ~((y <= 8.5e-150)))
		tmp = (z + a) - b;
	else
		tmp = a * ((y + t) / (y + (x + t)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -8.5e-16], N[Not[LessEqual[y, 8.5e-150]], $MachinePrecision]], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], N[(a * N[(N[(y + t), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{-16} \lor \neg \left(y \leq 8.5 \cdot 10^{-150}\right):\\
\;\;\;\;\left(z + a\right) - b\\

\mathbf{else}:\\
\;\;\;\;a \cdot \frac{y + t}{y + \left(x + t\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -8.5000000000000001e-16 or 8.4999999999999997e-150 < y

    1. Initial program 47.0%

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 70.2%

      \[\leadsto \color{blue}{\left(a + z\right) - b} \]

    if -8.5000000000000001e-16 < y < 8.4999999999999997e-150

    1. Initial program 85.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. Add Preprocessing
    3. Taylor expanded in a around inf 46.5%

      \[\leadsto \color{blue}{\frac{a \cdot \left(t + y\right)}{t + \left(x + y\right)}} \]
    4. Step-by-step derivation
      1. associate-/l*53.1%

        \[\leadsto \color{blue}{a \cdot \frac{t + y}{t + \left(x + y\right)}} \]
      2. associate-+r+53.1%

        \[\leadsto a \cdot \frac{t + y}{\color{blue}{\left(t + x\right) + y}} \]
    5. Simplified53.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8.5 \cdot 10^{-16} \lor \neg \left(y \leq 8.5 \cdot 10^{-150}\right):\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{else}:\\ \;\;\;\;a \cdot \frac{y + t}{y + \left(x + t\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 57.1% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1.5 \cdot 10^{+119}:\\ \;\;\;\;a \cdot \frac{t}{x + t}\\ \mathbf{else}:\\ \;\;\;\;\left(z + a\right) - b\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= t -1.5e+119) (* a (/ t (+ x t))) (- (+ z a) b)))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (t <= -1.5e+119) {
		tmp = a * (t / (x + t));
	} else {
		tmp = (z + 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
    real(8) :: tmp
    if (t <= (-1.5d+119)) then
        tmp = a * (t / (x + t))
    else
        tmp = (z + a) - b
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (t <= -1.5e+119) {
		tmp = a * (t / (x + t));
	} else {
		tmp = (z + a) - b;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if t <= -1.5e+119:
		tmp = a * (t / (x + t))
	else:
		tmp = (z + a) - b
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (t <= -1.5e+119)
		tmp = Float64(a * Float64(t / Float64(x + t)));
	else
		tmp = Float64(Float64(z + a) - b);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (t <= -1.5e+119)
		tmp = a * (t / (x + t));
	else
		tmp = (z + a) - b;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.5e+119], N[(a * N[(t / N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.5 \cdot 10^{+119}:\\
\;\;\;\;a \cdot \frac{t}{x + t}\\

\mathbf{else}:\\
\;\;\;\;\left(z + a\right) - b\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.50000000000000001e119

    1. Initial program 53.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. Add Preprocessing
    3. Taylor expanded in y around 0 47.4%

      \[\leadsto \color{blue}{\frac{a \cdot t + x \cdot z}{t + x}} \]
    4. Taylor expanded in a around inf 40.0%

      \[\leadsto \color{blue}{\frac{a \cdot t}{t + x}} \]
    5. Step-by-step derivation
      1. associate-/l*63.5%

        \[\leadsto \color{blue}{a \cdot \frac{t}{t + x}} \]
      2. +-commutative63.5%

        \[\leadsto a \cdot \frac{t}{\color{blue}{x + t}} \]
    6. Simplified63.5%

      \[\leadsto \color{blue}{a \cdot \frac{t}{x + t}} \]

    if -1.50000000000000001e119 < t

    1. Initial program 63.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. Add Preprocessing
    3. Taylor expanded in y around inf 61.5%

      \[\leadsto \color{blue}{\left(a + z\right) - b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification61.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.5 \cdot 10^{+119}:\\ \;\;\;\;a \cdot \frac{t}{x + t}\\ \mathbf{else}:\\ \;\;\;\;\left(z + a\right) - b\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 43.7% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.65 \cdot 10^{+58}:\\ \;\;\;\;z\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{-43}:\\ \;\;\;\;a\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= x -1.65e+58) z (if (<= x 1.35e-43) a z)))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (x <= -1.65e+58) {
		tmp = z;
	} else if (x <= 1.35e-43) {
		tmp = a;
	} else {
		tmp = z;
	}
	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
    real(8) :: tmp
    if (x <= (-1.65d+58)) then
        tmp = z
    else if (x <= 1.35d-43) then
        tmp = a
    else
        tmp = z
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (x <= -1.65e+58) {
		tmp = z;
	} else if (x <= 1.35e-43) {
		tmp = a;
	} else {
		tmp = z;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if x <= -1.65e+58:
		tmp = z
	elif x <= 1.35e-43:
		tmp = a
	else:
		tmp = z
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (x <= -1.65e+58)
		tmp = z;
	elseif (x <= 1.35e-43)
		tmp = a;
	else
		tmp = z;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (x <= -1.65e+58)
		tmp = z;
	elseif (x <= 1.35e-43)
		tmp = a;
	else
		tmp = z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -1.65e+58], z, If[LessEqual[x, 1.35e-43], a, z]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{+58}:\\
\;\;\;\;z\\

\mathbf{elif}\;x \leq 1.35 \cdot 10^{-43}:\\
\;\;\;\;a\\

\mathbf{else}:\\
\;\;\;\;z\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.64999999999999991e58 or 1.34999999999999996e-43 < x

    1. Initial program 53.6%

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 47.4%

      \[\leadsto \color{blue}{z} \]

    if -1.64999999999999991e58 < x < 1.34999999999999996e-43

    1. Initial program 69.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. Add Preprocessing
    3. Taylor expanded in t around inf 48.8%

      \[\leadsto \color{blue}{a} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 56.4% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1.45 \cdot 10^{+124}:\\ \;\;\;\;a\\ \mathbf{else}:\\ \;\;\;\;\left(z + a\right) - b\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= t -1.45e+124) a (- (+ z a) b)))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (t <= -1.45e+124) {
		tmp = a;
	} else {
		tmp = (z + 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
    real(8) :: tmp
    if (t <= (-1.45d+124)) then
        tmp = a
    else
        tmp = (z + a) - b
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (t <= -1.45e+124) {
		tmp = a;
	} else {
		tmp = (z + a) - b;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if t <= -1.45e+124:
		tmp = a
	else:
		tmp = (z + a) - b
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (t <= -1.45e+124)
		tmp = a;
	else
		tmp = Float64(Float64(z + a) - b);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (t <= -1.45e+124)
		tmp = a;
	else
		tmp = (z + a) - b;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.45e+124], a, N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.45 \cdot 10^{+124}:\\
\;\;\;\;a\\

\mathbf{else}:\\
\;\;\;\;\left(z + a\right) - b\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.45000000000000011e124

    1. Initial program 53.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. Add Preprocessing
    3. Taylor expanded in t around inf 57.2%

      \[\leadsto \color{blue}{a} \]

    if -1.45000000000000011e124 < t

    1. Initial program 63.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. Add Preprocessing
    3. Taylor expanded in y around inf 61.5%

      \[\leadsto \color{blue}{\left(a + z\right) - b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification60.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.45 \cdot 10^{+124}:\\ \;\;\;\;a\\ \mathbf{else}:\\ \;\;\;\;\left(z + a\right) - b\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 32.1% accurate, 21.0× speedup?

\[\begin{array}{l} \\ a \end{array} \]
(FPCore (x y z t a b) :precision binary64 a)
double code(double x, double y, double z, double t, double a, double b) {
	return a;
}
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 = a
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return a;
}
def code(x, y, z, t, a, b):
	return a
function code(x, y, z, t, a, b)
	return a
end
function tmp = code(x, y, z, t, a, b)
	tmp = a;
end
code[x_, y_, z_, t_, a_, b_] := a
\begin{array}{l}

\\
a
\end{array}
Derivation
  1. Initial program 61.5%

    \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \]
  2. Add Preprocessing
  3. Taylor expanded in t around inf 31.1%

    \[\leadsto \color{blue}{a} \]
  4. Add Preprocessing

Developer Target 1: 82.1% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(x + t\right) + y\\ t_2 := \left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b\\ t_3 := \frac{t\_2}{t\_1}\\ t_4 := \left(z + a\right) - b\\ \mathbf{if}\;t\_3 < -3.5813117084150564 \cdot 10^{+153}:\\ \;\;\;\;t\_4\\ \mathbf{elif}\;t\_3 < 1.2285964308315609 \cdot 10^{+82}:\\ \;\;\;\;\frac{1}{\frac{t\_1}{t\_2}}\\ \mathbf{else}:\\ \;\;\;\;t\_4\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (+ (+ x t) y))
        (t_2 (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)))
        (t_3 (/ t_2 t_1))
        (t_4 (- (+ z a) b)))
   (if (< t_3 -3.5813117084150564e+153)
     t_4
     (if (< t_3 1.2285964308315609e+82) (/ 1.0 (/ t_1 t_2)) t_4))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (x + t) + y;
	double t_2 = (((x + y) * z) + ((t + y) * a)) - (y * b);
	double t_3 = t_2 / t_1;
	double t_4 = (z + a) - b;
	double tmp;
	if (t_3 < -3.5813117084150564e+153) {
		tmp = t_4;
	} else if (t_3 < 1.2285964308315609e+82) {
		tmp = 1.0 / (t_1 / t_2);
	} else {
		tmp = t_4;
	}
	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
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_1 = (x + t) + y
    t_2 = (((x + y) * z) + ((t + y) * a)) - (y * b)
    t_3 = t_2 / t_1
    t_4 = (z + a) - b
    if (t_3 < (-3.5813117084150564d+153)) then
        tmp = t_4
    else if (t_3 < 1.2285964308315609d+82) then
        tmp = 1.0d0 / (t_1 / t_2)
    else
        tmp = t_4
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (x + t) + y;
	double t_2 = (((x + y) * z) + ((t + y) * a)) - (y * b);
	double t_3 = t_2 / t_1;
	double t_4 = (z + a) - b;
	double tmp;
	if (t_3 < -3.5813117084150564e+153) {
		tmp = t_4;
	} else if (t_3 < 1.2285964308315609e+82) {
		tmp = 1.0 / (t_1 / t_2);
	} else {
		tmp = t_4;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = (x + t) + y
	t_2 = (((x + y) * z) + ((t + y) * a)) - (y * b)
	t_3 = t_2 / t_1
	t_4 = (z + a) - b
	tmp = 0
	if t_3 < -3.5813117084150564e+153:
		tmp = t_4
	elif t_3 < 1.2285964308315609e+82:
		tmp = 1.0 / (t_1 / t_2)
	else:
		tmp = t_4
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(x + t) + y)
	t_2 = Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b))
	t_3 = Float64(t_2 / t_1)
	t_4 = Float64(Float64(z + a) - b)
	tmp = 0.0
	if (t_3 < -3.5813117084150564e+153)
		tmp = t_4;
	elseif (t_3 < 1.2285964308315609e+82)
		tmp = Float64(1.0 / Float64(t_1 / t_2));
	else
		tmp = t_4;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = (x + t) + y;
	t_2 = (((x + y) * z) + ((t + y) * a)) - (y * b);
	t_3 = t_2 / t_1;
	t_4 = (z + a) - b;
	tmp = 0.0;
	if (t_3 < -3.5813117084150564e+153)
		tmp = t_4;
	elseif (t_3 < 1.2285964308315609e+82)
		tmp = 1.0 / (t_1 / t_2);
	else
		tmp = t_4;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / t$95$1), $MachinePrecision]}, Block[{t$95$4 = N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]}, If[Less[t$95$3, -3.5813117084150564e+153], t$95$4, If[Less[t$95$3, 1.2285964308315609e+82], N[(1.0 / N[(t$95$1 / t$95$2), $MachinePrecision]), $MachinePrecision], t$95$4]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b\\
t_3 := \frac{t\_2}{t\_1}\\
t_4 := \left(z + a\right) - b\\
\mathbf{if}\;t\_3 < -3.5813117084150564 \cdot 10^{+153}:\\
\;\;\;\;t\_4\\

\mathbf{elif}\;t\_3 < 1.2285964308315609 \cdot 10^{+82}:\\
\;\;\;\;\frac{1}{\frac{t\_1}{t\_2}}\\

\mathbf{else}:\\
\;\;\;\;t\_4\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024118 
(FPCore (x y z t a b)
  :name "AI.Clustering.Hierarchical.Internal:ward from clustering-0.2.1"
  :precision binary64

  :alt
  (! :herbie-platform default (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) -3581311708415056400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (+ z a) b) (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) 12285964308315609000000000000000000000000000000000000000000000000000000000000000000) (/ 1 (/ (+ (+ 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)))