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

Percentage Accurate: 96.0% → 97.6%
Time: 9.7s
Alternatives: 14
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 14 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: 96.0% 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: 97.6% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(a \cdot b + \left(x \cdot y + z \cdot t\right)\right) + c \cdot i \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(x, y, z \cdot t\right) + \left(a \cdot b + c \cdot i\right)\\ \mathbf{else}:\\ \;\;\;\;c \cdot \left(i + \frac{x \cdot y}{c}\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= (+ (+ (* a b) (+ (* x y) (* z t))) (* c i)) INFINITY)
   (+ (fma x y (* z t)) (+ (* a b) (* c i)))
   (* c (+ i (/ (* x y) c)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((((a * b) + ((x * y) + (z * t))) + (c * i)) <= ((double) INFINITY)) {
		tmp = fma(x, y, (z * t)) + ((a * b) + (c * i));
	} else {
		tmp = c * (i + ((x * y) / c));
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (Float64(Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))) + Float64(c * i)) <= Inf)
		tmp = Float64(fma(x, y, Float64(z * t)) + Float64(Float64(a * b) + Float64(c * i)));
	else
		tmp = Float64(c * Float64(i + Float64(Float64(x * y) / c)));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * N[(i + N[(N[(x * y), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;c \cdot \left(i + \frac{x \cdot y}{c}\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. Step-by-step derivation
      1. associate-+l+100.0%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, z \cdot t\right) + \left(a \cdot b + c \cdot i\right)} \]
    4. 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 a around 0 35.7%

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

      \[\leadsto \color{blue}{c \cdot i + x \cdot y} \]
    5. Taylor expanded in c around inf 71.7%

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

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

Alternative 2: 97.9% 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 94.5%

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

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

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

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

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

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

    \[\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. Add Preprocessing

Alternative 3: 42.5% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.9 \cdot 10^{+205}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -3.1 \cdot 10^{-14}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq -2 \cdot 10^{-297}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 3.7 \cdot 10^{-169}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 2.8 \cdot 10^{+134}:\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= (* a b) -1.9e+205)
   (* a b)
   (if (<= (* a b) -3.1e-14)
     (* z t)
     (if (<= (* a b) -2e-297)
       (* x y)
       (if (<= (* a b) 3.7e-169)
         (* z t)
         (if (<= (* a b) 2.8e+134) (* c i) (* 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.9e+205) {
		tmp = a * b;
	} else if ((a * b) <= -3.1e-14) {
		tmp = z * t;
	} else if ((a * b) <= -2e-297) {
		tmp = x * y;
	} else if ((a * b) <= 3.7e-169) {
		tmp = z * t;
	} else if ((a * b) <= 2.8e+134) {
		tmp = c * i;
	} 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.9d+205)) then
        tmp = a * b
    else if ((a * b) <= (-3.1d-14)) then
        tmp = z * t
    else if ((a * b) <= (-2d-297)) then
        tmp = x * y
    else if ((a * b) <= 3.7d-169) then
        tmp = z * t
    else if ((a * b) <= 2.8d+134) then
        tmp = c * i
    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.9e+205) {
		tmp = a * b;
	} else if ((a * b) <= -3.1e-14) {
		tmp = z * t;
	} else if ((a * b) <= -2e-297) {
		tmp = x * y;
	} else if ((a * b) <= 3.7e-169) {
		tmp = z * t;
	} else if ((a * b) <= 2.8e+134) {
		tmp = c * i;
	} else {
		tmp = a * b;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (a * b) <= -1.9e+205:
		tmp = a * b
	elif (a * b) <= -3.1e-14:
		tmp = z * t
	elif (a * b) <= -2e-297:
		tmp = x * y
	elif (a * b) <= 3.7e-169:
		tmp = z * t
	elif (a * b) <= 2.8e+134:
		tmp = c * i
	else:
		tmp = a * b
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (Float64(a * b) <= -1.9e+205)
		tmp = Float64(a * b);
	elseif (Float64(a * b) <= -3.1e-14)
		tmp = Float64(z * t);
	elseif (Float64(a * b) <= -2e-297)
		tmp = Float64(x * y);
	elseif (Float64(a * b) <= 3.7e-169)
		tmp = Float64(z * t);
	elseif (Float64(a * b) <= 2.8e+134)
		tmp = Float64(c * i);
	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.9e+205)
		tmp = a * b;
	elseif ((a * b) <= -3.1e-14)
		tmp = z * t;
	elseif ((a * b) <= -2e-297)
		tmp = x * y;
	elseif ((a * b) <= 3.7e-169)
		tmp = z * t;
	elseif ((a * b) <= 2.8e+134)
		tmp = c * i;
	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.9e+205], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -3.1e-14], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -2e-297], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 3.7e-169], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2.8e+134], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]]
\begin{array}{l}

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 a b) < -1.9e205 or 2.7999999999999999e134 < (*.f64 a b)

    1. Initial program 85.2%

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

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

    if -1.9e205 < (*.f64 a b) < -3.10000000000000004e-14 or -2.00000000000000008e-297 < (*.f64 a b) < 3.6999999999999997e-169

    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 z around inf 42.9%

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

    if -3.10000000000000004e-14 < (*.f64 a b) < -2.00000000000000008e-297

    1. Initial program 99.9%

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

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

    if 3.6999999999999997e-169 < (*.f64 a b) < 2.7999999999999999e134

    1. Initial program 95.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.9 \cdot 10^{+205}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -3.1 \cdot 10^{-14}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq -2 \cdot 10^{-297}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 3.7 \cdot 10^{-169}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 2.8 \cdot 10^{+134}:\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 63.7% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := c \cdot i + z \cdot t\\ t_2 := x \cdot y + a \cdot b\\ \mathbf{if}\;a \cdot b \leq -2.2 \cdot 10^{+207}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;a \cdot b \leq -9.4 \cdot 10^{-73}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \cdot b \leq 1.08 \cdot 10^{-225}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 8.5 \cdot 10^{+193}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* c i) (* z t))) (t_2 (+ (* x y) (* a b))))
   (if (<= (* a b) -2.2e+207)
     t_2
     (if (<= (* a b) -9.4e-73)
       t_1
       (if (<= (* a b) 1.08e-225)
         (+ (* x y) (* z t))
         (if (<= (* a b) 8.5e+193) 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 = (c * i) + (z * t);
	double t_2 = (x * y) + (a * b);
	double tmp;
	if ((a * b) <= -2.2e+207) {
		tmp = t_2;
	} else if ((a * b) <= -9.4e-73) {
		tmp = t_1;
	} else if ((a * b) <= 1.08e-225) {
		tmp = (x * y) + (z * t);
	} else if ((a * b) <= 8.5e+193) {
		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 = (c * i) + (z * t)
    t_2 = (x * y) + (a * b)
    if ((a * b) <= (-2.2d+207)) then
        tmp = t_2
    else if ((a * b) <= (-9.4d-73)) then
        tmp = t_1
    else if ((a * b) <= 1.08d-225) then
        tmp = (x * y) + (z * t)
    else if ((a * b) <= 8.5d+193) 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 = (c * i) + (z * t);
	double t_2 = (x * y) + (a * b);
	double tmp;
	if ((a * b) <= -2.2e+207) {
		tmp = t_2;
	} else if ((a * b) <= -9.4e-73) {
		tmp = t_1;
	} else if ((a * b) <= 1.08e-225) {
		tmp = (x * y) + (z * t);
	} else if ((a * b) <= 8.5e+193) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (c * i) + (z * t)
	t_2 = (x * y) + (a * b)
	tmp = 0
	if (a * b) <= -2.2e+207:
		tmp = t_2
	elif (a * b) <= -9.4e-73:
		tmp = t_1
	elif (a * b) <= 1.08e-225:
		tmp = (x * y) + (z * t)
	elif (a * b) <= 8.5e+193:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(c * i) + Float64(z * t))
	t_2 = Float64(Float64(x * y) + Float64(a * b))
	tmp = 0.0
	if (Float64(a * b) <= -2.2e+207)
		tmp = t_2;
	elseif (Float64(a * b) <= -9.4e-73)
		tmp = t_1;
	elseif (Float64(a * b) <= 1.08e-225)
		tmp = Float64(Float64(x * y) + Float64(z * t));
	elseif (Float64(a * b) <= 8.5e+193)
		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 = (c * i) + (z * t);
	t_2 = (x * y) + (a * b);
	tmp = 0.0;
	if ((a * b) <= -2.2e+207)
		tmp = t_2;
	elseif ((a * b) <= -9.4e-73)
		tmp = t_1;
	elseif ((a * b) <= 1.08e-225)
		tmp = (x * y) + (z * t);
	elseif ((a * b) <= 8.5e+193)
		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[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -2.2e+207], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], -9.4e-73], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 1.08e-225], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 8.5e+193], t$95$1, t$95$2]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;a \cdot b \leq -9.4 \cdot 10^{-73}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;a \cdot b \leq 1.08 \cdot 10^{-225}:\\
\;\;\;\;x \cdot y + z \cdot t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -2.20000000000000009e207 or 8.5000000000000003e193 < (*.f64 a b)

    1. Initial program 83.1%

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

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

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

      \[\leadsto \color{blue}{a \cdot b + x \cdot y} \]

    if -2.20000000000000009e207 < (*.f64 a b) < -9.39999999999999988e-73 or 1.08000000000000006e-225 < (*.f64 a b) < 8.5000000000000003e193

    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 x around 0 80.0%

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

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

    if -9.39999999999999988e-73 < (*.f64 a b) < 1.08000000000000006e-225

    1. Initial program 99.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 99.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -2.2 \cdot 10^{+207}:\\ \;\;\;\;x \cdot y + a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -9.4 \cdot 10^{-73}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.08 \cdot 10^{-225}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 8.5 \cdot 10^{+193}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 97.6% accurate, 0.4× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;c \cdot \left(i + \frac{x \cdot y}{c}\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 a around 0 35.7%

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

      \[\leadsto \color{blue}{c \cdot i + x \cdot y} \]
    5. Taylor expanded in c around inf 71.7%

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

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

Alternative 6: 66.1% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -3 \cdot 10^{+163}:\\
\;\;\;\;a \cdot b + c \cdot i\\

\mathbf{elif}\;c \cdot i \leq -1.45 \cdot 10^{+87} \lor \neg \left(c \cdot i \leq 3.8 \cdot 10^{+44}\right):\\
\;\;\;\;c \cdot i + z \cdot t\\

\mathbf{else}:\\
\;\;\;\;x \cdot y + a \cdot b\\


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

    1. Initial program 86.2%

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

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

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

    if -3.00000000000000013e163 < (*.f64 c i) < -1.4499999999999999e87 or 3.8000000000000002e44 < (*.f64 c i)

    1. Initial program 91.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 0 85.6%

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

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

    if -1.4499999999999999e87 < (*.f64 c i) < 3.8000000000000002e44

    1. Initial program 97.4%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -3 \cdot 10^{+163}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -1.45 \cdot 10^{+87} \lor \neg \left(c \cdot i \leq 3.8 \cdot 10^{+44}\right):\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 88.0% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4.7 \cdot 10^{+26}:\\
\;\;\;\;c \cdot i + \left(x \cdot y + a \cdot b\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -4.6999999999999998e26

    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 z around 0 87.5%

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

    if -4.6999999999999998e26 < (*.f64 x y) < 3.8e25

    1. Initial program 97.2%

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

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

    if 3.8e25 < (*.f64 x y)

    1. Initial program 87.2%

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

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

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

Alternative 8: 84.3% accurate, 0.6× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -4.19999999999999979e145

    1. Initial program 91.4%

      \[\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.3%

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

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

    if -4.19999999999999979e145 < (*.f64 x y) < 2.80000000000000002e71

    1. Initial program 97.6%

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

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

    if 2.80000000000000002e71 < (*.f64 x y)

    1. Initial program 86.2%

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

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

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

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

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

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

Alternative 9: 42.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.9 \cdot 10^{+205}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq 1.8 \cdot 10^{-169}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 6 \cdot 10^{+133}:\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= (* a b) -1.9e+205)
   (* a b)
   (if (<= (* a b) 1.8e-169)
     (* z t)
     (if (<= (* a b) 6e+133) (* c i) (* 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.9e+205) {
		tmp = a * b;
	} else if ((a * b) <= 1.8e-169) {
		tmp = z * t;
	} else if ((a * b) <= 6e+133) {
		tmp = c * i;
	} 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.9d+205)) then
        tmp = a * b
    else if ((a * b) <= 1.8d-169) then
        tmp = z * t
    else if ((a * b) <= 6d+133) then
        tmp = c * i
    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.9e+205) {
		tmp = a * b;
	} else if ((a * b) <= 1.8e-169) {
		tmp = z * t;
	} else if ((a * b) <= 6e+133) {
		tmp = c * i;
	} else {
		tmp = a * b;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (a * b) <= -1.9e+205:
		tmp = a * b
	elif (a * b) <= 1.8e-169:
		tmp = z * t
	elif (a * b) <= 6e+133:
		tmp = c * i
	else:
		tmp = a * b
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (Float64(a * b) <= -1.9e+205)
		tmp = Float64(a * b);
	elseif (Float64(a * b) <= 1.8e-169)
		tmp = Float64(z * t);
	elseif (Float64(a * b) <= 6e+133)
		tmp = Float64(c * i);
	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.9e+205)
		tmp = a * b;
	elseif ((a * b) <= 1.8e-169)
		tmp = z * t;
	elseif ((a * b) <= 6e+133)
		tmp = c * i;
	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.9e+205], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.8e-169], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 6e+133], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]]]
\begin{array}{l}

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -1.9e205 or 6.00000000000000013e133 < (*.f64 a b)

    1. Initial program 85.2%

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

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

    if -1.9e205 < (*.f64 a b) < 1.80000000000000001e-169

    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 z around inf 37.4%

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

    if 1.80000000000000001e-169 < (*.f64 a b) < 6.00000000000000013e133

    1. Initial program 95.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.9 \cdot 10^{+205}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq 1.8 \cdot 10^{-169}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 6 \cdot 10^{+133}:\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 65.9% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -2.7 \cdot 10^{+77} \lor \neg \left(c \cdot i \leq 5.6 \cdot 10^{+44}\right):\\
\;\;\;\;a \cdot b + c \cdot i\\

\mathbf{else}:\\
\;\;\;\;x \cdot y + a \cdot b\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c i) < -2.6999999999999998e77 or 5.6000000000000002e44 < (*.f64 c i)

    1. Initial program 90.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 \]
    4. Taylor expanded in t around 0 71.7%

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

    if -2.6999999999999998e77 < (*.f64 c i) < 5.6000000000000002e44

    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 93.5%

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

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

      \[\leadsto \color{blue}{a \cdot b + x \cdot y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification69.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -2.7 \cdot 10^{+77} \lor \neg \left(c \cdot i \leq 5.6 \cdot 10^{+44}\right):\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 62.4% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.95 \cdot 10^{+211} \lor \neg \left(x \cdot y \leq 6.7 \cdot 10^{+112}\right):\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -1.95000000000000011e211 or 6.6999999999999998e112 < (*.f64 x y)

    1. Initial program 87.0%

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

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

    if -1.95000000000000011e211 < (*.f64 x y) < 6.6999999999999998e112

    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 x around 0 87.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1.95 \cdot 10^{+211} \lor \neg \left(x \cdot y \leq 6.7 \cdot 10^{+112}\right):\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 77.5% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+53}:\\
\;\;\;\;x \cdot y\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.2e53

    1. Initial program 85.4%

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

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

    if -1.2e53 < y < 4.99999999999999986e58

    1. Initial program 98.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 0 86.0%

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

    if 4.99999999999999986e58 < y

    1. Initial program 91.5%

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

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

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

Alternative 13: 41.7% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -5.5 \cdot 10^{+209} \lor \neg \left(a \cdot b \leq 6.8 \cdot 10^{+133}\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) -5.5e+209) (not (<= (* a b) 6.8e+133))) (* 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) <= -5.5e+209) || !((a * b) <= 6.8e+133)) {
		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) <= (-5.5d+209)) .or. (.not. ((a * b) <= 6.8d+133))) 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) <= -5.5e+209) || !((a * b) <= 6.8e+133)) {
		tmp = a * b;
	} else {
		tmp = c * i;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if ((a * b) <= -5.5e+209) or not ((a * b) <= 6.8e+133):
		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) <= -5.5e+209) || !(Float64(a * b) <= 6.8e+133))
		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) <= -5.5e+209) || ~(((a * b) <= 6.8e+133)))
		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], -5.5e+209], N[Not[LessEqual[N[(a * b), $MachinePrecision], 6.8e+133]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(c * i), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5.5 \cdot 10^{+209} \lor \neg \left(a \cdot b \leq 6.8 \cdot 10^{+133}\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) < -5.49999999999999967e209 or 6.79999999999999975e133 < (*.f64 a b)

    1. Initial program 85.0%

      \[\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 -5.49999999999999967e209 < (*.f64 a b) < 6.79999999999999975e133

    1. Initial program 98.8%

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

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

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

Alternative 14: 27.5% 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 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 a around inf 30.9%

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

Reproduce

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