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

Percentage Accurate: 95.9% → 98.2%
Time: 10.4s
Alternatives: 18
Speedup: 0.5×

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 18 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: 98.2% accurate, 0.0× 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(x, y, \mathsf{fma}\left(z, t, \mathsf{fma}\left(a, b, c \cdot i\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, t, \mathsf{fma}\left(x, y, c \cdot i\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= (+ (* a b) (+ (* x y) (* z t))) INFINITY)
   (fma x y (fma z t (fma a b (* c i))))
   (fma z t (fma x y (* c i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (((a * b) + ((x * y) + (z * t))) <= ((double) INFINITY)) {
		tmp = fma(x, y, fma(z, t, fma(a, b, (c * i))));
	} else {
		tmp = fma(z, t, fma(x, y, (c * i)));
	}
	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(x, y, fma(z, t, fma(a, b, Float64(c * i))));
	else
		tmp = fma(z, t, fma(x, y, Float64(c * i)));
	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[(x * y + N[(z * t + N[(a * b + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * t + N[(x * y + N[(c * i), $MachinePrecision]), $MachinePrecision]), $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(x, y, \mathsf{fma}\left(z, t, \mathsf{fma}\left(a, b, c \cdot i\right)\right)\right)\\

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.2% accurate, 0.1× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 98.2% accurate, 0.1× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

        \[\leadsto \mathsf{fma}\left(c, i, \color{blue}{\mathsf{fma}\left(x, y, z \cdot t + a \cdot b\right)}\right) \]
      5. fma-def100.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. Simplified100.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. Step-by-step derivation
      1. fma-udef100.0%

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

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

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

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

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

      \[\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 (*.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. Taylor expanded in a around 0 40.0%

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

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

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

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

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

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

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

Alternative 4: 97.9% 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(x \cdot y + a \cdot b\right) + z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t, z, x \cdot y\right)\\ \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 (+ (+ (* x y) (* a b)) (* z t)))
   (fma t z (* 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) + ((x * y) + (z * t))) <= ((double) INFINITY)) {
		tmp = fma(c, i, (((x * y) + (a * b)) + (z * t)));
	} else {
		tmp = fma(t, z, (x * y));
	}
	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(x * y) + Float64(a * b)) + Float64(z * t)));
	else
		tmp = fma(t, z, Float64(x * y));
	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[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * z + N[(x * y), $MachinePrecision]), $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(x \cdot y + a \cdot b\right) + z \cdot t\right)\\

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


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

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

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

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

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

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

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

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

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

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

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

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

      \[\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. Taylor expanded in a around 0 50.0%

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

      \[\leadsto \color{blue}{t \cdot z + x \cdot y} \]
    4. Step-by-step derivation
      1. fma-def66.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, z, x \cdot y\right)} \]
    5. Simplified66.7%

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

    \[\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(x \cdot y + a \cdot b\right) + z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t, z, x \cdot y\right)\\ \end{array} \]

Alternative 5: 97.6% accurate, 0.1× speedup?

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

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

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


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

    1. Initial program 100.0%

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

    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. Taylor expanded in a around 0 40.0%

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

      \[\leadsto \color{blue}{t \cdot z + x \cdot y} \]
    4. Step-by-step derivation
      1. fma-def50.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, z, x \cdot y\right)} \]
    5. Simplified50.5%

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

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

Alternative 6: 97.9% accurate, 0.1× speedup?

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

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

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


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

    1. Initial program 100.0%

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

    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. Taylor expanded in a around 0 40.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, t, c \cdot i\right)} \]
    7. Simplified55.2%

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

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

Alternative 7: 65.6% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot y + c \cdot i\\ t_2 := x \cdot y + z \cdot t\\ t_3 := a \cdot b + c \cdot i\\ \mathbf{if}\;a \cdot b \leq -6.4 \cdot 10^{+72}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \cdot b \leq -6.2 \cdot 10^{-145}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq -2.4 \cdot 10^{-250}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq -5 \cdot 10^{-310}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 9.6 \cdot 10^{-293}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq 1.2 \cdot 10^{+156}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* x y) (* c i)))
        (t_2 (+ (* x y) (* z t)))
        (t_3 (+ (* a b) (* c i))))
   (if (<= (* a b) -6.4e+72)
     t_3
     (if (<= (* a b) -6.2e-145)
       t_1
       (if (<= (* a b) -2.4e-250)
         t_2
         (if (<= (* a b) -5e-310)
           t_1
           (if (<= (* a b) 9.6e-293)
             t_2
             (if (<= (* a b) 1.2e+156) (+ (* c i) (* z t)) t_3))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (x * y) + (c * i);
	double t_2 = (x * y) + (z * t);
	double t_3 = (a * b) + (c * i);
	double tmp;
	if ((a * b) <= -6.4e+72) {
		tmp = t_3;
	} else if ((a * b) <= -6.2e-145) {
		tmp = t_1;
	} else if ((a * b) <= -2.4e-250) {
		tmp = t_2;
	} else if ((a * b) <= -5e-310) {
		tmp = t_1;
	} else if ((a * b) <= 9.6e-293) {
		tmp = t_2;
	} else if ((a * b) <= 1.2e+156) {
		tmp = (c * i) + (z * t);
	} else {
		tmp = t_3;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = (x * y) + (c * i)
    t_2 = (x * y) + (z * t)
    t_3 = (a * b) + (c * i)
    if ((a * b) <= (-6.4d+72)) then
        tmp = t_3
    else if ((a * b) <= (-6.2d-145)) then
        tmp = t_1
    else if ((a * b) <= (-2.4d-250)) then
        tmp = t_2
    else if ((a * b) <= (-5d-310)) then
        tmp = t_1
    else if ((a * b) <= 9.6d-293) then
        tmp = t_2
    else if ((a * b) <= 1.2d+156) then
        tmp = (c * i) + (z * t)
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (x * y) + (c * i);
	double t_2 = (x * y) + (z * t);
	double t_3 = (a * b) + (c * i);
	double tmp;
	if ((a * b) <= -6.4e+72) {
		tmp = t_3;
	} else if ((a * b) <= -6.2e-145) {
		tmp = t_1;
	} else if ((a * b) <= -2.4e-250) {
		tmp = t_2;
	} else if ((a * b) <= -5e-310) {
		tmp = t_1;
	} else if ((a * b) <= 9.6e-293) {
		tmp = t_2;
	} else if ((a * b) <= 1.2e+156) {
		tmp = (c * i) + (z * t);
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (x * y) + (c * i)
	t_2 = (x * y) + (z * t)
	t_3 = (a * b) + (c * i)
	tmp = 0
	if (a * b) <= -6.4e+72:
		tmp = t_3
	elif (a * b) <= -6.2e-145:
		tmp = t_1
	elif (a * b) <= -2.4e-250:
		tmp = t_2
	elif (a * b) <= -5e-310:
		tmp = t_1
	elif (a * b) <= 9.6e-293:
		tmp = t_2
	elif (a * b) <= 1.2e+156:
		tmp = (c * i) + (z * t)
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(x * y) + Float64(c * i))
	t_2 = Float64(Float64(x * y) + Float64(z * t))
	t_3 = Float64(Float64(a * b) + Float64(c * i))
	tmp = 0.0
	if (Float64(a * b) <= -6.4e+72)
		tmp = t_3;
	elseif (Float64(a * b) <= -6.2e-145)
		tmp = t_1;
	elseif (Float64(a * b) <= -2.4e-250)
		tmp = t_2;
	elseif (Float64(a * b) <= -5e-310)
		tmp = t_1;
	elseif (Float64(a * b) <= 9.6e-293)
		tmp = t_2;
	elseif (Float64(a * b) <= 1.2e+156)
		tmp = Float64(Float64(c * i) + Float64(z * t));
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (x * y) + (c * i);
	t_2 = (x * y) + (z * t);
	t_3 = (a * b) + (c * i);
	tmp = 0.0;
	if ((a * b) <= -6.4e+72)
		tmp = t_3;
	elseif ((a * b) <= -6.2e-145)
		tmp = t_1;
	elseif ((a * b) <= -2.4e-250)
		tmp = t_2;
	elseif ((a * b) <= -5e-310)
		tmp = t_1;
	elseif ((a * b) <= 9.6e-293)
		tmp = t_2;
	elseif ((a * b) <= 1.2e+156)
		tmp = (c * i) + (z * t);
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -6.4e+72], t$95$3, If[LessEqual[N[(a * b), $MachinePrecision], -6.2e-145], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], -2.4e-250], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], -5e-310], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 9.6e-293], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], 1.2e+156], N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;a \cdot b \leq -6.2 \cdot 10^{-145}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;a \cdot b \leq -2.4 \cdot 10^{-250}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;a \cdot b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;a \cdot b \leq 9.6 \cdot 10^{-293}:\\
\;\;\;\;t_2\\

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

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 a b) < -6.4000000000000003e72 or 1.2000000000000001e156 < (*.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. Taylor expanded in z around 0 81.4%

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

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

    if -6.4000000000000003e72 < (*.f64 a b) < -6.20000000000000001e-145 or -2.3999999999999999e-250 < (*.f64 a b) < -4.999999999999985e-310

    1. Initial program 92.3%

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

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

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

    if -6.20000000000000001e-145 < (*.f64 a b) < -2.3999999999999999e-250 or -4.999999999999985e-310 < (*.f64 a b) < 9.5999999999999996e-293

    1. Initial program 97.7%

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

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

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

    if 9.5999999999999996e-293 < (*.f64 a b) < 1.2000000000000001e156

    1. Initial program 96.9%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -6.4 \cdot 10^{+72}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -6.2 \cdot 10^{-145}:\\ \;\;\;\;x \cdot y + c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -2.4 \cdot 10^{-250}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq -5 \cdot 10^{-310}:\\ \;\;\;\;x \cdot y + c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 9.6 \cdot 10^{-293}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.2 \cdot 10^{+156}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \end{array} \]

Alternative 8: 97.3% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;c \cdot i + z \cdot t\\


\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 \]

    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. Taylor expanded in a around 0 40.0%

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

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

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

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

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

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

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

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

Alternative 9: 84.0% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;x \cdot y \leq -1.45 \cdot 10^{+136}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;x \cdot y \leq 3.4 \cdot 10^{+97}:\\
\;\;\;\;t_1\\

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


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

    1. Initial program 80.0%

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

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

    if -8.49999999999999959e255 < (*.f64 x y) < -1.44999999999999987e136 or -2.04999999999999993e95 < (*.f64 x y) < 3.4000000000000001e97

    1. Initial program 96.2%

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

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

    if -1.44999999999999987e136 < (*.f64 x y) < -2.04999999999999993e95

    1. Initial program 99.8%

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

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

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

    if 3.4000000000000001e97 < (*.f64 x y)

    1. Initial program 78.3%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -8.5 \cdot 10^{+255}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -1.45 \cdot 10^{+136}:\\ \;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq -2.05 \cdot 10^{+95}:\\ \;\;\;\;x \cdot y + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 3.4 \cdot 10^{+97}:\\ \;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \end{array} \]

Alternative 10: 63.3% accurate, 0.6× 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 -3.3 \cdot 10^{+70}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq -1950000000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq -9.6 \cdot 10^{-82}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 1.05 \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 (+ (* c i) (* z t))) (t_2 (+ (* a b) (* c i))))
   (if (<= (* a b) -3.3e+70)
     t_2
     (if (<= (* a b) -1950000000000.0)
       t_1
       (if (<= (* a b) -9.6e-82)
         (* x y)
         (if (<= (* a b) 1.05e+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 = (c * i) + (z * t);
	double t_2 = (a * b) + (c * i);
	double tmp;
	if ((a * b) <= -3.3e+70) {
		tmp = t_2;
	} else if ((a * b) <= -1950000000000.0) {
		tmp = t_1;
	} else if ((a * b) <= -9.6e-82) {
		tmp = x * y;
	} else if ((a * b) <= 1.05e+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 = (c * i) + (z * t)
    t_2 = (a * b) + (c * i)
    if ((a * b) <= (-3.3d+70)) then
        tmp = t_2
    else if ((a * b) <= (-1950000000000.0d0)) then
        tmp = t_1
    else if ((a * b) <= (-9.6d-82)) then
        tmp = x * y
    else if ((a * b) <= 1.05d+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 = (c * i) + (z * t);
	double t_2 = (a * b) + (c * i);
	double tmp;
	if ((a * b) <= -3.3e+70) {
		tmp = t_2;
	} else if ((a * b) <= -1950000000000.0) {
		tmp = t_1;
	} else if ((a * b) <= -9.6e-82) {
		tmp = x * y;
	} else if ((a * b) <= 1.05e+156) {
		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) <= -3.3e+70:
		tmp = t_2
	elif (a * b) <= -1950000000000.0:
		tmp = t_1
	elif (a * b) <= -9.6e-82:
		tmp = x * y
	elif (a * b) <= 1.05e+156:
		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) <= -3.3e+70)
		tmp = t_2;
	elseif (Float64(a * b) <= -1950000000000.0)
		tmp = t_1;
	elseif (Float64(a * b) <= -9.6e-82)
		tmp = Float64(x * y);
	elseif (Float64(a * b) <= 1.05e+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 = (c * i) + (z * t);
	t_2 = (a * b) + (c * i);
	tmp = 0.0;
	if ((a * b) <= -3.3e+70)
		tmp = t_2;
	elseif ((a * b) <= -1950000000000.0)
		tmp = t_1;
	elseif ((a * b) <= -9.6e-82)
		tmp = x * y;
	elseif ((a * b) <= 1.05e+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[(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], -3.3e+70], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], -1950000000000.0], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], -9.6e-82], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.05e+156], 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 -3.3 \cdot 10^{+70}:\\
\;\;\;\;t_2\\

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

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

\mathbf{elif}\;a \cdot b \leq 1.05 \cdot 10^{+156}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -3.30000000000000016e70 or 1.04999999999999991e156 < (*.f64 a b)

    1. Initial program 86.5%

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

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

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

    if -3.30000000000000016e70 < (*.f64 a b) < -1.95e12 or -9.60000000000000033e-82 < (*.f64 a b) < 1.04999999999999991e156

    1. Initial program 97.2%

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

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

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

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

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

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

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

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

    if -1.95e12 < (*.f64 a b) < -9.60000000000000033e-82

    1. Initial program 81.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -3.3 \cdot 10^{+70}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -1950000000000:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq -9.6 \cdot 10^{-82}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 1.05 \cdot 10^{+156}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \end{array} \]

Alternative 11: 65.6% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_1 := a \cdot b + c \cdot i\\
\mathbf{if}\;a \cdot b \leq -1.8 \cdot 10^{+72}:\\
\;\;\;\;t_1\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -1.80000000000000017e72 or 1.04999999999999991e156 < (*.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. Taylor expanded in z around 0 81.4%

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

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

    if -1.80000000000000017e72 < (*.f64 a b) < -6.9999999999999984e-309

    1. Initial program 94.3%

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

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

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

    if -6.9999999999999984e-309 < (*.f64 a b) < 1.04999999999999991e156

    1. Initial program 96.7%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.8 \cdot 10^{+72}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -7 \cdot 10^{-309}:\\ \;\;\;\;x \cdot y + c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 1.05 \cdot 10^{+156}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \end{array} \]

Alternative 12: 87.4% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 84.9%

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

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

    if -4.2000000000000003e72 < (*.f64 a b) < 1.8500000000000002e-30

    1. Initial program 96.2%

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

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

    if 1.8500000000000002e-30 < (*.f64 a b)

    1. Initial program 89.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -4.2 \cdot 10^{+72}:\\ \;\;\;\;c \cdot i + \left(x \cdot y + a \cdot b\right)\\ \mathbf{elif}\;a \cdot b \leq 1.85 \cdot 10^{-30}:\\ \;\;\;\;c \cdot i + \left(x \cdot y + z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\ \end{array} \]

Alternative 13: 41.7% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;c \cdot i \leq 3 \cdot 10^{+165}:\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 c i) < -2.1999999999999999e139 or 2.9999999999999999e165 < (*.f64 c i)

    1. Initial program 88.2%

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

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

    if -2.1999999999999999e139 < (*.f64 c i) < 1.9999999999999999e61

    1. Initial program 94.8%

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

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

    if 1.9999999999999999e61 < (*.f64 c i) < 2.9999999999999999e165

    1. Initial program 88.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -2.2 \cdot 10^{+139}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{+61}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \cdot i \leq 3 \cdot 10^{+165}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]

Alternative 14: 77.3% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -1.24999999999999993e-30

    1. Initial program 91.5%

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

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

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

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

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

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

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

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

    if -1.24999999999999993e-30 < t < 3.7999999999999999e128

    1. Initial program 96.5%

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

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

    if 3.7999999999999999e128 < t

    1. Initial program 78.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.25 \cdot 10^{-30}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;t \leq 3.8 \cdot 10^{+128}:\\ \;\;\;\;c \cdot i + \left(x \cdot y + a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\ \end{array} \]

Alternative 15: 42.7% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c i) < -1.1999999999999999e143 or 1.4500000000000001e166 < (*.f64 c i)

    1. Initial program 88.1%

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

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

    if -1.1999999999999999e143 < (*.f64 c i) < 1.4500000000000001e166

    1. Initial program 94.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1.2 \cdot 10^{+143}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq 1.45 \cdot 10^{+166}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]

Alternative 16: 41.9% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c i) < -2.0999999999999998e141 or 1.70000000000000005e165 < (*.f64 c i)

    1. Initial program 88.2%

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

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

    if -2.0999999999999998e141 < (*.f64 c i) < 1.70000000000000005e165

    1. Initial program 94.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -2.1 \cdot 10^{+141}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq 1.7 \cdot 10^{+165}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]

Alternative 17: 55.2% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+127}:\\
\;\;\;\;z \cdot t\\

\mathbf{elif}\;z \leq 4.4 \cdot 10^{+44}:\\
\;\;\;\;a \cdot b + c \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.8000000000000004e127 or 4.39999999999999991e44 < z

    1. Initial program 90.8%

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

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

    if -5.8000000000000004e127 < z < 4.39999999999999991e44

    1. Initial program 93.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.8 \cdot 10^{+127}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{+44}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{else}:\\ \;\;\;\;z \cdot t\\ \end{array} \]

Alternative 18: 28.0% 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 92.2%

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

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

    \[\leadsto a \cdot b \]

Reproduce

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