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

Percentage Accurate: 60.6% → 87.8%
Time: 12.1s
Alternatives: 12
Speedup: 1.0×

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 12 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.6% 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.8% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\left(a \cdot \left(y + t\right) + z \cdot \left(x + y\right)\right) - y \cdot b}{y + \left(x + t\right)}\\ \mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 2 \cdot 10^{+264}\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 (/ (- (+ (* a (+ y t)) (* z (+ x y))) (* y b)) (+ y (+ x t)))))
   (if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+264))) (- (+ z a) b) t_1)))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (((a * (y + t)) + (z * (x + y))) - (y * b)) / (y + (x + t));
	double tmp;
	if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e+264)) {
		tmp = (z + a) - b;
	} else {
		tmp = t_1;
	}
	return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (((a * (y + t)) + (z * (x + y))) - (y * b)) / (y + (x + t));
	double tmp;
	if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 2e+264)) {
		tmp = (z + a) - b;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = (((a * (y + t)) + (z * (x + y))) - (y * b)) / (y + (x + t))
	tmp = 0
	if (t_1 <= -math.inf) or not (t_1 <= 2e+264):
		tmp = (z + a) - b
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(Float64(Float64(a * Float64(y + t)) + Float64(z * Float64(x + y))) - Float64(y * b)) / Float64(y + Float64(x + t)))
	tmp = 0.0
	if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e+264))
		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 = (((a * (y + t)) + (z * (x + y))) - (y * b)) / (y + (x + t));
	tmp = 0.0;
	if ((t_1 <= -Inf) || ~((t_1 <= 2e+264)))
		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[(a * N[(y + t), $MachinePrecision]), $MachinePrecision] + N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+264]], $MachinePrecision]], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], t$95$1]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{\left(a \cdot \left(y + t\right) + z \cdot \left(x + y\right)\right) - y \cdot b}{y + \left(x + t\right)}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 2 \cdot 10^{+264}\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)) < -inf.0 or 2.00000000000000009e264 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y))

    1. Initial program 5.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 79.4%

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

    if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.00000000000000009e264

    1. Initial program 99.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. Recombined 2 regimes into one program.
  4. Final simplification90.8%

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

Alternative 2: 63.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y + \left(x + t\right)\\ t_2 := a \cdot \frac{y + t}{t\_1}\\ t_3 := \frac{y}{y + t}\\ t_4 := z \cdot \left(\frac{a}{z} + \left(t\_3 - t\_3 \cdot \frac{b}{z}\right)\right)\\ \mathbf{if}\;a \leq -1 \cdot 10^{+139}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;a \leq -2.06 \cdot 10^{-199}:\\ \;\;\;\;t\_4\\ \mathbf{elif}\;a \leq 2.5 \cdot 10^{-63}:\\ \;\;\;\;\frac{z \cdot \left(x + y\right) - y \cdot b}{t\_1}\\ \mathbf{elif}\;a \leq 9 \cdot 10^{+199}:\\ \;\;\;\;t\_4\\ \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 (* a (/ (+ y t) t_1)))
        (t_3 (/ y (+ y t)))
        (t_4 (* z (+ (/ a z) (- t_3 (* t_3 (/ b z)))))))
   (if (<= a -1e+139)
     t_2
     (if (<= a -2.06e-199)
       t_4
       (if (<= a 2.5e-63)
         (/ (- (* z (+ x y)) (* y b)) t_1)
         (if (<= a 9e+199) t_4 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 = a * ((y + t) / t_1);
	double t_3 = y / (y + t);
	double t_4 = z * ((a / z) + (t_3 - (t_3 * (b / z))));
	double tmp;
	if (a <= -1e+139) {
		tmp = t_2;
	} else if (a <= -2.06e-199) {
		tmp = t_4;
	} else if (a <= 2.5e-63) {
		tmp = ((z * (x + y)) - (y * b)) / t_1;
	} else if (a <= 9e+199) {
		tmp = t_4;
	} 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) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_1 = y + (x + t)
    t_2 = a * ((y + t) / t_1)
    t_3 = y / (y + t)
    t_4 = z * ((a / z) + (t_3 - (t_3 * (b / z))))
    if (a <= (-1d+139)) then
        tmp = t_2
    else if (a <= (-2.06d-199)) then
        tmp = t_4
    else if (a <= 2.5d-63) then
        tmp = ((z * (x + y)) - (y * b)) / t_1
    else if (a <= 9d+199) then
        tmp = t_4
    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 = a * ((y + t) / t_1);
	double t_3 = y / (y + t);
	double t_4 = z * ((a / z) + (t_3 - (t_3 * (b / z))));
	double tmp;
	if (a <= -1e+139) {
		tmp = t_2;
	} else if (a <= -2.06e-199) {
		tmp = t_4;
	} else if (a <= 2.5e-63) {
		tmp = ((z * (x + y)) - (y * b)) / t_1;
	} else if (a <= 9e+199) {
		tmp = t_4;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = y + (x + t)
	t_2 = a * ((y + t) / t_1)
	t_3 = y / (y + t)
	t_4 = z * ((a / z) + (t_3 - (t_3 * (b / z))))
	tmp = 0
	if a <= -1e+139:
		tmp = t_2
	elif a <= -2.06e-199:
		tmp = t_4
	elif a <= 2.5e-63:
		tmp = ((z * (x + y)) - (y * b)) / t_1
	elif a <= 9e+199:
		tmp = t_4
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(y + Float64(x + t))
	t_2 = Float64(a * Float64(Float64(y + t) / t_1))
	t_3 = Float64(y / Float64(y + t))
	t_4 = Float64(z * Float64(Float64(a / z) + Float64(t_3 - Float64(t_3 * Float64(b / z)))))
	tmp = 0.0
	if (a <= -1e+139)
		tmp = t_2;
	elseif (a <= -2.06e-199)
		tmp = t_4;
	elseif (a <= 2.5e-63)
		tmp = Float64(Float64(Float64(z * Float64(x + y)) - Float64(y * b)) / t_1);
	elseif (a <= 9e+199)
		tmp = t_4;
	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 = a * ((y + t) / t_1);
	t_3 = y / (y + t);
	t_4 = z * ((a / z) + (t_3 - (t_3 * (b / z))));
	tmp = 0.0;
	if (a <= -1e+139)
		tmp = t_2;
	elseif (a <= -2.06e-199)
		tmp = t_4;
	elseif (a <= 2.5e-63)
		tmp = ((z * (x + y)) - (y * b)) / t_1;
	elseif (a <= 9e+199)
		tmp = t_4;
	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[(a * N[(N[(y + t), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(y / N[(y + t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(z * N[(N[(a / z), $MachinePrecision] + N[(t$95$3 - N[(t$95$3 * N[(b / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1e+139], t$95$2, If[LessEqual[a, -2.06e-199], t$95$4, If[LessEqual[a, 2.5e-63], N[(N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[a, 9e+199], t$95$4, t$95$2]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;a \leq -2.06 \cdot 10^{-199}:\\
\;\;\;\;t\_4\\

\mathbf{elif}\;a \leq 2.5 \cdot 10^{-63}:\\
\;\;\;\;\frac{z \cdot \left(x + y\right) - y \cdot b}{t\_1}\\

\mathbf{elif}\;a \leq 9 \cdot 10^{+199}:\\
\;\;\;\;t\_4\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -1.00000000000000003e139 or 8.9999999999999994e199 < a

    1. Initial program 30.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 a around inf 25.7%

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

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

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

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

    if -1.00000000000000003e139 < a < -2.06000000000000004e-199 or 2.5000000000000001e-63 < a < 8.9999999999999994e199

    1. Initial program 63.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 z around inf 67.9%

      \[\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. Taylor expanded in x around 0 55.4%

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

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

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

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

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

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

    if -2.06000000000000004e-199 < a < 2.5000000000000001e-63

    1. Initial program 76.1%

      \[\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 0 69.4%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1 \cdot 10^{+139}:\\ \;\;\;\;a \cdot \frac{y + t}{y + \left(x + t\right)}\\ \mathbf{elif}\;a \leq -2.06 \cdot 10^{-199}:\\ \;\;\;\;z \cdot \left(\frac{a}{z} + \left(\frac{y}{y + t} - \frac{y}{y + t} \cdot \frac{b}{z}\right)\right)\\ \mathbf{elif}\;a \leq 2.5 \cdot 10^{-63}:\\ \;\;\;\;\frac{z \cdot \left(x + y\right) - y \cdot b}{y + \left(x + t\right)}\\ \mathbf{elif}\;a \leq 9 \cdot 10^{+199}:\\ \;\;\;\;z \cdot \left(\frac{a}{z} + \left(\frac{y}{y + t} - \frac{y}{y + t} \cdot \frac{b}{z}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \frac{y + t}{y + \left(x + t\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 63.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(z + a\right) - b\\ \mathbf{if}\;y \leq -1.7 \cdot 10^{-5}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 2 \cdot 10^{-82}:\\ \;\;\;\;\frac{t \cdot a + x \cdot z}{x + t}\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{-48} \lor \neg \left(y \leq 3100000000\right) \land y \leq 8.6 \cdot 10^{+33}:\\ \;\;\;\;\frac{y \cdot t\_1}{y + \left(x + t\right)}\\ \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.7e-5)
     t_1
     (if (<= y 2e-82)
       (/ (+ (* t a) (* x z)) (+ x t))
       (if (or (<= y 2.3e-48) (and (not (<= y 3100000000.0)) (<= y 8.6e+33)))
         (/ (* y t_1) (+ y (+ x t)))
         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.7e-5) {
		tmp = t_1;
	} else if (y <= 2e-82) {
		tmp = ((t * a) + (x * z)) / (x + t);
	} else if ((y <= 2.3e-48) || (!(y <= 3100000000.0) && (y <= 8.6e+33))) {
		tmp = (y * t_1) / (y + (x + t));
	} 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.7d-5)) then
        tmp = t_1
    else if (y <= 2d-82) then
        tmp = ((t * a) + (x * z)) / (x + t)
    else if ((y <= 2.3d-48) .or. (.not. (y <= 3100000000.0d0)) .and. (y <= 8.6d+33)) then
        tmp = (y * t_1) / (y + (x + t))
    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.7e-5) {
		tmp = t_1;
	} else if (y <= 2e-82) {
		tmp = ((t * a) + (x * z)) / (x + t);
	} else if ((y <= 2.3e-48) || (!(y <= 3100000000.0) && (y <= 8.6e+33))) {
		tmp = (y * t_1) / (y + (x + t));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = (z + a) - b
	tmp = 0
	if y <= -1.7e-5:
		tmp = t_1
	elif y <= 2e-82:
		tmp = ((t * a) + (x * z)) / (x + t)
	elif (y <= 2.3e-48) or (not (y <= 3100000000.0) and (y <= 8.6e+33)):
		tmp = (y * t_1) / (y + (x + t))
	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.7e-5)
		tmp = t_1;
	elseif (y <= 2e-82)
		tmp = Float64(Float64(Float64(t * a) + Float64(x * z)) / Float64(x + t));
	elseif ((y <= 2.3e-48) || (!(y <= 3100000000.0) && (y <= 8.6e+33)))
		tmp = Float64(Float64(y * t_1) / Float64(y + Float64(x + t)));
	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.7e-5)
		tmp = t_1;
	elseif (y <= 2e-82)
		tmp = ((t * a) + (x * z)) / (x + t);
	elseif ((y <= 2.3e-48) || (~((y <= 3100000000.0)) && (y <= 8.6e+33)))
		tmp = (y * t_1) / (y + (x + t));
	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.7e-5], t$95$1, If[LessEqual[y, 2e-82], N[(N[(N[(t * a), $MachinePrecision] + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(x + t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 2.3e-48], And[N[Not[LessEqual[y, 3100000000.0]], $MachinePrecision], LessEqual[y, 8.6e+33]]], N[(N[(y * t$95$1), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;y \leq 2.3 \cdot 10^{-48} \lor \neg \left(y \leq 3100000000\right) \land y \leq 8.6 \cdot 10^{+33}:\\
\;\;\;\;\frac{y \cdot t\_1}{y + \left(x + t\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.7e-5 or 2.3000000000000001e-48 < y < 3.1e9 or 8.60000000000000057e33 < 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 77.3%

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

    if -1.7e-5 < y < 2e-82

    1. Initial program 73.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 0 63.9%

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

    if 2e-82 < y < 2.3000000000000001e-48 or 3.1e9 < y < 8.60000000000000057e33

    1. Initial program 88.1%

      \[\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 72.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.7 \cdot 10^{-5}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{elif}\;y \leq 2 \cdot 10^{-82}:\\ \;\;\;\;\frac{t \cdot a + x \cdot z}{x + t}\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{-48} \lor \neg \left(y \leq 3100000000\right) \land y \leq 8.6 \cdot 10^{+33}:\\ \;\;\;\;\frac{y \cdot \left(\left(z + a\right) - b\right)}{y + \left(x + t\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(z + a\right) - b\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 57.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -8.4 \cdot 10^{+185} \lor \neg \left(t \leq -3.7 \cdot 10^{+51} \lor \neg \left(t \leq -95\right) \land t \leq 1.45 \cdot 10^{+196}\right):\\ \;\;\;\;a \cdot \frac{y + t}{y + \left(x + t\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(z + a\right) - b\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= t -8.4e+185)
         (not (or (<= t -3.7e+51) (and (not (<= t -95.0)) (<= t 1.45e+196)))))
   (* a (/ (+ y t) (+ y (+ x t))))
   (- (+ z a) b)))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((t <= -8.4e+185) || !((t <= -3.7e+51) || (!(t <= -95.0) && (t <= 1.45e+196)))) {
		tmp = a * ((y + t) / (y + (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 <= (-8.4d+185)) .or. (.not. (t <= (-3.7d+51)) .or. (.not. (t <= (-95.0d0))) .and. (t <= 1.45d+196))) then
        tmp = a * ((y + t) / (y + (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 <= -8.4e+185) || !((t <= -3.7e+51) || (!(t <= -95.0) && (t <= 1.45e+196)))) {
		tmp = a * ((y + t) / (y + (x + t)));
	} else {
		tmp = (z + a) - b;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if (t <= -8.4e+185) or not ((t <= -3.7e+51) or (not (t <= -95.0) and (t <= 1.45e+196))):
		tmp = a * ((y + t) / (y + (x + t)))
	else:
		tmp = (z + a) - b
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if ((t <= -8.4e+185) || !((t <= -3.7e+51) || (!(t <= -95.0) && (t <= 1.45e+196))))
		tmp = Float64(a * Float64(Float64(y + t) / Float64(y + 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 <= -8.4e+185) || ~(((t <= -3.7e+51) || (~((t <= -95.0)) && (t <= 1.45e+196)))))
		tmp = a * ((y + t) / (y + (x + t)));
	else
		tmp = (z + a) - b;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -8.4e+185], N[Not[Or[LessEqual[t, -3.7e+51], And[N[Not[LessEqual[t, -95.0]], $MachinePrecision], LessEqual[t, 1.45e+196]]]], $MachinePrecision]], N[(a * N[(N[(y + t), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.4 \cdot 10^{+185} \lor \neg \left(t \leq -3.7 \cdot 10^{+51} \lor \neg \left(t \leq -95\right) \land t \leq 1.45 \cdot 10^{+196}\right):\\
\;\;\;\;a \cdot \frac{y + t}{y + \left(x + t\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -8.4e185 or -3.7000000000000002e51 < t < -95 or 1.45e196 < t

    1. Initial program 44.4%

      \[\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 33.2%

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

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

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

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

    if -8.4e185 < t < -3.7000000000000002e51 or -95 < t < 1.45e196

    1. Initial program 63.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 y around inf 66.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -8.4 \cdot 10^{+185} \lor \neg \left(t \leq -3.7 \cdot 10^{+51} \lor \neg \left(t \leq -95\right) \land t \leq 1.45 \cdot 10^{+196}\right):\\ \;\;\;\;a \cdot \frac{y + t}{y + \left(x + t\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(z + a\right) - b\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 63.7% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(z + a\right) - b\\ \mathbf{if}\;y \leq -2.9 \cdot 10^{-5}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 1.36 \cdot 10^{-90}:\\ \;\;\;\;\frac{t \cdot a + x \cdot z}{x + t}\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{-48}:\\ \;\;\;\;\frac{z \cdot \left(x + y\right) - y \cdot b}{y + \left(x + t\right)}\\ \mathbf{elif}\;y \leq 7.6 \cdot 10^{-38}:\\ \;\;\;\;z + a \cdot \frac{y + t}{x}\\ \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 -2.9e-5)
     t_1
     (if (<= y 1.36e-90)
       (/ (+ (* t a) (* x z)) (+ x t))
       (if (<= y 2.4e-48)
         (/ (- (* z (+ x y)) (* y b)) (+ y (+ x t)))
         (if (<= y 7.6e-38) (+ z (* a (/ (+ y t) x))) 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 <= -2.9e-5) {
		tmp = t_1;
	} else if (y <= 1.36e-90) {
		tmp = ((t * a) + (x * z)) / (x + t);
	} else if (y <= 2.4e-48) {
		tmp = ((z * (x + y)) - (y * b)) / (y + (x + t));
	} else if (y <= 7.6e-38) {
		tmp = z + (a * ((y + t) / x));
	} 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 <= (-2.9d-5)) then
        tmp = t_1
    else if (y <= 1.36d-90) then
        tmp = ((t * a) + (x * z)) / (x + t)
    else if (y <= 2.4d-48) then
        tmp = ((z * (x + y)) - (y * b)) / (y + (x + t))
    else if (y <= 7.6d-38) then
        tmp = z + (a * ((y + t) / x))
    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 <= -2.9e-5) {
		tmp = t_1;
	} else if (y <= 1.36e-90) {
		tmp = ((t * a) + (x * z)) / (x + t);
	} else if (y <= 2.4e-48) {
		tmp = ((z * (x + y)) - (y * b)) / (y + (x + t));
	} else if (y <= 7.6e-38) {
		tmp = z + (a * ((y + t) / x));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = (z + a) - b
	tmp = 0
	if y <= -2.9e-5:
		tmp = t_1
	elif y <= 1.36e-90:
		tmp = ((t * a) + (x * z)) / (x + t)
	elif y <= 2.4e-48:
		tmp = ((z * (x + y)) - (y * b)) / (y + (x + t))
	elif y <= 7.6e-38:
		tmp = z + (a * ((y + t) / x))
	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 <= -2.9e-5)
		tmp = t_1;
	elseif (y <= 1.36e-90)
		tmp = Float64(Float64(Float64(t * a) + Float64(x * z)) / Float64(x + t));
	elseif (y <= 2.4e-48)
		tmp = Float64(Float64(Float64(z * Float64(x + y)) - Float64(y * b)) / Float64(y + Float64(x + t)));
	elseif (y <= 7.6e-38)
		tmp = Float64(z + Float64(a * Float64(Float64(y + t) / x)));
	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 <= -2.9e-5)
		tmp = t_1;
	elseif (y <= 1.36e-90)
		tmp = ((t * a) + (x * z)) / (x + t);
	elseif (y <= 2.4e-48)
		tmp = ((z * (x + y)) - (y * b)) / (y + (x + t));
	elseif (y <= 7.6e-38)
		tmp = z + (a * ((y + t) / x));
	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, -2.9e-5], t$95$1, If[LessEqual[y, 1.36e-90], N[(N[(N[(t * a), $MachinePrecision] + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(x + t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.4e-48], N[(N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.6e-38], N[(z + N[(a * N[(N[(y + t), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;y \leq 2.4 \cdot 10^{-48}:\\
\;\;\;\;\frac{z \cdot \left(x + y\right) - y \cdot b}{y + \left(x + t\right)}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -2.9e-5 or 7.5999999999999999e-38 < y

    1. Initial program 43.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 y around inf 76.6%

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

    if -2.9e-5 < y < 1.36000000000000011e-90

    1. Initial program 73.4%

      \[\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 63.5%

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

    if 1.36000000000000011e-90 < y < 2.4e-48

    1. Initial program 81.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 a around 0 81.2%

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

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

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

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

    if 2.4e-48 < y < 7.5999999999999999e-38

    1. Initial program 80.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 x around inf 61.1%

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

        \[\leadsto \color{blue}{z + \left(\left(\frac{a \cdot \left(t + y\right)}{x} + \frac{y \cdot z}{x}\right) - \left(\frac{b \cdot y}{x} + \frac{z \cdot \left(t + y\right)}{x}\right)\right)} \]
      2. associate-/l*61.1%

        \[\leadsto z + \left(\left(\color{blue}{a \cdot \frac{t + y}{x}} + \frac{y \cdot z}{x}\right) - \left(\frac{b \cdot y}{x} + \frac{z \cdot \left(t + y\right)}{x}\right)\right) \]
      3. associate-/l*61.1%

        \[\leadsto z + \left(\left(a \cdot \frac{t + y}{x} + \color{blue}{y \cdot \frac{z}{x}}\right) - \left(\frac{b \cdot y}{x} + \frac{z \cdot \left(t + y\right)}{x}\right)\right) \]
      4. associate-/l*61.1%

        \[\leadsto z + \left(\left(a \cdot \frac{t + y}{x} + y \cdot \frac{z}{x}\right) - \left(\color{blue}{b \cdot \frac{y}{x}} + \frac{z \cdot \left(t + y\right)}{x}\right)\right) \]
      5. associate-/l*80.0%

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

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

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

        \[\leadsto z + \color{blue}{a \cdot \frac{t + y}{x}} \]
      2. +-commutative81.7%

        \[\leadsto z + a \cdot \frac{\color{blue}{y + t}}{x} \]
    8. Simplified81.7%

      \[\leadsto z + \color{blue}{a \cdot \frac{y + t}{x}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification71.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.9 \cdot 10^{-5}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{elif}\;y \leq 1.36 \cdot 10^{-90}:\\ \;\;\;\;\frac{t \cdot a + x \cdot z}{x + t}\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{-48}:\\ \;\;\;\;\frac{z \cdot \left(x + y\right) - y \cdot b}{y + \left(x + t\right)}\\ \mathbf{elif}\;y \leq 7.6 \cdot 10^{-38}:\\ \;\;\;\;z + a \cdot \frac{y + t}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(z + a\right) - b\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 57.5% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_1 := a \cdot \frac{y + t}{y + \left(x + t\right)}\\
\mathbf{if}\;a \leq -4.5 \cdot 10^{+155}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;a \leq -4.2 \cdot 10^{-187}:\\
\;\;\;\;\left(z + a\right) - b\\

\mathbf{elif}\;a \leq 8 \cdot 10^{+138}:\\
\;\;\;\;\frac{z}{\frac{t + \left(x + y\right)}{x + y}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -4.49999999999999973e155 or 8.0000000000000003e138 < a

    1. Initial program 32.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 25.2%

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

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

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

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

    if -4.49999999999999973e155 < a < -4.19999999999999985e-187

    1. Initial program 60.4%

      \[\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 64.9%

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

    if -4.19999999999999985e-187 < a < 8.0000000000000003e138

    1. Initial program 74.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 a around 0 60.4%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{z \cdot \frac{y + x}{\left(y + x\right) + t}} \]
    9. Step-by-step derivation
      1. clear-num60.2%

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

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

        \[\leadsto \frac{z}{\frac{\color{blue}{t + \left(y + x\right)}}{y + x}} \]
    10. Applied egg-rr60.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -4.5 \cdot 10^{+155}:\\ \;\;\;\;a \cdot \frac{y + t}{y + \left(x + t\right)}\\ \mathbf{elif}\;a \leq -4.2 \cdot 10^{-187}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{elif}\;a \leq 8 \cdot 10^{+138}:\\ \;\;\;\;\frac{z}{\frac{t + \left(x + y\right)}{x + y}}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \frac{y + t}{y + \left(x + t\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 57.6% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y + \left(x + t\right)\\ t_2 := a \cdot \frac{y + t}{t\_1}\\ \mathbf{if}\;a \leq -1.02 \cdot 10^{+153}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;a \leq -1.05 \cdot 10^{-186}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{elif}\;a \leq 5.8 \cdot 10^{+138}:\\ \;\;\;\;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 (* a (/ (+ y t) t_1))))
   (if (<= a -1.02e+153)
     t_2
     (if (<= a -1.05e-186)
       (- (+ z a) b)
       (if (<= a 5.8e+138) (* 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 = a * ((y + t) / t_1);
	double tmp;
	if (a <= -1.02e+153) {
		tmp = t_2;
	} else if (a <= -1.05e-186) {
		tmp = (z + a) - b;
	} else if (a <= 5.8e+138) {
		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 = a * ((y + t) / t_1)
    if (a <= (-1.02d+153)) then
        tmp = t_2
    else if (a <= (-1.05d-186)) then
        tmp = (z + a) - b
    else if (a <= 5.8d+138) 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 = a * ((y + t) / t_1);
	double tmp;
	if (a <= -1.02e+153) {
		tmp = t_2;
	} else if (a <= -1.05e-186) {
		tmp = (z + a) - b;
	} else if (a <= 5.8e+138) {
		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 = a * ((y + t) / t_1)
	tmp = 0
	if a <= -1.02e+153:
		tmp = t_2
	elif a <= -1.05e-186:
		tmp = (z + a) - b
	elif a <= 5.8e+138:
		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(a * Float64(Float64(y + t) / t_1))
	tmp = 0.0
	if (a <= -1.02e+153)
		tmp = t_2;
	elseif (a <= -1.05e-186)
		tmp = Float64(Float64(z + a) - b);
	elseif (a <= 5.8e+138)
		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 = a * ((y + t) / t_1);
	tmp = 0.0;
	if (a <= -1.02e+153)
		tmp = t_2;
	elseif (a <= -1.05e-186)
		tmp = (z + a) - b;
	elseif (a <= 5.8e+138)
		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[(a * N[(N[(y + t), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.02e+153], t$95$2, If[LessEqual[a, -1.05e-186], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], If[LessEqual[a, 5.8e+138], 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 := a \cdot \frac{y + t}{t\_1}\\
\mathbf{if}\;a \leq -1.02 \cdot 10^{+153}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;a \leq -1.05 \cdot 10^{-186}:\\
\;\;\;\;\left(z + a\right) - b\\

\mathbf{elif}\;a \leq 5.8 \cdot 10^{+138}:\\
\;\;\;\;z \cdot \frac{x + y}{t\_1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -1.0199999999999999e153 or 5.80000000000000019e138 < a

    1. Initial program 32.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 25.2%

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

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

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

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

    if -1.0199999999999999e153 < a < -1.0500000000000001e-186

    1. Initial program 60.4%

      \[\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 64.9%

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

    if -1.0500000000000001e-186 < a < 5.80000000000000019e138

    1. Initial program 74.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 z around inf 41.2%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.02 \cdot 10^{+153}:\\ \;\;\;\;a \cdot \frac{y + t}{y + \left(x + t\right)}\\ \mathbf{elif}\;a \leq -1.05 \cdot 10^{-186}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{elif}\;a \leq 5.8 \cdot 10^{+138}:\\ \;\;\;\;z \cdot \frac{x + y}{y + \left(x + t\right)}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \frac{y + t}{y + \left(x + t\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 63.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.6 \cdot 10^{-5} \lor \neg \left(y \leq 2.4 \cdot 10^{-85}\right):\\
\;\;\;\;\left(z + a\right) - b\\

\mathbf{else}:\\
\;\;\;\;\frac{t \cdot a + x \cdot z}{x + t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.59999999999999992e-5 or 2.4000000000000001e-85 < y

    1. Initial program 47.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 73.9%

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

    if -5.59999999999999992e-5 < y < 2.4000000000000001e-85

    1. Initial program 73.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 0 63.9%

      \[\leadsto \color{blue}{\frac{a \cdot t + x \cdot z}{t + x}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification69.6%

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

Alternative 9: 44.1% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.4 \cdot 10^{+39}:\\
\;\;\;\;a\\

\mathbf{elif}\;a \leq 1.04 \cdot 10^{-221}:\\
\;\;\;\;z - b\\

\mathbf{elif}\;a \leq 2.7 \cdot 10^{+208}:\\
\;\;\;\;z\\

\mathbf{else}:\\
\;\;\;\;a\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -6.39999999999999986e39 or 2.7e208 < a

    1. Initial program 31.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 t around inf 71.6%

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

    if -6.39999999999999986e39 < a < 1.0399999999999999e-221

    1. Initial program 67.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 0 48.5%

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

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

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

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

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

    if 1.0399999999999999e-221 < a < 2.7e208

    1. Initial program 77.1%

      \[\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 46.7%

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

Alternative 10: 57.7% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;t \leq 7.4 \cdot 10^{+196}:\\
\;\;\;\;\left(z + a\right) - b\\

\mathbf{else}:\\
\;\;\;\;a\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.9000000000000001e187 or 7.3999999999999998e196 < t

    1. Initial program 36.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 68.7%

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

    if -2.9000000000000001e187 < t < 7.3999999999999998e196

    1. Initial program 64.4%

      \[\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 63.8%

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

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

Alternative 11: 41.9% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -8.8 \cdot 10^{-25}:\\
\;\;\;\;a\\

\mathbf{elif}\;a \leq 1.75 \cdot 10^{+209}:\\
\;\;\;\;z\\

\mathbf{else}:\\
\;\;\;\;a\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -8.8000000000000008e-25 or 1.7500000000000001e209 < a

    1. Initial program 38.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 65.0%

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

    if -8.8000000000000008e-25 < a < 1.7500000000000001e209

    1. Initial program 71.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 x around inf 44.3%

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

Alternative 12: 31.7% 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 58.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 t around inf 37.5%

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

Developer target: 81.6% 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 2024089 
(FPCore (x y z t a b)
  :name "AI.Clustering.Hierarchical.Internal:ward from clustering-0.2.1"
  :precision binary64

  :alt
  (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)))