Linear.V4:$cdot from linear-1.19.1.3, C

Percentage Accurate: 95.5% → 98.1%
Time: 16.8s
Alternatives: 16
Speedup: 0.4×

Specification

?
\[\begin{array}{l} \\ \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
real(8) function code(x, y, z, t, a, b, c, i)
    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), intent (in) :: c
    real(8), intent (in) :: i
    code = (((x * y) + (z * t)) + (a * b)) + (c * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
def code(x, y, z, t, a, b, c, i):
	return (((x * y) + (z * t)) + (a * b)) + (c * i)
function code(x, y, z, t, a, b, c, i)
	return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i))
end
function tmp = code(x, y, z, t, a, b, c, i)
	tmp = (((x * y) + (z * t)) + (a * b)) + (c * i);
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\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 16 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: 95.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
real(8) function code(x, y, z, t, a, b, c, i)
    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), intent (in) :: c
    real(8), intent (in) :: i
    code = (((x * y) + (z * t)) + (a * b)) + (c * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
def code(x, y, z, t, a, b, c, i):
	return (((x * y) + (z * t)) + (a * b)) + (c * i)
function code(x, y, z, t, a, b, c, i)
	return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i))
end
function tmp = code(x, y, z, t, a, b, c, i)
	tmp = (((x * y) + (z * t)) + (a * b)) + (c * i);
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 98.1% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(c, i, \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)\right) \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (fma c i (fma x y (fma z t (* a b)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return fma(c, i, fma(x, y, fma(z, t, (a * b))));
}
function code(x, y, z, t, a, b, c, i)
	return fma(c, i, fma(x, y, fma(z, t, Float64(a * b))))
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(c * i + N[(x * y + N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(c, i, \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)\right)
\end{array}
Derivation
  1. Initial program 96.1%

    \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
  2. Step-by-step derivation
    1. +-commutative96.1%

      \[\leadsto \color{blue}{c \cdot i + \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right)} \]
    2. fma-define98.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(c, i, \left(x \cdot y + z \cdot t\right) + a \cdot b\right)} \]
    3. associate-+l+98.0%

      \[\leadsto \mathsf{fma}\left(c, i, \color{blue}{x \cdot y + \left(z \cdot t + a \cdot b\right)}\right) \]
    4. fma-define98.4%

      \[\leadsto \mathsf{fma}\left(c, i, \color{blue}{\mathsf{fma}\left(x, y, z \cdot t + a \cdot b\right)}\right) \]
    5. fma-define98.8%

      \[\leadsto \mathsf{fma}\left(c, i, \mathsf{fma}\left(x, y, \color{blue}{\mathsf{fma}\left(z, t, a \cdot b\right)}\right)\right) \]
  3. Simplified98.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(c, i, \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)\right)} \]
  4. Add Preprocessing
  5. Final simplification98.8%

    \[\leadsto \mathsf{fma}\left(c, i, \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)\right) \]
  6. Add Preprocessing

Alternative 2: 98.0% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\right) \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (fma c i (fma a b (fma x y (* z t)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return fma(c, i, fma(a, b, fma(x, y, (z * t))));
}
function code(x, y, z, t, a, b, c, i)
	return fma(c, i, fma(a, b, fma(x, y, Float64(z * t))))
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(c * i + N[(a * b + N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\right)
\end{array}
Derivation
  1. Initial program 96.1%

    \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
  2. Step-by-step derivation
    1. +-commutative96.1%

      \[\leadsto \color{blue}{c \cdot i + \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right)} \]
    2. fma-define98.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(c, i, \left(x \cdot y + z \cdot t\right) + a \cdot b\right)} \]
    3. +-commutative98.0%

      \[\leadsto \mathsf{fma}\left(c, i, \color{blue}{a \cdot b + \left(x \cdot y + z \cdot t\right)}\right) \]
    4. fma-define98.4%

      \[\leadsto \mathsf{fma}\left(c, i, \color{blue}{\mathsf{fma}\left(a, b, x \cdot y + z \cdot t\right)}\right) \]
    5. fma-define98.4%

      \[\leadsto \mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, \color{blue}{\mathsf{fma}\left(x, y, z \cdot t\right)}\right)\right) \]
  3. Simplified98.4%

    \[\leadsto \color{blue}{\mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\right)} \]
  4. Add Preprocessing
  5. Final simplification98.4%

    \[\leadsto \mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\right) \]
  6. Add Preprocessing

Alternative 3: 42.8% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -6.2 \cdot 10^{+138}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -6.2 \cdot 10^{-176}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 10^{-148}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.55 \cdot 10^{-64}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 6 \cdot 10^{-9}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 9.6 \cdot 10^{+34}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 1.2 \cdot 10^{+143}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= (* a b) -6.2e+138)
   (* a b)
   (if (<= (* a b) -6.2e-176)
     (* x y)
     (if (<= (* a b) 1e-148)
       (* z t)
       (if (<= (* a b) 1.55e-64)
         (* x y)
         (if (<= (* a b) 6e-9)
           (* z t)
           (if (<= (* a b) 9.6e+34)
             (* c i)
             (if (<= (* a b) 1.2e+143) (* z t) (* a b)))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((a * b) <= -6.2e+138) {
		tmp = a * b;
	} else if ((a * b) <= -6.2e-176) {
		tmp = x * y;
	} else if ((a * b) <= 1e-148) {
		tmp = z * t;
	} else if ((a * b) <= 1.55e-64) {
		tmp = x * y;
	} else if ((a * b) <= 6e-9) {
		tmp = z * t;
	} else if ((a * b) <= 9.6e+34) {
		tmp = c * i;
	} else if ((a * b) <= 1.2e+143) {
		tmp = z * t;
	} else {
		tmp = a * b;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    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), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: tmp
    if ((a * b) <= (-6.2d+138)) then
        tmp = a * b
    else if ((a * b) <= (-6.2d-176)) then
        tmp = x * y
    else if ((a * b) <= 1d-148) then
        tmp = z * t
    else if ((a * b) <= 1.55d-64) then
        tmp = x * y
    else if ((a * b) <= 6d-9) then
        tmp = z * t
    else if ((a * b) <= 9.6d+34) then
        tmp = c * i
    else if ((a * b) <= 1.2d+143) then
        tmp = z * t
    else
        tmp = 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 c, double i) {
	double tmp;
	if ((a * b) <= -6.2e+138) {
		tmp = a * b;
	} else if ((a * b) <= -6.2e-176) {
		tmp = x * y;
	} else if ((a * b) <= 1e-148) {
		tmp = z * t;
	} else if ((a * b) <= 1.55e-64) {
		tmp = x * y;
	} else if ((a * b) <= 6e-9) {
		tmp = z * t;
	} else if ((a * b) <= 9.6e+34) {
		tmp = c * i;
	} else if ((a * b) <= 1.2e+143) {
		tmp = z * t;
	} else {
		tmp = a * b;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (a * b) <= -6.2e+138:
		tmp = a * b
	elif (a * b) <= -6.2e-176:
		tmp = x * y
	elif (a * b) <= 1e-148:
		tmp = z * t
	elif (a * b) <= 1.55e-64:
		tmp = x * y
	elif (a * b) <= 6e-9:
		tmp = z * t
	elif (a * b) <= 9.6e+34:
		tmp = c * i
	elif (a * b) <= 1.2e+143:
		tmp = z * t
	else:
		tmp = a * b
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (Float64(a * b) <= -6.2e+138)
		tmp = Float64(a * b);
	elseif (Float64(a * b) <= -6.2e-176)
		tmp = Float64(x * y);
	elseif (Float64(a * b) <= 1e-148)
		tmp = Float64(z * t);
	elseif (Float64(a * b) <= 1.55e-64)
		tmp = Float64(x * y);
	elseif (Float64(a * b) <= 6e-9)
		tmp = Float64(z * t);
	elseif (Float64(a * b) <= 9.6e+34)
		tmp = Float64(c * i);
	elseif (Float64(a * b) <= 1.2e+143)
		tmp = Float64(z * t);
	else
		tmp = Float64(a * b);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if ((a * b) <= -6.2e+138)
		tmp = a * b;
	elseif ((a * b) <= -6.2e-176)
		tmp = x * y;
	elseif ((a * b) <= 1e-148)
		tmp = z * t;
	elseif ((a * b) <= 1.55e-64)
		tmp = x * y;
	elseif ((a * b) <= 6e-9)
		tmp = z * t;
	elseif ((a * b) <= 9.6e+34)
		tmp = c * i;
	elseif ((a * b) <= 1.2e+143)
		tmp = z * t;
	else
		tmp = a * b;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -6.2e+138], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -6.2e-176], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e-148], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.55e-64], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 6e-9], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 9.6e+34], N[(c * i), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.2e+143], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -6.2 \cdot 10^{+138}:\\
\;\;\;\;a \cdot b\\

\mathbf{elif}\;a \cdot b \leq -6.2 \cdot 10^{-176}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;a \cdot b \leq 10^{-148}:\\
\;\;\;\;z \cdot t\\

\mathbf{elif}\;a \cdot b \leq 1.55 \cdot 10^{-64}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;a \cdot b \leq 6 \cdot 10^{-9}:\\
\;\;\;\;z \cdot t\\

\mathbf{elif}\;a \cdot b \leq 9.6 \cdot 10^{+34}:\\
\;\;\;\;c \cdot i\\

\mathbf{elif}\;a \cdot b \leq 1.2 \cdot 10^{+143}:\\
\;\;\;\;z \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 a b) < -6.1999999999999995e138 or 1.1999999999999999e143 < (*.f64 a b)

    1. Initial program 92.3%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in a around inf 74.0%

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

    if -6.1999999999999995e138 < (*.f64 a b) < -6.19999999999999983e-176 or 9.99999999999999936e-149 < (*.f64 a b) < 1.55000000000000012e-64

    1. Initial program 98.5%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 50.8%

      \[\leadsto \color{blue}{x \cdot y} \]

    if -6.19999999999999983e-176 < (*.f64 a b) < 9.99999999999999936e-149 or 1.55000000000000012e-64 < (*.f64 a b) < 5.99999999999999996e-9 or 9.59999999999999948e34 < (*.f64 a b) < 1.1999999999999999e143

    1. Initial program 97.0%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 48.7%

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

    if 5.99999999999999996e-9 < (*.f64 a b) < 9.59999999999999948e34

    1. Initial program 100.0%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in c around inf 64.8%

      \[\leadsto \color{blue}{c \cdot i} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification57.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -6.2 \cdot 10^{+138}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -6.2 \cdot 10^{-176}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 10^{-148}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.55 \cdot 10^{-64}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 6 \cdot 10^{-9}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 9.6 \cdot 10^{+34}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 1.2 \cdot 10^{+143}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 65.2% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot b + z \cdot t\\ t_2 := x \cdot y + c \cdot i\\ \mathbf{if}\;x \cdot y \leq -2.8 \cdot 10^{+166}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \cdot y \leq -9 \cdot 10^{-272}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-316}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 3.5 \cdot 10^{-108}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 1.55 \cdot 10^{+125}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 1.75 \cdot 10^{+207}:\\ \;\;\;\;z \cdot \left(t + \frac{x \cdot y}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* a b) (* z t))) (t_2 (+ (* x y) (* c i))))
   (if (<= (* x y) -2.8e+166)
     t_2
     (if (<= (* x y) -9e-272)
       t_1
       (if (<= (* x y) 2e-316)
         (+ (* c i) (* z t))
         (if (<= (* x y) 3.5e-108)
           t_1
           (if (<= (* x y) 1.55e+125)
             (+ (* a b) (* c i))
             (if (<= (* x y) 1.75e+207) (* z (+ t (/ (* x y) z))) t_2))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (a * b) + (z * t);
	double t_2 = (x * y) + (c * i);
	double tmp;
	if ((x * y) <= -2.8e+166) {
		tmp = t_2;
	} else if ((x * y) <= -9e-272) {
		tmp = t_1;
	} else if ((x * y) <= 2e-316) {
		tmp = (c * i) + (z * t);
	} else if ((x * y) <= 3.5e-108) {
		tmp = t_1;
	} else if ((x * y) <= 1.55e+125) {
		tmp = (a * b) + (c * i);
	} else if ((x * y) <= 1.75e+207) {
		tmp = z * (t + ((x * y) / z));
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    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), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (a * b) + (z * t)
    t_2 = (x * y) + (c * i)
    if ((x * y) <= (-2.8d+166)) then
        tmp = t_2
    else if ((x * y) <= (-9d-272)) then
        tmp = t_1
    else if ((x * y) <= 2d-316) then
        tmp = (c * i) + (z * t)
    else if ((x * y) <= 3.5d-108) then
        tmp = t_1
    else if ((x * y) <= 1.55d+125) then
        tmp = (a * b) + (c * i)
    else if ((x * y) <= 1.75d+207) then
        tmp = z * (t + ((x * y) / z))
    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 c, double i) {
	double t_1 = (a * b) + (z * t);
	double t_2 = (x * y) + (c * i);
	double tmp;
	if ((x * y) <= -2.8e+166) {
		tmp = t_2;
	} else if ((x * y) <= -9e-272) {
		tmp = t_1;
	} else if ((x * y) <= 2e-316) {
		tmp = (c * i) + (z * t);
	} else if ((x * y) <= 3.5e-108) {
		tmp = t_1;
	} else if ((x * y) <= 1.55e+125) {
		tmp = (a * b) + (c * i);
	} else if ((x * y) <= 1.75e+207) {
		tmp = z * (t + ((x * y) / z));
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (a * b) + (z * t)
	t_2 = (x * y) + (c * i)
	tmp = 0
	if (x * y) <= -2.8e+166:
		tmp = t_2
	elif (x * y) <= -9e-272:
		tmp = t_1
	elif (x * y) <= 2e-316:
		tmp = (c * i) + (z * t)
	elif (x * y) <= 3.5e-108:
		tmp = t_1
	elif (x * y) <= 1.55e+125:
		tmp = (a * b) + (c * i)
	elif (x * y) <= 1.75e+207:
		tmp = z * (t + ((x * y) / z))
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(a * b) + Float64(z * t))
	t_2 = Float64(Float64(x * y) + Float64(c * i))
	tmp = 0.0
	if (Float64(x * y) <= -2.8e+166)
		tmp = t_2;
	elseif (Float64(x * y) <= -9e-272)
		tmp = t_1;
	elseif (Float64(x * y) <= 2e-316)
		tmp = Float64(Float64(c * i) + Float64(z * t));
	elseif (Float64(x * y) <= 3.5e-108)
		tmp = t_1;
	elseif (Float64(x * y) <= 1.55e+125)
		tmp = Float64(Float64(a * b) + Float64(c * i));
	elseif (Float64(x * y) <= 1.75e+207)
		tmp = Float64(z * Float64(t + Float64(Float64(x * y) / z)));
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (a * b) + (z * t);
	t_2 = (x * y) + (c * i);
	tmp = 0.0;
	if ((x * y) <= -2.8e+166)
		tmp = t_2;
	elseif ((x * y) <= -9e-272)
		tmp = t_1;
	elseif ((x * y) <= 2e-316)
		tmp = (c * i) + (z * t);
	elseif ((x * y) <= 3.5e-108)
		tmp = t_1;
	elseif ((x * y) <= 1.55e+125)
		tmp = (a * b) + (c * i);
	elseif ((x * y) <= 1.75e+207)
		tmp = z * (t + ((x * y) / z));
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2.8e+166], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], -9e-272], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e-316], N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 3.5e-108], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1.55e+125], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.75e+207], N[(z * N[(t + N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
t_2 := x \cdot y + c \cdot i\\
\mathbf{if}\;x \cdot y \leq -2.8 \cdot 10^{+166}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \cdot y \leq -9 \cdot 10^{-272}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-316}:\\
\;\;\;\;c \cdot i + z \cdot t\\

\mathbf{elif}\;x \cdot y \leq 3.5 \cdot 10^{-108}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \cdot y \leq 1.55 \cdot 10^{+125}:\\
\;\;\;\;a \cdot b + c \cdot i\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if (*.f64 x y) < -2.79999999999999996e166 or 1.75000000000000014e207 < (*.f64 x y)

    1. Initial program 94.1%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 86.7%

      \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right)} + c \cdot i \]
    4. Taylor expanded in t around 0 85.4%

      \[\leadsto \color{blue}{c \cdot i + x \cdot y} \]

    if -2.79999999999999996e166 < (*.f64 x y) < -8.9999999999999995e-272 or 2.000000017e-316 < (*.f64 x y) < 3.4999999999999999e-108

    1. Initial program 97.0%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 92.2%

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

      \[\leadsto \left(\color{blue}{t \cdot z} + a \cdot b\right) + c \cdot i \]
    5. Taylor expanded in c around 0 77.7%

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

    if -8.9999999999999995e-272 < (*.f64 x y) < 2.000000017e-316

    1. Initial program 94.9%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 82.6%

      \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right)} + c \cdot i \]
    4. Taylor expanded in x around 0 82.6%

      \[\leadsto \color{blue}{c \cdot i + t \cdot z} \]

    if 3.4999999999999999e-108 < (*.f64 x y) < 1.55e125

    1. Initial program 100.0%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in b around inf 92.1%

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

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

        \[\leadsto b \cdot \left(a + \left(t \cdot \frac{z}{b} + \color{blue}{x \cdot \frac{y}{b}}\right)\right) + c \cdot i \]
    5. Simplified83.7%

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

      \[\leadsto \color{blue}{a \cdot b} + c \cdot i \]

    if 1.55e125 < (*.f64 x y) < 1.75000000000000014e207

    1. Initial program 92.3%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 84.8%

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

      \[\leadsto \color{blue}{z \cdot \left(t + \frac{x \cdot y}{z}\right)} + c \cdot i \]
    5. Taylor expanded in c around 0 70.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2.8 \cdot 10^{+166}:\\ \;\;\;\;x \cdot y + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq -9 \cdot 10^{-272}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-316}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 3.5 \cdot 10^{-108}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 1.55 \cdot 10^{+125}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 1.75 \cdot 10^{+207}:\\ \;\;\;\;z \cdot \left(t + \frac{x \cdot y}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 63.0% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot b + z \cdot t\\ \mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+225}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -5.2 \cdot 10^{-271}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-316}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 1.95 \cdot 10^{-110}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 4.8 \cdot 10^{+148}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 1.02 \cdot 10^{+200}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* a b) (* z t))))
   (if (<= (* x y) -5e+225)
     (* x y)
     (if (<= (* x y) -5.2e-271)
       t_1
       (if (<= (* x y) 2e-316)
         (+ (* c i) (* z t))
         (if (<= (* x y) 1.95e-110)
           t_1
           (if (<= (* x y) 4.8e+148)
             (+ (* a b) (* c i))
             (if (<= (* x y) 1.02e+200) t_1 (* x y)))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (a * b) + (z * t);
	double tmp;
	if ((x * y) <= -5e+225) {
		tmp = x * y;
	} else if ((x * y) <= -5.2e-271) {
		tmp = t_1;
	} else if ((x * y) <= 2e-316) {
		tmp = (c * i) + (z * t);
	} else if ((x * y) <= 1.95e-110) {
		tmp = t_1;
	} else if ((x * y) <= 4.8e+148) {
		tmp = (a * b) + (c * i);
	} else if ((x * y) <= 1.02e+200) {
		tmp = t_1;
	} else {
		tmp = x * y;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    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), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (a * b) + (z * t)
    if ((x * y) <= (-5d+225)) then
        tmp = x * y
    else if ((x * y) <= (-5.2d-271)) then
        tmp = t_1
    else if ((x * y) <= 2d-316) then
        tmp = (c * i) + (z * t)
    else if ((x * y) <= 1.95d-110) then
        tmp = t_1
    else if ((x * y) <= 4.8d+148) then
        tmp = (a * b) + (c * i)
    else if ((x * y) <= 1.02d+200) then
        tmp = t_1
    else
        tmp = x * y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (a * b) + (z * t);
	double tmp;
	if ((x * y) <= -5e+225) {
		tmp = x * y;
	} else if ((x * y) <= -5.2e-271) {
		tmp = t_1;
	} else if ((x * y) <= 2e-316) {
		tmp = (c * i) + (z * t);
	} else if ((x * y) <= 1.95e-110) {
		tmp = t_1;
	} else if ((x * y) <= 4.8e+148) {
		tmp = (a * b) + (c * i);
	} else if ((x * y) <= 1.02e+200) {
		tmp = t_1;
	} else {
		tmp = x * y;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (a * b) + (z * t)
	tmp = 0
	if (x * y) <= -5e+225:
		tmp = x * y
	elif (x * y) <= -5.2e-271:
		tmp = t_1
	elif (x * y) <= 2e-316:
		tmp = (c * i) + (z * t)
	elif (x * y) <= 1.95e-110:
		tmp = t_1
	elif (x * y) <= 4.8e+148:
		tmp = (a * b) + (c * i)
	elif (x * y) <= 1.02e+200:
		tmp = t_1
	else:
		tmp = x * y
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(a * b) + Float64(z * t))
	tmp = 0.0
	if (Float64(x * y) <= -5e+225)
		tmp = Float64(x * y);
	elseif (Float64(x * y) <= -5.2e-271)
		tmp = t_1;
	elseif (Float64(x * y) <= 2e-316)
		tmp = Float64(Float64(c * i) + Float64(z * t));
	elseif (Float64(x * y) <= 1.95e-110)
		tmp = t_1;
	elseif (Float64(x * y) <= 4.8e+148)
		tmp = Float64(Float64(a * b) + Float64(c * i));
	elseif (Float64(x * y) <= 1.02e+200)
		tmp = t_1;
	else
		tmp = Float64(x * y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (a * b) + (z * t);
	tmp = 0.0;
	if ((x * y) <= -5e+225)
		tmp = x * y;
	elseif ((x * y) <= -5.2e-271)
		tmp = t_1;
	elseif ((x * y) <= 2e-316)
		tmp = (c * i) + (z * t);
	elseif ((x * y) <= 1.95e-110)
		tmp = t_1;
	elseif ((x * y) <= 4.8e+148)
		tmp = (a * b) + (c * i);
	elseif ((x * y) <= 1.02e+200)
		tmp = t_1;
	else
		tmp = x * y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -5e+225], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -5.2e-271], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e-316], N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.95e-110], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 4.8e+148], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.02e+200], t$95$1, N[(x * y), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+225}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;x \cdot y \leq -5.2 \cdot 10^{-271}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-316}:\\
\;\;\;\;c \cdot i + z \cdot t\\

\mathbf{elif}\;x \cdot y \leq 1.95 \cdot 10^{-110}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \cdot y \leq 4.8 \cdot 10^{+148}:\\
\;\;\;\;a \cdot b + c \cdot i\\

\mathbf{elif}\;x \cdot y \leq 1.02 \cdot 10^{+200}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;x \cdot y\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 x y) < -4.99999999999999981e225 or 1.02000000000000001e200 < (*.f64 x y)

    1. Initial program 93.1%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 82.9%

      \[\leadsto \color{blue}{x \cdot y} \]

    if -4.99999999999999981e225 < (*.f64 x y) < -5.2e-271 or 2.000000017e-316 < (*.f64 x y) < 1.95e-110 or 4.79999999999999989e148 < (*.f64 x y) < 1.02000000000000001e200

    1. Initial program 96.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 90.1%

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

      \[\leadsto \left(\color{blue}{t \cdot z} + a \cdot b\right) + c \cdot i \]
    5. Taylor expanded in c around 0 75.9%

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

    if -5.2e-271 < (*.f64 x y) < 2.000000017e-316

    1. Initial program 94.9%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 82.6%

      \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right)} + c \cdot i \]
    4. Taylor expanded in x around 0 82.6%

      \[\leadsto \color{blue}{c \cdot i + t \cdot z} \]

    if 1.95e-110 < (*.f64 x y) < 4.79999999999999989e148

    1. Initial program 100.0%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in b around inf 90.9%

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

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

        \[\leadsto b \cdot \left(a + \left(t \cdot \frac{z}{b} + \color{blue}{x \cdot \frac{y}{b}}\right)\right) + c \cdot i \]
    5. Simplified83.7%

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

      \[\leadsto \color{blue}{a \cdot b} + c \cdot i \]
  3. Recombined 4 regimes into one program.
  4. Final simplification77.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+225}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -5.2 \cdot 10^{-271}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-316}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 1.95 \cdot 10^{-110}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 4.8 \cdot 10^{+148}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 1.02 \cdot 10^{+200}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 64.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot b + z \cdot t\\ t_2 := x \cdot y + c \cdot i\\ \mathbf{if}\;x \cdot y \leq -5.8 \cdot 10^{+165}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \cdot y \leq -7.5 \cdot 10^{-271}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-316}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 3 \cdot 10^{-115}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 3.2 \cdot 10^{+149}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 1.9 \cdot 10^{+199}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* a b) (* z t))) (t_2 (+ (* x y) (* c i))))
   (if (<= (* x y) -5.8e+165)
     t_2
     (if (<= (* x y) -7.5e-271)
       t_1
       (if (<= (* x y) 2e-316)
         (+ (* c i) (* z t))
         (if (<= (* x y) 3e-115)
           t_1
           (if (<= (* x y) 3.2e+149)
             (+ (* a b) (* c i))
             (if (<= (* x y) 1.9e+199) t_1 t_2))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (a * b) + (z * t);
	double t_2 = (x * y) + (c * i);
	double tmp;
	if ((x * y) <= -5.8e+165) {
		tmp = t_2;
	} else if ((x * y) <= -7.5e-271) {
		tmp = t_1;
	} else if ((x * y) <= 2e-316) {
		tmp = (c * i) + (z * t);
	} else if ((x * y) <= 3e-115) {
		tmp = t_1;
	} else if ((x * y) <= 3.2e+149) {
		tmp = (a * b) + (c * i);
	} else if ((x * y) <= 1.9e+199) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    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), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (a * b) + (z * t)
    t_2 = (x * y) + (c * i)
    if ((x * y) <= (-5.8d+165)) then
        tmp = t_2
    else if ((x * y) <= (-7.5d-271)) then
        tmp = t_1
    else if ((x * y) <= 2d-316) then
        tmp = (c * i) + (z * t)
    else if ((x * y) <= 3d-115) then
        tmp = t_1
    else if ((x * y) <= 3.2d+149) then
        tmp = (a * b) + (c * i)
    else if ((x * y) <= 1.9d+199) then
        tmp = 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 c, double i) {
	double t_1 = (a * b) + (z * t);
	double t_2 = (x * y) + (c * i);
	double tmp;
	if ((x * y) <= -5.8e+165) {
		tmp = t_2;
	} else if ((x * y) <= -7.5e-271) {
		tmp = t_1;
	} else if ((x * y) <= 2e-316) {
		tmp = (c * i) + (z * t);
	} else if ((x * y) <= 3e-115) {
		tmp = t_1;
	} else if ((x * y) <= 3.2e+149) {
		tmp = (a * b) + (c * i);
	} else if ((x * y) <= 1.9e+199) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (a * b) + (z * t)
	t_2 = (x * y) + (c * i)
	tmp = 0
	if (x * y) <= -5.8e+165:
		tmp = t_2
	elif (x * y) <= -7.5e-271:
		tmp = t_1
	elif (x * y) <= 2e-316:
		tmp = (c * i) + (z * t)
	elif (x * y) <= 3e-115:
		tmp = t_1
	elif (x * y) <= 3.2e+149:
		tmp = (a * b) + (c * i)
	elif (x * y) <= 1.9e+199:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(a * b) + Float64(z * t))
	t_2 = Float64(Float64(x * y) + Float64(c * i))
	tmp = 0.0
	if (Float64(x * y) <= -5.8e+165)
		tmp = t_2;
	elseif (Float64(x * y) <= -7.5e-271)
		tmp = t_1;
	elseif (Float64(x * y) <= 2e-316)
		tmp = Float64(Float64(c * i) + Float64(z * t));
	elseif (Float64(x * y) <= 3e-115)
		tmp = t_1;
	elseif (Float64(x * y) <= 3.2e+149)
		tmp = Float64(Float64(a * b) + Float64(c * i));
	elseif (Float64(x * y) <= 1.9e+199)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (a * b) + (z * t);
	t_2 = (x * y) + (c * i);
	tmp = 0.0;
	if ((x * y) <= -5.8e+165)
		tmp = t_2;
	elseif ((x * y) <= -7.5e-271)
		tmp = t_1;
	elseif ((x * y) <= 2e-316)
		tmp = (c * i) + (z * t);
	elseif ((x * y) <= 3e-115)
		tmp = t_1;
	elseif ((x * y) <= 3.2e+149)
		tmp = (a * b) + (c * i);
	elseif ((x * y) <= 1.9e+199)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -5.8e+165], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], -7.5e-271], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e-316], N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 3e-115], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 3.2e+149], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.9e+199], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
t_2 := x \cdot y + c \cdot i\\
\mathbf{if}\;x \cdot y \leq -5.8 \cdot 10^{+165}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \cdot y \leq -7.5 \cdot 10^{-271}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-316}:\\
\;\;\;\;c \cdot i + z \cdot t\\

\mathbf{elif}\;x \cdot y \leq 3 \cdot 10^{-115}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \cdot y \leq 3.2 \cdot 10^{+149}:\\
\;\;\;\;a \cdot b + c \cdot i\\

\mathbf{elif}\;x \cdot y \leq 1.9 \cdot 10^{+199}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 x y) < -5.80000000000000011e165 or 1.9e199 < (*.f64 x y)

    1. Initial program 94.1%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 86.7%

      \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right)} + c \cdot i \]
    4. Taylor expanded in t around 0 85.4%

      \[\leadsto \color{blue}{c \cdot i + x \cdot y} \]

    if -5.80000000000000011e165 < (*.f64 x y) < -7.50000000000000031e-271 or 2.000000017e-316 < (*.f64 x y) < 3.0000000000000002e-115 or 3.2000000000000002e149 < (*.f64 x y) < 1.9e199

    1. Initial program 96.3%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 91.8%

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

      \[\leadsto \left(\color{blue}{t \cdot z} + a \cdot b\right) + c \cdot i \]
    5. Taylor expanded in c around 0 78.3%

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

    if -7.50000000000000031e-271 < (*.f64 x y) < 2.000000017e-316

    1. Initial program 94.9%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 82.6%

      \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right)} + c \cdot i \]
    4. Taylor expanded in x around 0 82.6%

      \[\leadsto \color{blue}{c \cdot i + t \cdot z} \]

    if 3.0000000000000002e-115 < (*.f64 x y) < 3.2000000000000002e149

    1. Initial program 100.0%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in b around inf 90.9%

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

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

        \[\leadsto b \cdot \left(a + \left(t \cdot \frac{z}{b} + \color{blue}{x \cdot \frac{y}{b}}\right)\right) + c \cdot i \]
    5. Simplified83.7%

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

      \[\leadsto \color{blue}{a \cdot b} + c \cdot i \]
  3. Recombined 4 regimes into one program.
  4. Final simplification78.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -5.8 \cdot 10^{+165}:\\ \;\;\;\;x \cdot y + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq -7.5 \cdot 10^{-271}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-316}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 3 \cdot 10^{-115}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 3.2 \cdot 10^{+149}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 1.9 \cdot 10^{+199}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 61.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot b + c \cdot i\\ \mathbf{if}\;x \cdot y \leq -1.65 \cdot 10^{+225}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{-108}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq -4.5 \cdot 10^{-169}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 2.6 \cdot 10^{+132}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* a b) (* c i))))
   (if (<= (* x y) -1.65e+225)
     (* x y)
     (if (<= (* x y) -1e-108)
       t_1
       (if (<= (* x y) -4.5e-169)
         (* z t)
         (if (<= (* x y) 2.6e+132) t_1 (* x y)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (a * b) + (c * i);
	double tmp;
	if ((x * y) <= -1.65e+225) {
		tmp = x * y;
	} else if ((x * y) <= -1e-108) {
		tmp = t_1;
	} else if ((x * y) <= -4.5e-169) {
		tmp = z * t;
	} else if ((x * y) <= 2.6e+132) {
		tmp = t_1;
	} else {
		tmp = x * y;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    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), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (a * b) + (c * i)
    if ((x * y) <= (-1.65d+225)) then
        tmp = x * y
    else if ((x * y) <= (-1d-108)) then
        tmp = t_1
    else if ((x * y) <= (-4.5d-169)) then
        tmp = z * t
    else if ((x * y) <= 2.6d+132) then
        tmp = t_1
    else
        tmp = x * y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (a * b) + (c * i);
	double tmp;
	if ((x * y) <= -1.65e+225) {
		tmp = x * y;
	} else if ((x * y) <= -1e-108) {
		tmp = t_1;
	} else if ((x * y) <= -4.5e-169) {
		tmp = z * t;
	} else if ((x * y) <= 2.6e+132) {
		tmp = t_1;
	} else {
		tmp = x * y;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (a * b) + (c * i)
	tmp = 0
	if (x * y) <= -1.65e+225:
		tmp = x * y
	elif (x * y) <= -1e-108:
		tmp = t_1
	elif (x * y) <= -4.5e-169:
		tmp = z * t
	elif (x * y) <= 2.6e+132:
		tmp = t_1
	else:
		tmp = x * y
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(a * b) + Float64(c * i))
	tmp = 0.0
	if (Float64(x * y) <= -1.65e+225)
		tmp = Float64(x * y);
	elseif (Float64(x * y) <= -1e-108)
		tmp = t_1;
	elseif (Float64(x * y) <= -4.5e-169)
		tmp = Float64(z * t);
	elseif (Float64(x * y) <= 2.6e+132)
		tmp = t_1;
	else
		tmp = Float64(x * y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (a * b) + (c * i);
	tmp = 0.0;
	if ((x * y) <= -1.65e+225)
		tmp = x * y;
	elseif ((x * y) <= -1e-108)
		tmp = t_1;
	elseif ((x * y) <= -4.5e-169)
		tmp = z * t;
	elseif ((x * y) <= 2.6e+132)
		tmp = t_1;
	else
		tmp = x * y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -1.65e+225], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -1e-108], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -4.5e-169], N[(z * t), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2.6e+132], t$95$1, N[(x * y), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := a \cdot b + c \cdot i\\
\mathbf{if}\;x \cdot y \leq -1.65 \cdot 10^{+225}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{-108}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \cdot y \leq -4.5 \cdot 10^{-169}:\\
\;\;\;\;z \cdot t\\

\mathbf{elif}\;x \cdot y \leq 2.6 \cdot 10^{+132}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;x \cdot y\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -1.65e225 or 2.6e132 < (*.f64 x y)

    1. Initial program 92.8%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 74.3%

      \[\leadsto \color{blue}{x \cdot y} \]

    if -1.65e225 < (*.f64 x y) < -1.00000000000000004e-108 or -4.4999999999999999e-169 < (*.f64 x y) < 2.6e132

    1. Initial program 97.7%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in b around inf 89.6%

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b} + c \cdot i \]

    if -1.00000000000000004e-108 < (*.f64 x y) < -4.4999999999999999e-169

    1. Initial program 90.9%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 82.3%

      \[\leadsto \color{blue}{t \cdot z} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification66.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1.65 \cdot 10^{+225}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{-108}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq -4.5 \cdot 10^{-169}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 2.6 \cdot 10^{+132}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 97.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := c \cdot i + \left(a \cdot b + \left(x \cdot y + z \cdot t\right)\right)\\ \mathbf{if}\;t\_1 \leq \infty:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(t + \frac{x \cdot y}{z}\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* c i) (+ (* a b) (+ (* x y) (* z t))))))
   (if (<= t_1 INFINITY) t_1 (* z (+ t (/ (* x y) z))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (c * i) + ((a * b) + ((x * y) + (z * t)));
	double tmp;
	if (t_1 <= ((double) INFINITY)) {
		tmp = t_1;
	} else {
		tmp = z * (t + ((x * y) / z));
	}
	return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (c * i) + ((a * b) + ((x * y) + (z * t)));
	double tmp;
	if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else {
		tmp = z * (t + ((x * y) / z));
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (c * i) + ((a * b) + ((x * y) + (z * t)))
	tmp = 0
	if t_1 <= math.inf:
		tmp = t_1
	else:
		tmp = z * (t + ((x * y) / z))
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))))
	tmp = 0.0
	if (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = Float64(z * Float64(t + Float64(Float64(x * y) / z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (c * i) + ((a * b) + ((x * y) + (z * t)));
	tmp = 0.0;
	if (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = z * (t + ((x * y) / z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(z * N[(t + N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := c \cdot i + \left(a \cdot b + \left(x \cdot y + z \cdot t\right)\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) < +inf.0

    1. Initial program 100.0%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing

    if +inf.0 < (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i))

    1. Initial program 0.0%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 10.0%

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

      \[\leadsto \color{blue}{z \cdot \left(t + \frac{x \cdot y}{z}\right)} + c \cdot i \]
    5. Taylor expanded in c around 0 50.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i + \left(a \cdot b + \left(x \cdot y + z \cdot t\right)\right) \leq \infty:\\ \;\;\;\;c \cdot i + \left(a \cdot b + \left(x \cdot y + z \cdot t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(t + \frac{x \cdot y}{z}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 42.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.65 \cdot 10^{+24}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq 5.2 \cdot 10^{-9}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 6 \cdot 10^{+33}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 8.5 \cdot 10^{+141}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= (* a b) -1.65e+24)
   (* a b)
   (if (<= (* a b) 5.2e-9)
     (* z t)
     (if (<= (* a b) 6e+33)
       (* c i)
       (if (<= (* a b) 8.5e+141) (* z t) (* a b))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((a * b) <= -1.65e+24) {
		tmp = a * b;
	} else if ((a * b) <= 5.2e-9) {
		tmp = z * t;
	} else if ((a * b) <= 6e+33) {
		tmp = c * i;
	} else if ((a * b) <= 8.5e+141) {
		tmp = z * t;
	} else {
		tmp = a * b;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    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), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: tmp
    if ((a * b) <= (-1.65d+24)) then
        tmp = a * b
    else if ((a * b) <= 5.2d-9) then
        tmp = z * t
    else if ((a * b) <= 6d+33) then
        tmp = c * i
    else if ((a * b) <= 8.5d+141) then
        tmp = z * t
    else
        tmp = 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 c, double i) {
	double tmp;
	if ((a * b) <= -1.65e+24) {
		tmp = a * b;
	} else if ((a * b) <= 5.2e-9) {
		tmp = z * t;
	} else if ((a * b) <= 6e+33) {
		tmp = c * i;
	} else if ((a * b) <= 8.5e+141) {
		tmp = z * t;
	} else {
		tmp = a * b;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (a * b) <= -1.65e+24:
		tmp = a * b
	elif (a * b) <= 5.2e-9:
		tmp = z * t
	elif (a * b) <= 6e+33:
		tmp = c * i
	elif (a * b) <= 8.5e+141:
		tmp = z * t
	else:
		tmp = a * b
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (Float64(a * b) <= -1.65e+24)
		tmp = Float64(a * b);
	elseif (Float64(a * b) <= 5.2e-9)
		tmp = Float64(z * t);
	elseif (Float64(a * b) <= 6e+33)
		tmp = Float64(c * i);
	elseif (Float64(a * b) <= 8.5e+141)
		tmp = Float64(z * t);
	else
		tmp = Float64(a * b);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if ((a * b) <= -1.65e+24)
		tmp = a * b;
	elseif ((a * b) <= 5.2e-9)
		tmp = z * t;
	elseif ((a * b) <= 6e+33)
		tmp = c * i;
	elseif ((a * b) <= 8.5e+141)
		tmp = z * t;
	else
		tmp = a * b;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -1.65e+24], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5.2e-9], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 6e+33], N[(c * i), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 8.5e+141], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.65 \cdot 10^{+24}:\\
\;\;\;\;a \cdot b\\

\mathbf{elif}\;a \cdot b \leq 5.2 \cdot 10^{-9}:\\
\;\;\;\;z \cdot t\\

\mathbf{elif}\;a \cdot b \leq 6 \cdot 10^{+33}:\\
\;\;\;\;c \cdot i\\

\mathbf{elif}\;a \cdot b \leq 8.5 \cdot 10^{+141}:\\
\;\;\;\;z \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -1.6499999999999999e24 or 8.4999999999999996e141 < (*.f64 a b)

    1. Initial program 93.7%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in a around inf 64.5%

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

    if -1.6499999999999999e24 < (*.f64 a b) < 5.2000000000000002e-9 or 5.99999999999999967e33 < (*.f64 a b) < 8.4999999999999996e141

    1. Initial program 97.3%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 40.8%

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

    if 5.2000000000000002e-9 < (*.f64 a b) < 5.99999999999999967e33

    1. Initial program 100.0%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in c around inf 64.8%

      \[\leadsto \color{blue}{c \cdot i} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification50.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.65 \cdot 10^{+24}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq 5.2 \cdot 10^{-9}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 6 \cdot 10^{+33}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 8.5 \cdot 10^{+141}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 86.0% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{-95}:\\
\;\;\;\;a \cdot b + t\_1\\

\mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{+140}:\\
\;\;\;\;c \cdot i + t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -9.99999999999999989e-96

    1. Initial program 94.5%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in c around 0 86.7%

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

    if -9.99999999999999989e-96 < (*.f64 a b) < 2.00000000000000012e140

    1. Initial program 97.8%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 94.4%

      \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right)} + c \cdot i \]

    if 2.00000000000000012e140 < (*.f64 a b)

    1. Initial program 93.4%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in b around inf 93.4%

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

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

        \[\leadsto b \cdot \left(a + \left(t \cdot \frac{z}{b} + \color{blue}{x \cdot \frac{y}{b}}\right)\right) + c \cdot i \]
    5. Simplified95.6%

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

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

        \[\leadsto b \cdot \left(a + \color{blue}{x \cdot \frac{y}{b}}\right) + c \cdot i \]
    8. Simplified97.6%

      \[\leadsto \color{blue}{b \cdot \left(a + x \cdot \frac{y}{b}\right)} + c \cdot i \]
  3. Recombined 3 regimes into one program.
  4. Final simplification92.8%

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

Alternative 11: 87.8% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.28 \cdot 10^{-12} \lor \neg \left(x \cdot y \leq 3.9 \cdot 10^{+56}\right):\\
\;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\

\mathbf{else}:\\
\;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -1.28e-12 or 3.89999999999999994e56 < (*.f64 x y)

    1. Initial program 95.5%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in c around 0 88.5%

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

    if -1.28e-12 < (*.f64 x y) < 3.89999999999999994e56

    1. Initial program 96.5%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 92.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1.28 \cdot 10^{-12} \lor \neg \left(x \cdot y \leq 3.9 \cdot 10^{+56}\right):\\ \;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 85.1% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -2 \cdot 10^{+119}:\\
\;\;\;\;x \cdot y + c \cdot i\\

\mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{+193}:\\
\;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\

\mathbf{else}:\\
\;\;\;\;a \cdot b + c \cdot i\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 c i) < -1.99999999999999989e119

    1. Initial program 92.5%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 85.3%

      \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right)} + c \cdot i \]
    4. Taylor expanded in t around 0 80.6%

      \[\leadsto \color{blue}{c \cdot i + x \cdot y} \]

    if -1.99999999999999989e119 < (*.f64 c i) < 2.00000000000000013e193

    1. Initial program 98.4%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in c around 0 92.4%

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

    if 2.00000000000000013e193 < (*.f64 c i)

    1. Initial program 86.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in b around inf 83.3%

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b} + c \cdot i \]
  3. Recombined 3 regimes into one program.
  4. Final simplification89.5%

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

Alternative 13: 87.0% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
\mathbf{if}\;c \cdot i \leq -2 \cdot 10^{+119}:\\
\;\;\;\;c \cdot i + t\_1\\

\mathbf{elif}\;c \cdot i \leq 10^{-52}:\\
\;\;\;\;a \cdot b + t\_1\\

\mathbf{else}:\\
\;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 c i) < -1.99999999999999989e119

    1. Initial program 92.5%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 85.3%

      \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right)} + c \cdot i \]

    if -1.99999999999999989e119 < (*.f64 c i) < 1e-52

    1. Initial program 98.0%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in c around 0 95.2%

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

    if 1e-52 < (*.f64 c i)

    1. Initial program 93.5%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 84.3%

      \[\leadsto \color{blue}{\left(a \cdot b + t \cdot z\right)} + c \cdot i \]
  3. Recombined 3 regimes into one program.
  4. Final simplification91.0%

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

Alternative 14: 66.5% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -6.8 \cdot 10^{+56} \lor \neg \left(c \cdot i \leq 9500000000\right):\\
\;\;\;\;a \cdot b + c \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c i) < -6.80000000000000002e56 or 9.5e9 < (*.f64 c i)

    1. Initial program 93.1%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in b around inf 87.5%

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b} + c \cdot i \]

    if -6.80000000000000002e56 < (*.f64 c i) < 9.5e9

    1. Initial program 98.0%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 88.2%

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

      \[\leadsto \left(\color{blue}{t \cdot z} + a \cdot b\right) + c \cdot i \]
    5. Taylor expanded in c around 0 66.1%

      \[\leadsto \color{blue}{a \cdot b + t \cdot z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification68.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -6.8 \cdot 10^{+56} \lor \neg \left(c \cdot i \leq 9500000000\right):\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 43.1% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -8.2 \cdot 10^{+21} \lor \neg \left(a \cdot b \leq 1.4 \cdot 10^{+125}\right):\\
\;\;\;\;a \cdot b\\

\mathbf{else}:\\
\;\;\;\;c \cdot i\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -8.2e21 or 1.4e125 < (*.f64 a b)

    1. Initial program 93.8%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in a around inf 64.2%

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

    if -8.2e21 < (*.f64 a b) < 1.4e125

    1. Initial program 97.5%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in c around inf 30.9%

      \[\leadsto \color{blue}{c \cdot i} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification43.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -8.2 \cdot 10^{+21} \lor \neg \left(a \cdot b \leq 1.4 \cdot 10^{+125}\right):\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 27.8% accurate, 5.0× speedup?

\[\begin{array}{l} \\ a \cdot b \end{array} \]
(FPCore (x y z t a b c i) :precision binary64 (* a b))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return a * b;
}
real(8) function code(x, y, z, t, a, b, c, i)
    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), intent (in) :: c
    real(8), intent (in) :: i
    code = a * b
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return a * b;
}
def code(x, y, z, t, a, b, c, i):
	return a * b
function code(x, y, z, t, a, b, c, i)
	return Float64(a * b)
end
function tmp = code(x, y, z, t, a, b, c, i)
	tmp = a * b;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(a * b), $MachinePrecision]
\begin{array}{l}

\\
a \cdot b
\end{array}
Derivation
  1. Initial program 96.1%

    \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
  2. Add Preprocessing
  3. Taylor expanded in a around inf 28.6%

    \[\leadsto \color{blue}{a \cdot b} \]
  4. Final simplification28.6%

    \[\leadsto a \cdot b \]
  5. Add Preprocessing

Reproduce

?
herbie shell --seed 2024096 
(FPCore (x y z t a b c i)
  :name "Linear.V4:$cdot from linear-1.19.1.3, C"
  :precision binary64
  (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))