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

Percentage Accurate: 95.8% → 97.9%
Time: 12.5s
Alternatives: 13
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 13 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.8% 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.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 93.4%

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

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

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

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

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

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

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

    \[\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 2: 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 -1.06 \cdot 10^{+102}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \cdot y \leq 2.3 \cdot 10^{-217}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 7 \cdot 10^{-40}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 6000000000000 \lor \neg \left(x \cdot y \leq 1.28 \cdot 10^{+92}\right) \land x \cdot y \leq 2.4 \cdot 10^{+156}:\\ \;\;\;\;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) -1.06e+102)
     t_2
     (if (<= (* x y) 2.3e-217)
       t_1
       (if (<= (* x y) 7e-40)
         (+ (* a b) (* c i))
         (if (or (<= (* x y) 6000000000000.0)
                 (and (not (<= (* x y) 1.28e+92)) (<= (* x y) 2.4e+156)))
           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) <= -1.06e+102) {
		tmp = t_2;
	} else if ((x * y) <= 2.3e-217) {
		tmp = t_1;
	} else if ((x * y) <= 7e-40) {
		tmp = (a * b) + (c * i);
	} else if (((x * y) <= 6000000000000.0) || (!((x * y) <= 1.28e+92) && ((x * y) <= 2.4e+156))) {
		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) <= (-1.06d+102)) then
        tmp = t_2
    else if ((x * y) <= 2.3d-217) then
        tmp = t_1
    else if ((x * y) <= 7d-40) then
        tmp = (a * b) + (c * i)
    else if (((x * y) <= 6000000000000.0d0) .or. (.not. ((x * y) <= 1.28d+92)) .and. ((x * y) <= 2.4d+156)) 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) <= -1.06e+102) {
		tmp = t_2;
	} else if ((x * y) <= 2.3e-217) {
		tmp = t_1;
	} else if ((x * y) <= 7e-40) {
		tmp = (a * b) + (c * i);
	} else if (((x * y) <= 6000000000000.0) || (!((x * y) <= 1.28e+92) && ((x * y) <= 2.4e+156))) {
		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) <= -1.06e+102:
		tmp = t_2
	elif (x * y) <= 2.3e-217:
		tmp = t_1
	elif (x * y) <= 7e-40:
		tmp = (a * b) + (c * i)
	elif ((x * y) <= 6000000000000.0) or (not ((x * y) <= 1.28e+92) and ((x * y) <= 2.4e+156)):
		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) <= -1.06e+102)
		tmp = t_2;
	elseif (Float64(x * y) <= 2.3e-217)
		tmp = t_1;
	elseif (Float64(x * y) <= 7e-40)
		tmp = Float64(Float64(a * b) + Float64(c * i));
	elseif ((Float64(x * y) <= 6000000000000.0) || (!(Float64(x * y) <= 1.28e+92) && (Float64(x * y) <= 2.4e+156)))
		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) <= -1.06e+102)
		tmp = t_2;
	elseif ((x * y) <= 2.3e-217)
		tmp = t_1;
	elseif ((x * y) <= 7e-40)
		tmp = (a * b) + (c * i);
	elseif (((x * y) <= 6000000000000.0) || (~(((x * y) <= 1.28e+92)) && ((x * y) <= 2.4e+156)))
		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], -1.06e+102], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 2.3e-217], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 7e-40], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(x * y), $MachinePrecision], 6000000000000.0], And[N[Not[LessEqual[N[(x * y), $MachinePrecision], 1.28e+92]], $MachinePrecision], LessEqual[N[(x * y), $MachinePrecision], 2.4e+156]]], 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 -1.06 \cdot 10^{+102}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;x \cdot y \leq 7 \cdot 10^{-40}:\\
\;\;\;\;a \cdot b + c \cdot i\\

\mathbf{elif}\;x \cdot y \leq 6000000000000 \lor \neg \left(x \cdot y \leq 1.28 \cdot 10^{+92}\right) \land x \cdot y \leq 2.4 \cdot 10^{+156}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -1.06000000000000001e102 or 6e12 < (*.f64 x y) < 1.27999999999999996e92 or 2.4000000000000001e156 < (*.f64 x y)

    1. Initial program 89.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 0 86.1%

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

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

    if -1.06000000000000001e102 < (*.f64 x y) < 2.30000000000000005e-217 or 7.0000000000000003e-40 < (*.f64 x y) < 6e12 or 1.27999999999999996e92 < (*.f64 x y) < 2.4000000000000001e156

    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 c around 0 78.7%

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

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

    if 2.30000000000000005e-217 < (*.f64 x y) < 7.0000000000000003e-40

    1. Initial program 97.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 94.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1.06 \cdot 10^{+102}:\\ \;\;\;\;x \cdot y + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 2.3 \cdot 10^{-217}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 7 \cdot 10^{-40}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 6000000000000 \lor \neg \left(x \cdot y \leq 1.28 \cdot 10^{+92}\right) \land x \cdot y \leq 2.4 \cdot 10^{+156}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 61.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot b + c \cdot i\\ \mathbf{if}\;x \cdot y \leq -2.9 \cdot 10^{+190}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -1.7 \cdot 10^{+17}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq -1.12 \cdot 10^{-43}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 9.2 \cdot 10^{-40}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 11000000000000:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 4.6 \cdot 10^{+158}:\\ \;\;\;\;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) -2.9e+190)
     (* x y)
     (if (<= (* x y) -1.7e+17)
       t_1
       (if (<= (* x y) -1.12e-43)
         (* z t)
         (if (<= (* x y) 9.2e-40)
           t_1
           (if (<= (* x y) 11000000000000.0)
             (* z t)
             (if (<= (* x y) 4.6e+158) 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) <= -2.9e+190) {
		tmp = x * y;
	} else if ((x * y) <= -1.7e+17) {
		tmp = t_1;
	} else if ((x * y) <= -1.12e-43) {
		tmp = z * t;
	} else if ((x * y) <= 9.2e-40) {
		tmp = t_1;
	} else if ((x * y) <= 11000000000000.0) {
		tmp = z * t;
	} else if ((x * y) <= 4.6e+158) {
		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) <= (-2.9d+190)) then
        tmp = x * y
    else if ((x * y) <= (-1.7d+17)) then
        tmp = t_1
    else if ((x * y) <= (-1.12d-43)) then
        tmp = z * t
    else if ((x * y) <= 9.2d-40) then
        tmp = t_1
    else if ((x * y) <= 11000000000000.0d0) then
        tmp = z * t
    else if ((x * y) <= 4.6d+158) 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) <= -2.9e+190) {
		tmp = x * y;
	} else if ((x * y) <= -1.7e+17) {
		tmp = t_1;
	} else if ((x * y) <= -1.12e-43) {
		tmp = z * t;
	} else if ((x * y) <= 9.2e-40) {
		tmp = t_1;
	} else if ((x * y) <= 11000000000000.0) {
		tmp = z * t;
	} else if ((x * y) <= 4.6e+158) {
		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) <= -2.9e+190:
		tmp = x * y
	elif (x * y) <= -1.7e+17:
		tmp = t_1
	elif (x * y) <= -1.12e-43:
		tmp = z * t
	elif (x * y) <= 9.2e-40:
		tmp = t_1
	elif (x * y) <= 11000000000000.0:
		tmp = z * t
	elif (x * y) <= 4.6e+158:
		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) <= -2.9e+190)
		tmp = Float64(x * y);
	elseif (Float64(x * y) <= -1.7e+17)
		tmp = t_1;
	elseif (Float64(x * y) <= -1.12e-43)
		tmp = Float64(z * t);
	elseif (Float64(x * y) <= 9.2e-40)
		tmp = t_1;
	elseif (Float64(x * y) <= 11000000000000.0)
		tmp = Float64(z * t);
	elseif (Float64(x * y) <= 4.6e+158)
		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) <= -2.9e+190)
		tmp = x * y;
	elseif ((x * y) <= -1.7e+17)
		tmp = t_1;
	elseif ((x * y) <= -1.12e-43)
		tmp = z * t;
	elseif ((x * y) <= 9.2e-40)
		tmp = t_1;
	elseif ((x * y) <= 11000000000000.0)
		tmp = z * t;
	elseif ((x * y) <= 4.6e+158)
		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], -2.9e+190], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -1.7e+17], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -1.12e-43], N[(z * t), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 9.2e-40], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 11000000000000.0], N[(z * t), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 4.6e+158], 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 -2.9 \cdot 10^{+190}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;x \cdot y \leq -1.7 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\

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

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

\mathbf{elif}\;x \cdot y \leq 11000000000000:\\
\;\;\;\;z \cdot t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -2.89999999999999989e190 or 4.59999999999999971e158 < (*.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 79.3%

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

    if -2.89999999999999989e190 < (*.f64 x y) < -1.7e17 or -1.12e-43 < (*.f64 x y) < 9.2e-40 or 1.1e13 < (*.f64 x y) < 4.59999999999999971e158

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

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

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

    if -1.7e17 < (*.f64 x y) < -1.12e-43 or 9.2e-40 < (*.f64 x y) < 1.1e13

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2.9 \cdot 10^{+190}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -1.7 \cdot 10^{+17}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq -1.12 \cdot 10^{-43}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 9.2 \cdot 10^{-40}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 11000000000000:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 4.6 \cdot 10^{+158}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 66.7% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot b + z \cdot t\\ t_2 := a \cdot b + c \cdot i\\ t_3 := x \cdot y + a \cdot b\\ \mathbf{if}\;x \cdot y \leq -2.8 \cdot 10^{+66}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;x \cdot y \leq 3.6 \cdot 10^{-216}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 6.4 \cdot 10^{-40}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \cdot y \leq 5500000000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+81}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* a b) (* z t)))
        (t_2 (+ (* a b) (* c i)))
        (t_3 (+ (* x y) (* a b))))
   (if (<= (* x y) -2.8e+66)
     t_3
     (if (<= (* x y) 3.6e-216)
       t_1
       (if (<= (* x y) 6.4e-40)
         t_2
         (if (<= (* x y) 5500000000000.0)
           t_1
           (if (<= (* x y) 2e+81) t_2 t_3)))))))
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 = (a * b) + (c * i);
	double t_3 = (x * y) + (a * b);
	double tmp;
	if ((x * y) <= -2.8e+66) {
		tmp = t_3;
	} else if ((x * y) <= 3.6e-216) {
		tmp = t_1;
	} else if ((x * y) <= 6.4e-40) {
		tmp = t_2;
	} else if ((x * y) <= 5500000000000.0) {
		tmp = t_1;
	} else if ((x * y) <= 2e+81) {
		tmp = t_2;
	} else {
		tmp = t_3;
	}
	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) :: t_3
    real(8) :: tmp
    t_1 = (a * b) + (z * t)
    t_2 = (a * b) + (c * i)
    t_3 = (x * y) + (a * b)
    if ((x * y) <= (-2.8d+66)) then
        tmp = t_3
    else if ((x * y) <= 3.6d-216) then
        tmp = t_1
    else if ((x * y) <= 6.4d-40) then
        tmp = t_2
    else if ((x * y) <= 5500000000000.0d0) then
        tmp = t_1
    else if ((x * y) <= 2d+81) then
        tmp = t_2
    else
        tmp = t_3
    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 = (a * b) + (c * i);
	double t_3 = (x * y) + (a * b);
	double tmp;
	if ((x * y) <= -2.8e+66) {
		tmp = t_3;
	} else if ((x * y) <= 3.6e-216) {
		tmp = t_1;
	} else if ((x * y) <= 6.4e-40) {
		tmp = t_2;
	} else if ((x * y) <= 5500000000000.0) {
		tmp = t_1;
	} else if ((x * y) <= 2e+81) {
		tmp = t_2;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (a * b) + (z * t)
	t_2 = (a * b) + (c * i)
	t_3 = (x * y) + (a * b)
	tmp = 0
	if (x * y) <= -2.8e+66:
		tmp = t_3
	elif (x * y) <= 3.6e-216:
		tmp = t_1
	elif (x * y) <= 6.4e-40:
		tmp = t_2
	elif (x * y) <= 5500000000000.0:
		tmp = t_1
	elif (x * y) <= 2e+81:
		tmp = t_2
	else:
		tmp = t_3
	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(a * b) + Float64(c * i))
	t_3 = Float64(Float64(x * y) + Float64(a * b))
	tmp = 0.0
	if (Float64(x * y) <= -2.8e+66)
		tmp = t_3;
	elseif (Float64(x * y) <= 3.6e-216)
		tmp = t_1;
	elseif (Float64(x * y) <= 6.4e-40)
		tmp = t_2;
	elseif (Float64(x * y) <= 5500000000000.0)
		tmp = t_1;
	elseif (Float64(x * y) <= 2e+81)
		tmp = t_2;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (a * b) + (z * t);
	t_2 = (a * b) + (c * i);
	t_3 = (x * y) + (a * b);
	tmp = 0.0;
	if ((x * y) <= -2.8e+66)
		tmp = t_3;
	elseif ((x * y) <= 3.6e-216)
		tmp = t_1;
	elseif ((x * y) <= 6.4e-40)
		tmp = t_2;
	elseif ((x * y) <= 5500000000000.0)
		tmp = t_1;
	elseif ((x * y) <= 2e+81)
		tmp = t_2;
	else
		tmp = t_3;
	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[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2.8e+66], t$95$3, If[LessEqual[N[(x * y), $MachinePrecision], 3.6e-216], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 6.4e-40], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 5500000000000.0], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e+81], t$95$2, t$95$3]]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;x \cdot y \leq 6.4 \cdot 10^{-40}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \cdot y \leq 5500000000000:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+81}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -2.8000000000000001e66 or 1.99999999999999984e81 < (*.f64 x y)

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

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

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

    if -2.8000000000000001e66 < (*.f64 x y) < 3.5999999999999999e-216 or 6.40000000000000004e-40 < (*.f64 x y) < 5.5e12

    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 c around 0 77.2%

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

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

    if 3.5999999999999999e-216 < (*.f64 x y) < 6.40000000000000004e-40 or 5.5e12 < (*.f64 x y) < 1.99999999999999984e81

    1. Initial program 95.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 89.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2.8 \cdot 10^{+66}:\\ \;\;\;\;x \cdot y + a \cdot b\\ \mathbf{elif}\;x \cdot y \leq 3.6 \cdot 10^{-216}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 6.4 \cdot 10^{-40}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 5500000000000:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+81}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 42.0% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.25 \cdot 10^{+127}:\\
\;\;\;\;c \cdot i\\

\mathbf{elif}\;c \cdot i \leq -2.05 \cdot 10^{+63}:\\
\;\;\;\;a \cdot b\\

\mathbf{elif}\;c \cdot i \leq -2.05 \cdot 10^{-8}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;c \cdot i \leq -4.7 \cdot 10^{-151}:\\
\;\;\;\;a \cdot b\\

\mathbf{elif}\;c \cdot i \leq 5 \cdot 10^{+152}:\\
\;\;\;\;z \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 c i) < -1.2500000000000001e127 or 5e152 < (*.f64 c i)

    1. Initial program 84.2%

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

      \[\leadsto \color{blue}{c \cdot i} \]

    if -1.2500000000000001e127 < (*.f64 c i) < -2.04999999999999996e63 or -2.05000000000000016e-8 < (*.f64 c i) < -4.70000000000000029e-151

    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 a around inf 65.8%

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

    if -2.04999999999999996e63 < (*.f64 c i) < -2.05000000000000016e-8

    1. Initial program 85.7%

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

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

    if -4.70000000000000029e-151 < (*.f64 c i) < 5e152

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1.25 \cdot 10^{+127}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -2.05 \cdot 10^{+63}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq -2.05 \cdot 10^{-8}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \cdot i \leq -4.7 \cdot 10^{-151}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq 5 \cdot 10^{+152}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 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}:\\ \;\;\;\;x \cdot y + c \cdot i\\ \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 (+ (* x y) (* c i)))))
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 = (x * y) + (c * i);
	}
	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 = (x * y) + (c * i);
	}
	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 = (x * y) + (c * i)
	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(Float64(x * y) + Float64(c * i));
	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 = (x * y) + (c * i);
	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[(N[(x * y), $MachinePrecision] + N[(c * i), $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}:\\
\;\;\;\;x \cdot y + c \cdot i\\


\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 0 17.6%

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

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

    \[\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}:\\ \;\;\;\;x \cdot y + c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 87.7% accurate, 0.5× speedup?

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

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

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

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

\mathbf{else}:\\
\;\;\;\;x \cdot y + c \cdot i\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -4.0000000000000002e142 or 1.1999999999999999e77 < (*.f64 x y) < 3.3999999999999999e217

    1. Initial program 95.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 87.6%

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

    if -4.0000000000000002e142 < (*.f64 x y) < 1.1999999999999999e77

    1. Initial program 94.7%

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

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

    if 3.3999999999999999e217 < (*.f64 x y)

    1. Initial program 75.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 0 80.0%

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

      \[\leadsto \color{blue}{c \cdot i + x \cdot y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification89.7%

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

Alternative 8: 84.7% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.12 \cdot 10^{+195}:\\
\;\;\;\;c \cdot i\\

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

\mathbf{else}:\\
\;\;\;\;x \cdot y + c \cdot i\\


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

    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 c around inf 85.0%

      \[\leadsto \color{blue}{c \cdot i} \]

    if -1.12000000000000004e195 < (*.f64 c i) < 5.1999999999999997e173

    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 c around 0 88.7%

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

    if 5.1999999999999997e173 < (*.f64 c i)

    1. Initial program 74.2%

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

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

      \[\leadsto \color{blue}{c \cdot i + x \cdot y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification87.7%

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

Alternative 9: 86.9% accurate, 0.6× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;x \cdot y + c \cdot i\\


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

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

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

    if -3.6e52 < (*.f64 c i) < 5.7999999999999999e174

    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 0 91.2%

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

    if 5.7999999999999999e174 < (*.f64 c i)

    1. Initial program 74.2%

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

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

      \[\leadsto \color{blue}{c \cdot i + x \cdot y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification88.7%

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

Alternative 10: 41.9% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -3.9 \cdot 10^{+126}:\\
\;\;\;\;c \cdot i\\

\mathbf{elif}\;c \cdot i \leq -1.65 \cdot 10^{-147}:\\
\;\;\;\;a \cdot b\\

\mathbf{elif}\;c \cdot i \leq 10^{+151}:\\
\;\;\;\;z \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 c i) < -3.89999999999999993e126 or 1.00000000000000002e151 < (*.f64 c i)

    1. Initial program 84.2%

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

      \[\leadsto \color{blue}{c \cdot i} \]

    if -3.89999999999999993e126 < (*.f64 c i) < -1.64999999999999994e-147

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

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

    if -1.64999999999999994e-147 < (*.f64 c i) < 1.00000000000000002e151

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -3.9 \cdot 10^{+126}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -1.65 \cdot 10^{-147}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq 10^{+151}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 64.2% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;c \cdot i \leq 3 \cdot 10^{+177}:\\
\;\;\;\;a \cdot b + z \cdot t\\

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


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

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

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

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

    if -1.75000000000000009e53 < (*.f64 c i) < 3e177

    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 0 91.2%

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

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

    if 3e177 < (*.f64 c i)

    1. Initial program 74.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1.75 \cdot 10^{+53}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;c \cdot i \leq 3 \cdot 10^{+177}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 42.4% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -7 \cdot 10^{+128} \lor \neg \left(c \cdot i \leq 10^{+173}\right):\\
\;\;\;\;c \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c i) < -6.99999999999999937e128 or 1e173 < (*.f64 c i)

    1. Initial program 83.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 68.5%

      \[\leadsto \color{blue}{c \cdot i} \]

    if -6.99999999999999937e128 < (*.f64 c i) < 1e173

    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 a around inf 34.6%

      \[\leadsto \color{blue}{a \cdot b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification44.3%

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

Alternative 13: 27.6% 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 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 a around inf 27.4%

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

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

Reproduce

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