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

Percentage Accurate: 95.4% → 97.4%
Time: 12.9s
Alternatives: 17
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 17 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.4% 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.4% accurate, 0.1× 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}:\\ \;\;\;\;\mathsf{fma}\left(c, i, x \cdot y\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* c i) (+ (* a b) (+ (* x y) (* z t))))))
   (if (<= t_1 INFINITY) t_1 (fma c i (* x y)))))
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 = fma(c, i, (x * y));
	}
	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 = fma(c, i, Float64(x * y));
	end
	return 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[(c * i + N[(x * y), $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}:\\
\;\;\;\;\mathsf{fma}\left(c, i, x \cdot y\right)\\


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

    1. Initial program 100.0%

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

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

    1. Initial program 0.0%

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

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

      \[\leadsto \color{blue}{c \cdot i + x \cdot y} \]
    5. Step-by-step derivation
      1. fma-define66.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(c, i, x \cdot y\right)} \]
    6. Simplified66.8%

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

    \[\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}:\\ \;\;\;\;\mathsf{fma}\left(c, i, x \cdot y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 97.7% accurate, 0.0× speedup?

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

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

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

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

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

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

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

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

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

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

Alternative 3: 97.7% 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 97.6%

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

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

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

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

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

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

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

    \[\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 4: 97.2% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(c, i, \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. fma-undefine98.4%

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

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

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

Alternative 5: 96.5% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

    \[\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. Step-by-step derivation
    1. fma-undefine98.4%

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

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

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

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

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

Alternative 6: 42.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -2.5 \cdot 10^{+42}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -2.1 \cdot 10^{-145}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -4 \cdot 10^{-177}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 0:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.5 \cdot 10^{-60}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 8.2 \cdot 10^{+117}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= (* a b) -2.5e+42)
   (* a b)
   (if (<= (* a b) -2.1e-145)
     (* c i)
     (if (<= (* a b) -4e-177)
       (* x y)
       (if (<= (* a b) 0.0)
         (* z t)
         (if (<= (* a b) 1.5e-60)
           (* x y)
           (if (<= (* a b) 8.2e+117) (* z t) (* a b))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((a * b) <= -2.5e+42) {
		tmp = a * b;
	} else if ((a * b) <= -2.1e-145) {
		tmp = c * i;
	} else if ((a * b) <= -4e-177) {
		tmp = x * y;
	} else if ((a * b) <= 0.0) {
		tmp = z * t;
	} else if ((a * b) <= 1.5e-60) {
		tmp = x * y;
	} else if ((a * b) <= 8.2e+117) {
		tmp = z * t;
	} else {
		tmp = a * b;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: tmp
    if ((a * b) <= (-2.5d+42)) then
        tmp = a * b
    else if ((a * b) <= (-2.1d-145)) then
        tmp = c * i
    else if ((a * b) <= (-4d-177)) then
        tmp = x * y
    else if ((a * b) <= 0.0d0) then
        tmp = z * t
    else if ((a * b) <= 1.5d-60) then
        tmp = x * y
    else if ((a * b) <= 8.2d+117) then
        tmp = z * t
    else
        tmp = a * b
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((a * b) <= -2.5e+42) {
		tmp = a * b;
	} else if ((a * b) <= -2.1e-145) {
		tmp = c * i;
	} else if ((a * b) <= -4e-177) {
		tmp = x * y;
	} else if ((a * b) <= 0.0) {
		tmp = z * t;
	} else if ((a * b) <= 1.5e-60) {
		tmp = x * y;
	} else if ((a * b) <= 8.2e+117) {
		tmp = z * t;
	} else {
		tmp = a * b;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (a * b) <= -2.5e+42:
		tmp = a * b
	elif (a * b) <= -2.1e-145:
		tmp = c * i
	elif (a * b) <= -4e-177:
		tmp = x * y
	elif (a * b) <= 0.0:
		tmp = z * t
	elif (a * b) <= 1.5e-60:
		tmp = x * y
	elif (a * b) <= 8.2e+117:
		tmp = z * t
	else:
		tmp = a * b
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (Float64(a * b) <= -2.5e+42)
		tmp = Float64(a * b);
	elseif (Float64(a * b) <= -2.1e-145)
		tmp = Float64(c * i);
	elseif (Float64(a * b) <= -4e-177)
		tmp = Float64(x * y);
	elseif (Float64(a * b) <= 0.0)
		tmp = Float64(z * t);
	elseif (Float64(a * b) <= 1.5e-60)
		tmp = Float64(x * y);
	elseif (Float64(a * b) <= 8.2e+117)
		tmp = Float64(z * t);
	else
		tmp = Float64(a * b);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if ((a * b) <= -2.5e+42)
		tmp = a * b;
	elseif ((a * b) <= -2.1e-145)
		tmp = c * i;
	elseif ((a * b) <= -4e-177)
		tmp = x * y;
	elseif ((a * b) <= 0.0)
		tmp = z * t;
	elseif ((a * b) <= 1.5e-60)
		tmp = x * y;
	elseif ((a * b) <= 8.2e+117)
		tmp = z * t;
	else
		tmp = a * b;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -2.5e+42], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -2.1e-145], N[(c * i), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -4e-177], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 0.0], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.5e-60], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 8.2e+117], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]]]
\begin{array}{l}

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

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

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

\mathbf{elif}\;a \cdot b \leq 0:\\
\;\;\;\;z \cdot t\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 a b) < -2.50000000000000003e42 or 8.1999999999999999e117 < (*.f64 a b)

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

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

    if -2.50000000000000003e42 < (*.f64 a b) < -2.09999999999999991e-145

    1. Initial program 100.0%

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

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

    if -2.09999999999999991e-145 < (*.f64 a b) < -3.99999999999999981e-177 or 0.0 < (*.f64 a b) < 1.50000000000000009e-60

    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 x around inf 65.0%

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

    if -3.99999999999999981e-177 < (*.f64 a b) < 0.0 or 1.50000000000000009e-60 < (*.f64 a b) < 8.1999999999999999e117

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -2.5 \cdot 10^{+42}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -2.1 \cdot 10^{-145}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -4 \cdot 10^{-177}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 0:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.5 \cdot 10^{-60}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 8.2 \cdot 10^{+117}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 62.1% accurate, 0.4× speedup?

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -1.55999999999999992e112 or 3.4000000000000001e130 < (*.f64 x y)

    1. Initial program 96.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 72.2%

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

    if -1.55999999999999992e112 < (*.f64 x y) < 2.1999999999999999e-81 or 1.60000000000000004e-45 < (*.f64 x y) < 3.4000000000000001e130

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

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

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

    if 2.1999999999999999e-81 < (*.f64 x y) < 1.60000000000000004e-45

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1.56 \cdot 10^{+112}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq 2.2 \cdot 10^{-81}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 1.6 \cdot 10^{-45}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 3.4 \cdot 10^{+130}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 97.0% 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}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \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 (+ (* a b) (* x y)))))
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 = (a * b) + (x * y);
	}
	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 = (a * b) + (x * y);
	}
	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 = (a * b) + (x * y)
	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(a * b) + Float64(x * y));
	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 = (a * b) + (x * y);
	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[(a * b), $MachinePrecision] + N[(x * y), $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}:\\
\;\;\;\;a \cdot b + x \cdot y\\


\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 33.3%

      \[\leadsto \color{blue}{\left(a \cdot b + x \cdot y\right)} + c \cdot i \]
    4. Step-by-step derivation
      1. +-commutative33.3%

        \[\leadsto \color{blue}{\left(x \cdot y + a \cdot b\right)} + c \cdot i \]
      2. *-commutative33.3%

        \[\leadsto \left(\color{blue}{y \cdot x} + a \cdot b\right) + c \cdot i \]
      3. fma-define33.3%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, x, a \cdot b\right)} + c \cdot i \]
    6. Taylor expanded in c around 0 66.7%

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

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

Alternative 9: 83.9% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -3.9 \cdot 10^{+248} \lor \neg \left(c \cdot i \leq 9 \cdot 10^{+200}\right):\\
\;\;\;\;x \cdot y + c \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c i) < -3.8999999999999999e248 or 8.99999999999999939e200 < (*.f64 c i)

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

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

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

    if -3.8999999999999999e248 < (*.f64 c i) < 8.99999999999999939e200

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

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

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

Alternative 10: 85.6% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \cdot i \leq -3.8 \cdot 10^{+121}:\\ \;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\ \mathbf{elif}\;c \cdot i \leq 2.7 \cdot 10^{+195}:\\ \;\;\;\;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.8e+121)
   (+ (* c i) (+ (* a b) (* z t)))
   (if (<= (* c i) 2.7e+195)
     (+ (* 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.8e+121) {
		tmp = (c * i) + ((a * b) + (z * t));
	} else if ((c * i) <= 2.7e+195) {
		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.8d+121)) then
        tmp = (c * i) + ((a * b) + (z * t))
    else if ((c * i) <= 2.7d+195) 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.8e+121) {
		tmp = (c * i) + ((a * b) + (z * t));
	} else if ((c * i) <= 2.7e+195) {
		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.8e+121:
		tmp = (c * i) + ((a * b) + (z * t))
	elif (c * i) <= 2.7e+195:
		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.8e+121)
		tmp = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(z * t)));
	elseif (Float64(c * i) <= 2.7e+195)
		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.8e+121)
		tmp = (c * i) + ((a * b) + (z * t));
	elseif ((c * i) <= 2.7e+195)
		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.8e+121], N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 2.7e+195], 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.8 \cdot 10^{+121}:\\
\;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\

\mathbf{elif}\;c \cdot i \leq 2.7 \cdot 10^{+195}:\\
\;\;\;\;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.8e121

    1. Initial program 94.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 88.8%

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

    if -3.8e121 < (*.f64 c i) < 2.7000000000000002e195

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

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

    if 2.7000000000000002e195 < (*.f64 c i)

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -3.8 \cdot 10^{+121}:\\ \;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\ \mathbf{elif}\;c \cdot i \leq 2.7 \cdot 10^{+195}:\\ \;\;\;\;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 11: 86.6% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -5.4 \cdot 10^{+121}:\\
\;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\

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

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


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

    1. Initial program 94.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 88.8%

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

    if -5.4000000000000004e121 < (*.f64 c i) < 1.50000000000000009e153

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

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

    if 1.50000000000000009e153 < (*.f64 c i)

    1. Initial program 92.3%

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

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

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

Alternative 12: 60.6% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -9 \cdot 10^{+102} \lor \neg \left(x \cdot y \leq 2.15 \cdot 10^{+39}\right):\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -9.00000000000000042e102 or 2.15e39 < (*.f64 x y)

    1. Initial program 96.8%

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

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

    if -9.00000000000000042e102 < (*.f64 x y) < 2.15e39

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

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

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

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

Alternative 13: 65.3% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -7.5 \cdot 10^{+89} \lor \neg \left(x \cdot y \leq 6.4 \cdot 10^{+28}\right):\\
\;\;\;\;a \cdot b + x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -7.49999999999999947e89 or 6.4000000000000001e28 < (*.f64 x y)

    1. Initial program 96.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 91.0%

      \[\leadsto \color{blue}{\left(a \cdot b + x \cdot y\right)} + c \cdot i \]
    4. Step-by-step derivation
      1. +-commutative91.0%

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, x, a \cdot b\right)} + c \cdot i \]
    6. Taylor expanded in c around 0 76.3%

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

    if -7.49999999999999947e89 < (*.f64 x y) < 6.4000000000000001e28

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

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

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

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

Alternative 14: 65.6% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5.5 \cdot 10^{+102} \lor \neg \left(x \cdot y \leq 1.65 \cdot 10^{+28}\right):\\
\;\;\;\;x \cdot y + c \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -5.49999999999999981e102 or 1.65e28 < (*.f64 x y)

    1. Initial program 96.8%

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

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

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

    if -5.49999999999999981e102 < (*.f64 x y) < 1.65e28

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

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

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

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

Alternative 15: 40.8% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -3.9 \cdot 10^{+248} \lor \neg \left(c \cdot i \leq 2.1 \cdot 10^{+191}\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) < -3.8999999999999999e248 or 2.1000000000000001e191 < (*.f64 c i)

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

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

    if -3.8999999999999999e248 < (*.f64 c i) < 2.1000000000000001e191

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

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

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

Alternative 16: 42.5% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -7.5 \cdot 10^{+33} \lor \neg \left(a \cdot b \leq 4.6 \cdot 10^{+119}\right):\\
\;\;\;\;a \cdot b\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -7.50000000000000046e33 or 4.6000000000000001e119 < (*.f64 a b)

    1. Initial program 96.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 63.0%

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

    if -7.50000000000000046e33 < (*.f64 a b) < 4.6000000000000001e119

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

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

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

Alternative 17: 27.4% 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 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 a around inf 28.4%

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

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

Reproduce

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