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

Percentage Accurate: 95.9% → 97.8%
Time: 14.0s
Alternatives: 16
Speedup: 0.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 16 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 95.9% 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.8% accurate, 0.0× speedup?

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(c, i, \color{blue}{\mathsf{fma}\left(a, b, x \cdot y + z \cdot t\right)}\right) \]
    5. fma-def98.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 2: 97.5% 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 96.1%

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

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

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

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

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

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

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

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

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

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

Alternative 3: 97.1% accurate, 0.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;t_1\\


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

    1. Initial program 100.0%

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

Alternative 4: 97.4% accurate, 0.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;t_1\\


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

    1. Initial program 98.8%

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

Alternative 5: 42.9% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;x \cdot y \leq -1.05 \cdot 10^{+73}:\\
\;\;\;\;z \cdot t\\

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

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

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

\mathbf{elif}\;x \cdot y \leq 3.4 \cdot 10^{+95}:\\
\;\;\;\;a \cdot b\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 x y) < -1.35000000000000001e126 or 3.40000000000000022e95 < (*.f64 x y)

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

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

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

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

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

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

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

    if -1.35000000000000001e126 < (*.f64 x y) < -1.0500000000000001e73 or -4.3999999999999999e-134 < (*.f64 x y) < -1.11999999999999998e-299

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

      \[\leadsto \color{blue}{t \cdot z} + c \cdot i \]
    4. Step-by-step derivation
      1. +-commutative72.3%

        \[\leadsto \color{blue}{c \cdot i + t \cdot z} \]
      2. *-commutative72.3%

        \[\leadsto \color{blue}{i \cdot c} + t \cdot z \]
      3. fma-def72.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, t \cdot z\right)} \]
      4. *-commutative72.3%

        \[\leadsto \mathsf{fma}\left(i, c, \color{blue}{z \cdot t}\right) \]
    5. Applied egg-rr72.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, z \cdot t\right)} \]
    6. Taylor expanded in i around 0 49.4%

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

    if -1.0500000000000001e73 < (*.f64 x y) < -4.3999999999999999e-134 or 8.5999999999999996e-164 < (*.f64 x y) < 3.40000000000000022e95

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

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

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

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

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

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

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

    if -1.11999999999999998e-299 < (*.f64 x y) < 8.5999999999999996e-164

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1.35 \cdot 10^{+126}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -1.05 \cdot 10^{+73}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;x \cdot y \leq -4.4 \cdot 10^{-134}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;x \cdot y \leq -1.12 \cdot 10^{-299}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 8.6 \cdot 10^{-164}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 3.4 \cdot 10^{+95}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 43.2% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -8 \cdot 10^{+112}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -1250:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq -6 \cdot 10^{-66}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -3.4 \cdot 10^{-181}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 9.2 \cdot 10^{+46}:\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= (* a b) -8e+112)
   (* a b)
   (if (<= (* a b) -1250.0)
     (* z t)
     (if (<= (* a b) -6e-66)
       (* c i)
       (if (<= (* a b) -3.4e-181)
         (* z t)
         (if (<= (* a b) 9.2e+46) (* c i) (* a b)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((a * b) <= -8e+112) {
		tmp = a * b;
	} else if ((a * b) <= -1250.0) {
		tmp = z * t;
	} else if ((a * b) <= -6e-66) {
		tmp = c * i;
	} else if ((a * b) <= -3.4e-181) {
		tmp = z * t;
	} else if ((a * b) <= 9.2e+46) {
		tmp = c * i;
	} else {
		tmp = a * b;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: tmp
    if ((a * b) <= (-8d+112)) then
        tmp = a * b
    else if ((a * b) <= (-1250.0d0)) then
        tmp = z * t
    else if ((a * b) <= (-6d-66)) then
        tmp = c * i
    else if ((a * b) <= (-3.4d-181)) then
        tmp = z * t
    else if ((a * b) <= 9.2d+46) then
        tmp = c * i
    else
        tmp = a * b
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((a * b) <= -8e+112) {
		tmp = a * b;
	} else if ((a * b) <= -1250.0) {
		tmp = z * t;
	} else if ((a * b) <= -6e-66) {
		tmp = c * i;
	} else if ((a * b) <= -3.4e-181) {
		tmp = z * t;
	} else if ((a * b) <= 9.2e+46) {
		tmp = c * i;
	} else {
		tmp = a * b;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (a * b) <= -8e+112:
		tmp = a * b
	elif (a * b) <= -1250.0:
		tmp = z * t
	elif (a * b) <= -6e-66:
		tmp = c * i
	elif (a * b) <= -3.4e-181:
		tmp = z * t
	elif (a * b) <= 9.2e+46:
		tmp = c * i
	else:
		tmp = a * b
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (Float64(a * b) <= -8e+112)
		tmp = Float64(a * b);
	elseif (Float64(a * b) <= -1250.0)
		tmp = Float64(z * t);
	elseif (Float64(a * b) <= -6e-66)
		tmp = Float64(c * i);
	elseif (Float64(a * b) <= -3.4e-181)
		tmp = Float64(z * t);
	elseif (Float64(a * b) <= 9.2e+46)
		tmp = Float64(c * i);
	else
		tmp = Float64(a * b);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if ((a * b) <= -8e+112)
		tmp = a * b;
	elseif ((a * b) <= -1250.0)
		tmp = z * t;
	elseif ((a * b) <= -6e-66)
		tmp = c * i;
	elseif ((a * b) <= -3.4e-181)
		tmp = z * t;
	elseif ((a * b) <= 9.2e+46)
		tmp = c * i;
	else
		tmp = a * b;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -8e+112], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -1250.0], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -6e-66], N[(c * i), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -3.4e-181], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 9.2e+46], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]]
\begin{array}{l}

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -7.9999999999999994e112 or 9.2000000000000002e46 < (*.f64 a b)

    1. Initial program 90.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 80.2%

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

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

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

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

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

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

    if -7.9999999999999994e112 < (*.f64 a b) < -1250 or -6.0000000000000004e-66 < (*.f64 a b) < -3.4e-181

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

      \[\leadsto \color{blue}{t \cdot z} + c \cdot i \]
    4. Step-by-step derivation
      1. +-commutative47.2%

        \[\leadsto \color{blue}{c \cdot i + t \cdot z} \]
      2. *-commutative47.2%

        \[\leadsto \color{blue}{i \cdot c} + t \cdot z \]
      3. fma-def47.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, t \cdot z\right)} \]
      4. *-commutative47.2%

        \[\leadsto \mathsf{fma}\left(i, c, \color{blue}{z \cdot t}\right) \]
    5. Applied egg-rr47.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, z \cdot t\right)} \]
    6. Taylor expanded in i around 0 37.1%

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

    if -1250 < (*.f64 a b) < -6.0000000000000004e-66 or -3.4e-181 < (*.f64 a b) < 9.2000000000000002e46

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -8 \cdot 10^{+112}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -1250:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq -6 \cdot 10^{-66}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -3.4 \cdot 10^{-181}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 9.2 \cdot 10^{+46}:\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 66.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot b + x \cdot y\\ \mathbf{if}\;c \cdot i \leq -1.6 \cdot 10^{+27}:\\ \;\;\;\;z \cdot t + c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -2.6 \cdot 10^{-195}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq 1.05 \cdot 10^{-148}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{elif}\;c \cdot i \leq 1.6 \cdot 10^{+160}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + 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))))
   (if (<= (* c i) -1.6e+27)
     (+ (* z t) (* c i))
     (if (<= (* c i) -2.6e-195)
       t_1
       (if (<= (* c i) 1.05e-148)
         (+ (* x y) (* z t))
         (if (<= (* c i) 1.6e+160) t_1 (+ (* a b) (* 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);
	double tmp;
	if ((c * i) <= -1.6e+27) {
		tmp = (z * t) + (c * i);
	} else if ((c * i) <= -2.6e-195) {
		tmp = t_1;
	} else if ((c * i) <= 1.05e-148) {
		tmp = (x * y) + (z * t);
	} else if ((c * i) <= 1.6e+160) {
		tmp = t_1;
	} else {
		tmp = (a * b) + (c * i);
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (a * b) + (x * y)
    if ((c * i) <= (-1.6d+27)) then
        tmp = (z * t) + (c * i)
    else if ((c * i) <= (-2.6d-195)) then
        tmp = t_1
    else if ((c * i) <= 1.05d-148) then
        tmp = (x * y) + (z * t)
    else if ((c * i) <= 1.6d+160) then
        tmp = t_1
    else
        tmp = (a * b) + (c * i)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (a * b) + (x * y);
	double tmp;
	if ((c * i) <= -1.6e+27) {
		tmp = (z * t) + (c * i);
	} else if ((c * i) <= -2.6e-195) {
		tmp = t_1;
	} else if ((c * i) <= 1.05e-148) {
		tmp = (x * y) + (z * t);
	} else if ((c * i) <= 1.6e+160) {
		tmp = t_1;
	} else {
		tmp = (a * b) + (c * i);
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (a * b) + (x * y)
	tmp = 0
	if (c * i) <= -1.6e+27:
		tmp = (z * t) + (c * i)
	elif (c * i) <= -2.6e-195:
		tmp = t_1
	elif (c * i) <= 1.05e-148:
		tmp = (x * y) + (z * t)
	elif (c * i) <= 1.6e+160:
		tmp = t_1
	else:
		tmp = (a * b) + (c * i)
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(a * b) + Float64(x * y))
	tmp = 0.0
	if (Float64(c * i) <= -1.6e+27)
		tmp = Float64(Float64(z * t) + Float64(c * i));
	elseif (Float64(c * i) <= -2.6e-195)
		tmp = t_1;
	elseif (Float64(c * i) <= 1.05e-148)
		tmp = Float64(Float64(x * y) + Float64(z * t));
	elseif (Float64(c * i) <= 1.6e+160)
		tmp = t_1;
	else
		tmp = Float64(Float64(a * b) + Float64(c * i));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (a * b) + (x * y);
	tmp = 0.0;
	if ((c * i) <= -1.6e+27)
		tmp = (z * t) + (c * i);
	elseif ((c * i) <= -2.6e-195)
		tmp = t_1;
	elseif ((c * i) <= 1.05e-148)
		tmp = (x * y) + (z * t);
	elseif ((c * i) <= 1.6e+160)
		tmp = t_1;
	else
		tmp = (a * b) + (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[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -1.6e+27], N[(N[(z * t), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -2.6e-195], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], 1.05e-148], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 1.6e+160], t$95$1, N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;c \cdot i \leq -2.6 \cdot 10^{-195}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;c \cdot i \leq 1.6 \cdot 10^{+160}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 c i) < -1.60000000000000008e27

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

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

    if -1.60000000000000008e27 < (*.f64 c i) < -2.6000000000000002e-195 or 1.05e-148 < (*.f64 c i) < 1.5999999999999999e160

    1. Initial program 97.8%

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

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

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

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

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

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

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

    if -2.6000000000000002e-195 < (*.f64 c i) < 1.05e-148

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

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

        \[\leadsto \color{blue}{\left(x \cdot y + t \cdot z\right)} + c \cdot i \]
      2. *-commutative79.1%

        \[\leadsto \left(\color{blue}{y \cdot x} + t \cdot z\right) + c \cdot i \]
      3. fma-def79.1%

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

        \[\leadsto \mathsf{fma}\left(y, x, \color{blue}{z \cdot t}\right) + c \cdot i \]
    5. Applied egg-rr79.1%

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

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

    if 1.5999999999999999e160 < (*.f64 c i)

    1. Initial program 89.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1.6 \cdot 10^{+27}:\\ \;\;\;\;z \cdot t + c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -2.6 \cdot 10^{-195}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;c \cdot i \leq 1.05 \cdot 10^{-148}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{elif}\;c \cdot i \leq 1.6 \cdot 10^{+160}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 97.1% accurate, 0.4× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;t_1\\


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

    1. Initial program 100.0%

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

Alternative 9: 85.1% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+129}:\\
\;\;\;\;a \cdot b + x \cdot y\\

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

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


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

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

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

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

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

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

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

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

    if -2e129 < (*.f64 x y) < 4.4000000000000001e101

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

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

    if 4.4000000000000001e101 < (*.f64 x y)

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

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

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

        \[\leadsto \left(\color{blue}{y \cdot x} + t \cdot z\right) + c \cdot i \]
      3. fma-def89.3%

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

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

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

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

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

Alternative 10: 86.4% accurate, 0.6× speedup?

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

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

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

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


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

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

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

    if -1.60000000000000006e122 < (*.f64 x y) < 2.15e101

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

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

    if 2.15e101 < (*.f64 x y)

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

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

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

        \[\leadsto \left(\color{blue}{y \cdot x} + t \cdot z\right) + c \cdot i \]
      3. fma-def89.3%

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

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

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

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

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

Alternative 11: 88.4% accurate, 0.6× speedup?

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

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

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

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


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

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

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

    if -5.5000000000000002e123 < (*.f64 x y) < 6.39999999999999979e91

    1. Initial program 97.0%

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

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

    if 6.39999999999999979e91 < (*.f64 x y)

    1. Initial program 91.2%

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

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

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

Alternative 12: 63.3% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+182} \lor \neg \left(x \cdot y \leq 3.8 \cdot 10^{+139}\right):\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -4.0000000000000003e182 or 3.79999999999999999e139 < (*.f64 x y)

    1. Initial program 93.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 86.4%

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

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

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

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

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

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

    if -4.0000000000000003e182 < (*.f64 x y) < 3.79999999999999999e139

    1. Initial program 97.2%

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

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

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

Alternative 13: 65.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -7.2 \cdot 10^{+31} \lor \neg \left(c \cdot i \leq 1.5 \cdot 10^{+159}\right):\\
\;\;\;\;a \cdot b + c \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c i) < -7.19999999999999992e31 or 1.5000000000000001e159 < (*.f64 c i)

    1. Initial program 94.5%

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

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

    if -7.19999999999999992e31 < (*.f64 c i) < 1.5000000000000001e159

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

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

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

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

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

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

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

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

Alternative 14: 65.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.35 \cdot 10^{+27}:\\
\;\;\;\;z \cdot t + c \cdot i\\

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

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


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

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

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

    if -1.3499999999999999e27 < (*.f64 c i) < 7.5999999999999997e158

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

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

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

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

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

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

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

    if 7.5999999999999997e158 < (*.f64 c i)

    1. Initial program 89.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1.35 \cdot 10^{+27}:\\ \;\;\;\;z \cdot t + c \cdot i\\ \mathbf{elif}\;c \cdot i \leq 7.6 \cdot 10^{+158}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 43.2% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.1 \cdot 10^{+110} \lor \neg \left(a \cdot b \leq 9 \cdot 10^{+46}\right):\\
\;\;\;\;a \cdot b\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -1.09999999999999996e110 or 9.00000000000000019e46 < (*.f64 a b)

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

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

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

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

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

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

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

    if -1.09999999999999996e110 < (*.f64 a b) < 9.00000000000000019e46

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

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

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

Alternative 16: 27.3% accurate, 5.0× speedup?

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{a \cdot b} \]
  7. Final simplification29.9%

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

Reproduce

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