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

Percentage Accurate: 95.9% → 97.4%
Time: 13.4s
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.4% accurate, 0.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+228}:\\
\;\;\;\;\mathsf{fma}\left(a, b, c \cdot i\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -9.9999999999999992e227

    1. Initial program 74.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 78.5%

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

      \[\leadsto \color{blue}{a \cdot b + c \cdot i} \]
    5. Step-by-step derivation
      1. fma-def96.4%

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, b, c \cdot i\right)} \]
    6. Simplified96.4%

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

    if -9.9999999999999992e227 < (*.f64 a b)

    1. Initial program 96.5%

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

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

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

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

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

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

      \[\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
  3. Recombined 2 regimes into one program.
  4. Final simplification98.4%

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

Alternative 2: 98.0% 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 94.1%

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

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

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

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

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

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

    \[\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.0% accurate, 0.1× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a \cdot b + c \cdot i\right) + \color{blue}{\left(z \cdot t + x \cdot y\right)} \]
      7. associate-+r+100.0%

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

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

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

    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. Step-by-step derivation
      1. +-commutative0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 97.7% accurate, 0.1× speedup?

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

\\
\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}:\\
\;\;\;\;a \cdot b\\


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

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

        \[\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. Step-by-step derivation
      1. +-commutative0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 65.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot y + z \cdot t\\ t_2 := a \cdot b + c \cdot i\\ \mathbf{if}\;a \cdot b \leq -7 \cdot 10^{+155}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq -7 \cdot 10^{-85}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 9 \cdot 10^{-163}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 2.2 \cdot 10^{+45} \lor \neg \left(a \cdot b \leq 5.5 \cdot 10^{+62}\right) \land a \cdot b \leq 1.45 \cdot 10^{+140}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \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) (* c i))))
   (if (<= (* a b) -7e+155)
     t_2
     (if (<= (* a b) -7e-85)
       t_1
       (if (<= (* a b) 9e-163)
         (+ (* c i) (* z t))
         (if (or (<= (* a b) 2.2e+45)
                 (and (not (<= (* a b) 5.5e+62)) (<= (* a b) 1.45e+140)))
           t_1
           t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (x * y) + (z * t);
	double t_2 = (a * b) + (c * i);
	double tmp;
	if ((a * b) <= -7e+155) {
		tmp = t_2;
	} else if ((a * b) <= -7e-85) {
		tmp = t_1;
	} else if ((a * b) <= 9e-163) {
		tmp = (c * i) + (z * t);
	} else if (((a * b) <= 2.2e+45) || (!((a * b) <= 5.5e+62) && ((a * b) <= 1.45e+140))) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (x * y) + (z * t)
    t_2 = (a * b) + (c * i)
    if ((a * b) <= (-7d+155)) then
        tmp = t_2
    else if ((a * b) <= (-7d-85)) then
        tmp = t_1
    else if ((a * b) <= 9d-163) then
        tmp = (c * i) + (z * t)
    else if (((a * b) <= 2.2d+45) .or. (.not. ((a * b) <= 5.5d+62)) .and. ((a * b) <= 1.45d+140)) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (x * y) + (z * t);
	double t_2 = (a * b) + (c * i);
	double tmp;
	if ((a * b) <= -7e+155) {
		tmp = t_2;
	} else if ((a * b) <= -7e-85) {
		tmp = t_1;
	} else if ((a * b) <= 9e-163) {
		tmp = (c * i) + (z * t);
	} else if (((a * b) <= 2.2e+45) || (!((a * b) <= 5.5e+62) && ((a * b) <= 1.45e+140))) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (x * y) + (z * t)
	t_2 = (a * b) + (c * i)
	tmp = 0
	if (a * b) <= -7e+155:
		tmp = t_2
	elif (a * b) <= -7e-85:
		tmp = t_1
	elif (a * b) <= 9e-163:
		tmp = (c * i) + (z * t)
	elif ((a * b) <= 2.2e+45) or (not ((a * b) <= 5.5e+62) and ((a * b) <= 1.45e+140)):
		tmp = t_1
	else:
		tmp = t_2
	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(a * b) + Float64(c * i))
	tmp = 0.0
	if (Float64(a * b) <= -7e+155)
		tmp = t_2;
	elseif (Float64(a * b) <= -7e-85)
		tmp = t_1;
	elseif (Float64(a * b) <= 9e-163)
		tmp = Float64(Float64(c * i) + Float64(z * t));
	elseif ((Float64(a * b) <= 2.2e+45) || (!(Float64(a * b) <= 5.5e+62) && (Float64(a * b) <= 1.45e+140)))
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (x * y) + (z * t);
	t_2 = (a * b) + (c * i);
	tmp = 0.0;
	if ((a * b) <= -7e+155)
		tmp = t_2;
	elseif ((a * b) <= -7e-85)
		tmp = t_1;
	elseif ((a * b) <= 9e-163)
		tmp = (c * i) + (z * t);
	elseif (((a * b) <= 2.2e+45) || (~(((a * b) <= 5.5e+62)) && ((a * b) <= 1.45e+140)))
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -7e+155], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], -7e-85], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 9e-163], N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(a * b), $MachinePrecision], 2.2e+45], And[N[Not[LessEqual[N[(a * b), $MachinePrecision], 5.5e+62]], $MachinePrecision], LessEqual[N[(a * b), $MachinePrecision], 1.45e+140]]], t$95$1, t$95$2]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;a \cdot b \leq -7 \cdot 10^{-85}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;a \cdot b \leq 9 \cdot 10^{-163}:\\
\;\;\;\;c \cdot i + z \cdot t\\

\mathbf{elif}\;a \cdot b \leq 2.2 \cdot 10^{+45} \lor \neg \left(a \cdot b \leq 5.5 \cdot 10^{+62}\right) \land a \cdot b \leq 1.45 \cdot 10^{+140}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -6.99999999999999969e155 or 2.2e45 < (*.f64 a b) < 5.4999999999999997e62 or 1.4499999999999999e140 < (*.f64 a b)

    1. Initial program 87.1%

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

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

    if -6.99999999999999969e155 < (*.f64 a b) < -6.99999999999999956e-85 or 8.9999999999999995e-163 < (*.f64 a b) < 2.2e45 or 5.4999999999999997e62 < (*.f64 a b) < 1.4499999999999999e140

    1. Initial program 97.9%

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

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

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

    if -6.99999999999999956e-85 < (*.f64 a b) < 8.9999999999999995e-163

    1. Initial program 98.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -7 \cdot 10^{+155}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -7 \cdot 10^{-85}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 9 \cdot 10^{-163}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 2.2 \cdot 10^{+45} \lor \neg \left(a \cdot b \leq 5.5 \cdot 10^{+62}\right) \land a \cdot b \leq 1.45 \cdot 10^{+140}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 65.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot y + z \cdot t\\ t_2 := a \cdot b + c \cdot i\\ \mathbf{if}\;a \cdot b \leq -1.05 \cdot 10^{+157}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq -7.8 \cdot 10^{-38}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 3.6 \cdot 10^{-257}:\\ \;\;\;\;c \cdot i + x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 1.6 \cdot 10^{+45} \lor \neg \left(a \cdot b \leq 2.4 \cdot 10^{+63}\right) \land a \cdot b \leq 1.12 \cdot 10^{+144}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \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) (* c i))))
   (if (<= (* a b) -1.05e+157)
     t_2
     (if (<= (* a b) -7.8e-38)
       t_1
       (if (<= (* a b) 3.6e-257)
         (+ (* c i) (* x y))
         (if (or (<= (* a b) 1.6e+45)
                 (and (not (<= (* a b) 2.4e+63)) (<= (* a b) 1.12e+144)))
           t_1
           t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (x * y) + (z * t);
	double t_2 = (a * b) + (c * i);
	double tmp;
	if ((a * b) <= -1.05e+157) {
		tmp = t_2;
	} else if ((a * b) <= -7.8e-38) {
		tmp = t_1;
	} else if ((a * b) <= 3.6e-257) {
		tmp = (c * i) + (x * y);
	} else if (((a * b) <= 1.6e+45) || (!((a * b) <= 2.4e+63) && ((a * b) <= 1.12e+144))) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (x * y) + (z * t)
    t_2 = (a * b) + (c * i)
    if ((a * b) <= (-1.05d+157)) then
        tmp = t_2
    else if ((a * b) <= (-7.8d-38)) then
        tmp = t_1
    else if ((a * b) <= 3.6d-257) then
        tmp = (c * i) + (x * y)
    else if (((a * b) <= 1.6d+45) .or. (.not. ((a * b) <= 2.4d+63)) .and. ((a * b) <= 1.12d+144)) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (x * y) + (z * t);
	double t_2 = (a * b) + (c * i);
	double tmp;
	if ((a * b) <= -1.05e+157) {
		tmp = t_2;
	} else if ((a * b) <= -7.8e-38) {
		tmp = t_1;
	} else if ((a * b) <= 3.6e-257) {
		tmp = (c * i) + (x * y);
	} else if (((a * b) <= 1.6e+45) || (!((a * b) <= 2.4e+63) && ((a * b) <= 1.12e+144))) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (x * y) + (z * t)
	t_2 = (a * b) + (c * i)
	tmp = 0
	if (a * b) <= -1.05e+157:
		tmp = t_2
	elif (a * b) <= -7.8e-38:
		tmp = t_1
	elif (a * b) <= 3.6e-257:
		tmp = (c * i) + (x * y)
	elif ((a * b) <= 1.6e+45) or (not ((a * b) <= 2.4e+63) and ((a * b) <= 1.12e+144)):
		tmp = t_1
	else:
		tmp = t_2
	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(a * b) + Float64(c * i))
	tmp = 0.0
	if (Float64(a * b) <= -1.05e+157)
		tmp = t_2;
	elseif (Float64(a * b) <= -7.8e-38)
		tmp = t_1;
	elseif (Float64(a * b) <= 3.6e-257)
		tmp = Float64(Float64(c * i) + Float64(x * y));
	elseif ((Float64(a * b) <= 1.6e+45) || (!(Float64(a * b) <= 2.4e+63) && (Float64(a * b) <= 1.12e+144)))
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (x * y) + (z * t);
	t_2 = (a * b) + (c * i);
	tmp = 0.0;
	if ((a * b) <= -1.05e+157)
		tmp = t_2;
	elseif ((a * b) <= -7.8e-38)
		tmp = t_1;
	elseif ((a * b) <= 3.6e-257)
		tmp = (c * i) + (x * y);
	elseif (((a * b) <= 1.6e+45) || (~(((a * b) <= 2.4e+63)) && ((a * b) <= 1.12e+144)))
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1.05e+157], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], -7.8e-38], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 3.6e-257], N[(N[(c * i), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(a * b), $MachinePrecision], 1.6e+45], And[N[Not[LessEqual[N[(a * b), $MachinePrecision], 2.4e+63]], $MachinePrecision], LessEqual[N[(a * b), $MachinePrecision], 1.12e+144]]], t$95$1, t$95$2]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;a \cdot b \leq -7.8 \cdot 10^{-38}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;a \cdot b \leq 1.6 \cdot 10^{+45} \lor \neg \left(a \cdot b \leq 2.4 \cdot 10^{+63}\right) \land a \cdot b \leq 1.12 \cdot 10^{+144}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -1.05e157 or 1.6000000000000001e45 < (*.f64 a b) < 2.4e63 or 1.11999999999999999e144 < (*.f64 a b)

    1. Initial program 87.1%

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

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

    if -1.05e157 < (*.f64 a b) < -7.7999999999999998e-38 or 3.60000000000000007e-257 < (*.f64 a b) < 1.6000000000000001e45 or 2.4e63 < (*.f64 a b) < 1.11999999999999999e144

    1. Initial program 98.0%

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

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

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

    if -7.7999999999999998e-38 < (*.f64 a b) < 3.60000000000000007e-257

    1. Initial program 98.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.05 \cdot 10^{+157}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -7.8 \cdot 10^{-38}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 3.6 \cdot 10^{-257}:\\ \;\;\;\;c \cdot i + x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 1.6 \cdot 10^{+45} \lor \neg \left(a \cdot b \leq 2.4 \cdot 10^{+63}\right) \land a \cdot b \leq 1.12 \cdot 10^{+144}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 42.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+155}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -1.15 \cdot 10^{-35}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 5.5 \cdot 10^{-170}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 9 \cdot 10^{+35}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 5.4 \cdot 10^{+161}:\\ \;\;\;\;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) -5e+155)
   (* a b)
   (if (<= (* a b) -1.15e-35)
     (* z t)
     (if (<= (* a b) 5.5e-170)
       (* c i)
       (if (<= (* a b) 9e+35)
         (* x y)
         (if (<= (* a b) 5.4e+161) (* 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) <= -5e+155) {
		tmp = a * b;
	} else if ((a * b) <= -1.15e-35) {
		tmp = z * t;
	} else if ((a * b) <= 5.5e-170) {
		tmp = c * i;
	} else if ((a * b) <= 9e+35) {
		tmp = x * y;
	} else if ((a * b) <= 5.4e+161) {
		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) <= (-5d+155)) then
        tmp = a * b
    else if ((a * b) <= (-1.15d-35)) then
        tmp = z * t
    else if ((a * b) <= 5.5d-170) then
        tmp = c * i
    else if ((a * b) <= 9d+35) then
        tmp = x * y
    else if ((a * b) <= 5.4d+161) 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) <= -5e+155) {
		tmp = a * b;
	} else if ((a * b) <= -1.15e-35) {
		tmp = z * t;
	} else if ((a * b) <= 5.5e-170) {
		tmp = c * i;
	} else if ((a * b) <= 9e+35) {
		tmp = x * y;
	} else if ((a * b) <= 5.4e+161) {
		tmp = z * t;
	} else {
		tmp = a * b;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (a * b) <= -5e+155:
		tmp = a * b
	elif (a * b) <= -1.15e-35:
		tmp = z * t
	elif (a * b) <= 5.5e-170:
		tmp = c * i
	elif (a * b) <= 9e+35:
		tmp = x * y
	elif (a * b) <= 5.4e+161:
		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) <= -5e+155)
		tmp = Float64(a * b);
	elseif (Float64(a * b) <= -1.15e-35)
		tmp = Float64(z * t);
	elseif (Float64(a * b) <= 5.5e-170)
		tmp = Float64(c * i);
	elseif (Float64(a * b) <= 9e+35)
		tmp = Float64(x * y);
	elseif (Float64(a * b) <= 5.4e+161)
		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) <= -5e+155)
		tmp = a * b;
	elseif ((a * b) <= -1.15e-35)
		tmp = z * t;
	elseif ((a * b) <= 5.5e-170)
		tmp = c * i;
	elseif ((a * b) <= 9e+35)
		tmp = x * y;
	elseif ((a * b) <= 5.4e+161)
		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], -5e+155], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -1.15e-35], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5.5e-170], N[(c * i), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 9e+35], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5.4e+161], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]]
\begin{array}{l}

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 a b) < -4.9999999999999999e155 or 5.3999999999999995e161 < (*.f64 a b)

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999999e155 < (*.f64 a b) < -1.1499999999999999e-35 or 8.9999999999999993e35 < (*.f64 a b) < 5.3999999999999995e161

    1. Initial program 95.7%

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

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

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

    if -1.1499999999999999e-35 < (*.f64 a b) < 5.50000000000000018e-170

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

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

    if 5.50000000000000018e-170 < (*.f64 a b) < 8.9999999999999993e35

    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. +-commutative100.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot y} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification54.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+155}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -1.15 \cdot 10^{-35}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 5.5 \cdot 10^{-170}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 9 \cdot 10^{+35}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 5.4 \cdot 10^{+161}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 66.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := c \cdot i + z \cdot t\\ t_2 := a \cdot b + c \cdot i\\ \mathbf{if}\;a \cdot b \leq -1.15 \cdot 10^{+157}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq 480000000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 3.5 \cdot 10^{+32}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+140}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* c i) (* z t))) (t_2 (+ (* a b) (* c i))))
   (if (<= (* a b) -1.15e+157)
     t_2
     (if (<= (* a b) 480000000000.0)
       t_1
       (if (<= (* a b) 3.5e+32)
         (+ (* a b) (* x y))
         (if (<= (* a b) 5e+140) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (c * i) + (z * t);
	double t_2 = (a * b) + (c * i);
	double tmp;
	if ((a * b) <= -1.15e+157) {
		tmp = t_2;
	} else if ((a * b) <= 480000000000.0) {
		tmp = t_1;
	} else if ((a * b) <= 3.5e+32) {
		tmp = (a * b) + (x * y);
	} else if ((a * b) <= 5e+140) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (c * i) + (z * t)
    t_2 = (a * b) + (c * i)
    if ((a * b) <= (-1.15d+157)) then
        tmp = t_2
    else if ((a * b) <= 480000000000.0d0) then
        tmp = t_1
    else if ((a * b) <= 3.5d+32) then
        tmp = (a * b) + (x * y)
    else if ((a * b) <= 5d+140) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (c * i) + (z * t);
	double t_2 = (a * b) + (c * i);
	double tmp;
	if ((a * b) <= -1.15e+157) {
		tmp = t_2;
	} else if ((a * b) <= 480000000000.0) {
		tmp = t_1;
	} else if ((a * b) <= 3.5e+32) {
		tmp = (a * b) + (x * y);
	} else if ((a * b) <= 5e+140) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (c * i) + (z * t)
	t_2 = (a * b) + (c * i)
	tmp = 0
	if (a * b) <= -1.15e+157:
		tmp = t_2
	elif (a * b) <= 480000000000.0:
		tmp = t_1
	elif (a * b) <= 3.5e+32:
		tmp = (a * b) + (x * y)
	elif (a * b) <= 5e+140:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(c * i) + Float64(z * t))
	t_2 = Float64(Float64(a * b) + Float64(c * i))
	tmp = 0.0
	if (Float64(a * b) <= -1.15e+157)
		tmp = t_2;
	elseif (Float64(a * b) <= 480000000000.0)
		tmp = t_1;
	elseif (Float64(a * b) <= 3.5e+32)
		tmp = Float64(Float64(a * b) + Float64(x * y));
	elseif (Float64(a * b) <= 5e+140)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (c * i) + (z * t);
	t_2 = (a * b) + (c * i);
	tmp = 0.0;
	if ((a * b) <= -1.15e+157)
		tmp = t_2;
	elseif ((a * b) <= 480000000000.0)
		tmp = t_1;
	elseif ((a * b) <= 3.5e+32)
		tmp = (a * b) + (x * y);
	elseif ((a * b) <= 5e+140)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1.15e+157], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], 480000000000.0], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 3.5e+32], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5e+140], t$95$1, t$95$2]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := c \cdot i + z \cdot t\\
t_2 := a \cdot b + c \cdot i\\
\mathbf{if}\;a \cdot b \leq -1.15 \cdot 10^{+157}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;a \cdot b \leq 480000000000:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+140}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -1.15000000000000002e157 or 5.00000000000000008e140 < (*.f64 a b)

    1. Initial program 86.3%

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

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

    if -1.15000000000000002e157 < (*.f64 a b) < 4.8e11 or 3.5000000000000001e32 < (*.f64 a b) < 5.00000000000000008e140

    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 inf 62.0%

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

    if 4.8e11 < (*.f64 a b) < 3.5000000000000001e32

    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. +-commutative100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.15 \cdot 10^{+157}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 480000000000:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 3.5 \cdot 10^{+32}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+140}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 97.0% accurate, 0.4× speedup?

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

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

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


\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
    5. Step-by-step derivation
      1. fma-def100.0%

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

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

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

    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. Step-by-step derivation
      1. +-commutative0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 43.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -6 \cdot 10^{+155}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -3.1 \cdot 10^{-39}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.26 \cdot 10^{-256}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 8.4 \cdot 10^{+161}:\\ \;\;\;\;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) -6e+155)
   (* a b)
   (if (<= (* a b) -3.1e-39)
     (* z t)
     (if (<= (* a b) 1.26e-256)
       (* c i)
       (if (<= (* a b) 8.4e+161) (* 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) <= -6e+155) {
		tmp = a * b;
	} else if ((a * b) <= -3.1e-39) {
		tmp = z * t;
	} else if ((a * b) <= 1.26e-256) {
		tmp = c * i;
	} else if ((a * b) <= 8.4e+161) {
		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) <= (-6d+155)) then
        tmp = a * b
    else if ((a * b) <= (-3.1d-39)) then
        tmp = z * t
    else if ((a * b) <= 1.26d-256) then
        tmp = c * i
    else if ((a * b) <= 8.4d+161) 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) <= -6e+155) {
		tmp = a * b;
	} else if ((a * b) <= -3.1e-39) {
		tmp = z * t;
	} else if ((a * b) <= 1.26e-256) {
		tmp = c * i;
	} else if ((a * b) <= 8.4e+161) {
		tmp = z * t;
	} else {
		tmp = a * b;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (a * b) <= -6e+155:
		tmp = a * b
	elif (a * b) <= -3.1e-39:
		tmp = z * t
	elif (a * b) <= 1.26e-256:
		tmp = c * i
	elif (a * b) <= 8.4e+161:
		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) <= -6e+155)
		tmp = Float64(a * b);
	elseif (Float64(a * b) <= -3.1e-39)
		tmp = Float64(z * t);
	elseif (Float64(a * b) <= 1.26e-256)
		tmp = Float64(c * i);
	elseif (Float64(a * b) <= 8.4e+161)
		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) <= -6e+155)
		tmp = a * b;
	elseif ((a * b) <= -3.1e-39)
		tmp = z * t;
	elseif ((a * b) <= 1.26e-256)
		tmp = c * i;
	elseif ((a * b) <= 8.4e+161)
		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], -6e+155], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -3.1e-39], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.26e-256], N[(c * i), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 8.4e+161], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]
\begin{array}{l}

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -6.0000000000000003e155 or 8.4e161 < (*.f64 a b)

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.0000000000000003e155 < (*.f64 a b) < -3.0999999999999997e-39 or 1.25999999999999999e-256 < (*.f64 a b) < 8.4e161

    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 a around 0 85.6%

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

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

    if -3.0999999999999997e-39 < (*.f64 a b) < 1.25999999999999999e-256

    1. Initial program 98.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -6 \cdot 10^{+155}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -3.1 \cdot 10^{-39}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.26 \cdot 10^{-256}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 8.4 \cdot 10^{+161}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 59.1% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;i \leq 3.6 \cdot 10^{-69}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;i \leq 6.8 \cdot 10^{-17}:\\
\;\;\;\;z \cdot t\\

\mathbf{elif}\;i \leq 1.42 \cdot 10^{+156}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if i < -2.49999999999999985e-12 or 1.41999999999999998e156 < i

    1. Initial program 91.0%

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

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

    if -2.49999999999999985e-12 < i < 3.60000000000000018e-69 or 6.7999999999999996e-17 < i < 1.41999999999999998e156

    1. Initial program 95.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.60000000000000018e-69 < i < 6.7999999999999996e-17

    1. Initial program 100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -2.5 \cdot 10^{-12}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;i \leq 3.6 \cdot 10^{-69}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;i \leq 6.8 \cdot 10^{-17}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;i \leq 1.42 \cdot 10^{+156}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 86.2% accurate, 0.6× speedup?

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

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

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

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


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

    1. Initial program 83.7%

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

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

    if -5.6000000000000005e157 < (*.f64 a b) < 1.74999999999999987e147

    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 a around 0 89.0%

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

    if 1.74999999999999987e147 < (*.f64 a b)

    1. Initial program 88.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 86.8%

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

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

Alternative 13: 62.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -7.2 \cdot 10^{+175} \lor \neg \left(x \cdot y \leq 3 \cdot 10^{+133}\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) -7.2e+175) (not (<= (* x y) 3e+133)))
   (* 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) <= -7.2e+175) || !((x * y) <= 3e+133)) {
		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) <= (-7.2d+175)) .or. (.not. ((x * y) <= 3d+133))) 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) <= -7.2e+175) || !((x * y) <= 3e+133)) {
		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) <= -7.2e+175) or not ((x * y) <= 3e+133):
		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) <= -7.2e+175) || !(Float64(x * y) <= 3e+133))
		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) <= -7.2e+175) || ~(((x * y) <= 3e+133)))
		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], -7.2e+175], N[Not[LessEqual[N[(x * y), $MachinePrecision], 3e+133]], $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 -7.2 \cdot 10^{+175} \lor \neg \left(x \cdot y \leq 3 \cdot 10^{+133}\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) < -7.20000000000000067e175 or 3.00000000000000007e133 < (*.f64 x y)

    1. Initial program 84.9%

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

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

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

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

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

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

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

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

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

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

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

    if -7.20000000000000067e175 < (*.f64 x y) < 3.00000000000000007e133

    1. Initial program 97.8%

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

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

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

Alternative 14: 75.3% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.35 \cdot 10^{+172} \lor \neg \left(z \leq 4.5 \cdot 10^{-17}\right):\\
\;\;\;\;x \cdot y + z \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.3500000000000001e172 or 4.49999999999999978e-17 < z

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

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

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

    if -2.3500000000000001e172 < z < 4.49999999999999978e-17

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

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

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

Alternative 15: 43.9% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -2.4 \cdot 10^{+166} \lor \neg \left(c \cdot i \leq 2 \cdot 10^{+121}\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) < -2.39999999999999992e166 or 2.00000000000000007e121 < (*.f64 c i)

    1. Initial program 91.6%

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

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

    if -2.39999999999999992e166 < (*.f64 c i) < 2.00000000000000007e121

    1. Initial program 95.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 27.9% accurate, 5.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{a \cdot b} \]
  9. Final simplification33.2%

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

Reproduce

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