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

Percentage Accurate: 95.9% → 97.9%
Time: 10.8s
Alternatives: 20
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 20 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.9% accurate, 0.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, x, z \cdot t\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 \color{blue}{c \cdot i + \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)} \]
      2. fma-udef100.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot x + t \cdot z} \]
    6. Step-by-step derivation
      1. fma-def72.0%

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

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

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

Alternative 2: 97.9% accurate, 0.0× speedup?

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

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

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

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

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

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

      \[\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)} \]
  4. Final simplification98.4%

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

Alternative 3: 98.2% accurate, 0.0× speedup?

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

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

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

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

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

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

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

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

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

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

Alternative 4: 97.7% accurate, 0.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, c, z \cdot t\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 z around inf 57.1%

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

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

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

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

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

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

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

Alternative 5: 97.9% accurate, 0.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, x, z \cdot t\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. Step-by-step derivation
      1. associate-+l+0.0%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot x + t \cdot z} \]
    6. Step-by-step derivation
      1. fma-def72.0%

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

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

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

Alternative 6: 97.0% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 42.6% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \cdot i \leq -7.5 \cdot 10^{+23}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -4.6 \cdot 10^{-77}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq -4.7 \cdot 10^{-240}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \cdot i \leq -5 \cdot 10^{-321}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq 1.7 \cdot 10^{-224}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \cdot i \leq 1.8 \cdot 10^{-28}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq 9.8 \cdot 10^{+121}:\\ \;\;\;\;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) -7.5e+23)
   (* c i)
   (if (<= (* c i) -4.6e-77)
     (* a b)
     (if (<= (* c i) -4.7e-240)
       (* z t)
       (if (<= (* c i) -5e-321)
         (* a b)
         (if (<= (* c i) 1.7e-224)
           (* x y)
           (if (<= (* c i) 1.8e-28)
             (* a b)
             (if (<= (* c i) 9.8e+121) (* 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) <= -7.5e+23) {
		tmp = c * i;
	} else if ((c * i) <= -4.6e-77) {
		tmp = a * b;
	} else if ((c * i) <= -4.7e-240) {
		tmp = z * t;
	} else if ((c * i) <= -5e-321) {
		tmp = a * b;
	} else if ((c * i) <= 1.7e-224) {
		tmp = x * y;
	} else if ((c * i) <= 1.8e-28) {
		tmp = a * b;
	} else if ((c * i) <= 9.8e+121) {
		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) <= (-7.5d+23)) then
        tmp = c * i
    else if ((c * i) <= (-4.6d-77)) then
        tmp = a * b
    else if ((c * i) <= (-4.7d-240)) then
        tmp = z * t
    else if ((c * i) <= (-5d-321)) then
        tmp = a * b
    else if ((c * i) <= 1.7d-224) then
        tmp = x * y
    else if ((c * i) <= 1.8d-28) then
        tmp = a * b
    else if ((c * i) <= 9.8d+121) 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) <= -7.5e+23) {
		tmp = c * i;
	} else if ((c * i) <= -4.6e-77) {
		tmp = a * b;
	} else if ((c * i) <= -4.7e-240) {
		tmp = z * t;
	} else if ((c * i) <= -5e-321) {
		tmp = a * b;
	} else if ((c * i) <= 1.7e-224) {
		tmp = x * y;
	} else if ((c * i) <= 1.8e-28) {
		tmp = a * b;
	} else if ((c * i) <= 9.8e+121) {
		tmp = x * y;
	} else {
		tmp = c * i;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (c * i) <= -7.5e+23:
		tmp = c * i
	elif (c * i) <= -4.6e-77:
		tmp = a * b
	elif (c * i) <= -4.7e-240:
		tmp = z * t
	elif (c * i) <= -5e-321:
		tmp = a * b
	elif (c * i) <= 1.7e-224:
		tmp = x * y
	elif (c * i) <= 1.8e-28:
		tmp = a * b
	elif (c * i) <= 9.8e+121:
		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) <= -7.5e+23)
		tmp = Float64(c * i);
	elseif (Float64(c * i) <= -4.6e-77)
		tmp = Float64(a * b);
	elseif (Float64(c * i) <= -4.7e-240)
		tmp = Float64(z * t);
	elseif (Float64(c * i) <= -5e-321)
		tmp = Float64(a * b);
	elseif (Float64(c * i) <= 1.7e-224)
		tmp = Float64(x * y);
	elseif (Float64(c * i) <= 1.8e-28)
		tmp = Float64(a * b);
	elseif (Float64(c * i) <= 9.8e+121)
		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) <= -7.5e+23)
		tmp = c * i;
	elseif ((c * i) <= -4.6e-77)
		tmp = a * b;
	elseif ((c * i) <= -4.7e-240)
		tmp = z * t;
	elseif ((c * i) <= -5e-321)
		tmp = a * b;
	elseif ((c * i) <= 1.7e-224)
		tmp = x * y;
	elseif ((c * i) <= 1.8e-28)
		tmp = a * b;
	elseif ((c * i) <= 9.8e+121)
		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], -7.5e+23], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -4.6e-77], N[(a * b), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -4.7e-240], N[(z * t), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -5e-321], N[(a * b), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 1.7e-224], N[(x * y), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 1.8e-28], N[(a * b), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 9.8e+121], N[(x * y), $MachinePrecision], N[(c * i), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;c \cdot i \leq -4.7 \cdot 10^{-240}:\\
\;\;\;\;z \cdot t\\

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 c i) < -7.49999999999999987e23 or 9.7999999999999995e121 < (*.f64 c i)

    1. Initial program 94.7%

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

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

    if -7.49999999999999987e23 < (*.f64 c i) < -4.59999999999999997e-77 or -4.70000000000000012e-240 < (*.f64 c i) < -4.99994e-321 or 1.69999999999999996e-224 < (*.f64 c i) < 1.7999999999999999e-28

    1. Initial program 97.1%

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

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

      \[\leadsto \color{blue}{c \cdot i + a \cdot b} \]
    4. Taylor expanded in c around 0 52.6%

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

    if -4.59999999999999997e-77 < (*.f64 c i) < -4.70000000000000012e-240

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\left(a \cdot b + t \cdot z\right)} + c \cdot i \]
    3. Step-by-step derivation
      1. +-commutative84.5%

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b + t \cdot z} \]
    6. Step-by-step derivation
      1. +-commutative79.4%

        \[\leadsto \color{blue}{t \cdot z + a \cdot b} \]
      2. fma-udef79.4%

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, z, a \cdot b\right)} \]
    7. Simplified79.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(t, z, a \cdot b\right)} \]
    8. Taylor expanded in t around inf 59.1%

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

    if -4.99994e-321 < (*.f64 c i) < 1.69999999999999996e-224 or 1.7999999999999999e-28 < (*.f64 c i) < 9.7999999999999995e121

    1. Initial program 99.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -7.5 \cdot 10^{+23}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -4.6 \cdot 10^{-77}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq -4.7 \cdot 10^{-240}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \cdot i \leq -5 \cdot 10^{-321}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq 1.7 \cdot 10^{-224}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \cdot i \leq 1.8 \cdot 10^{-28}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq 9.8 \cdot 10^{+121}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]

Alternative 8: 65.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot b + x \cdot y\\ t_2 := a \cdot b + z \cdot t\\ t_3 := c \cdot i + a \cdot b\\ \mathbf{if}\;c \cdot i \leq -1.6 \cdot 10^{+103}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;c \cdot i \leq -1.8 \cdot 10^{-53}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq -6.5 \cdot 10^{-308}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq 2.6 \cdot 10^{-223}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq 2.6 \cdot 10^{-165}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq 6.4 \cdot 10^{+120}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \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) (* z t)))
        (t_3 (+ (* c i) (* a b))))
   (if (<= (* c i) -1.6e+103)
     t_3
     (if (<= (* c i) -1.8e-53)
       t_1
       (if (<= (* c i) -6.5e-308)
         t_2
         (if (<= (* c i) 2.6e-223)
           t_1
           (if (<= (* c i) 2.6e-165)
             t_2
             (if (<= (* c i) 6.4e+120) t_1 t_3))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (a * b) + (x * y);
	double t_2 = (a * b) + (z * t);
	double t_3 = (c * i) + (a * b);
	double tmp;
	if ((c * i) <= -1.6e+103) {
		tmp = t_3;
	} else if ((c * i) <= -1.8e-53) {
		tmp = t_1;
	} else if ((c * i) <= -6.5e-308) {
		tmp = t_2;
	} else if ((c * i) <= 2.6e-223) {
		tmp = t_1;
	} else if ((c * i) <= 2.6e-165) {
		tmp = t_2;
	} else if ((c * i) <= 6.4e+120) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = (a * b) + (x * y)
    t_2 = (a * b) + (z * t)
    t_3 = (c * i) + (a * b)
    if ((c * i) <= (-1.6d+103)) then
        tmp = t_3
    else if ((c * i) <= (-1.8d-53)) then
        tmp = t_1
    else if ((c * i) <= (-6.5d-308)) then
        tmp = t_2
    else if ((c * i) <= 2.6d-223) then
        tmp = t_1
    else if ((c * i) <= 2.6d-165) then
        tmp = t_2
    else if ((c * i) <= 6.4d+120) then
        tmp = t_1
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (a * b) + (x * y);
	double t_2 = (a * b) + (z * t);
	double t_3 = (c * i) + (a * b);
	double tmp;
	if ((c * i) <= -1.6e+103) {
		tmp = t_3;
	} else if ((c * i) <= -1.8e-53) {
		tmp = t_1;
	} else if ((c * i) <= -6.5e-308) {
		tmp = t_2;
	} else if ((c * i) <= 2.6e-223) {
		tmp = t_1;
	} else if ((c * i) <= 2.6e-165) {
		tmp = t_2;
	} else if ((c * i) <= 6.4e+120) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (a * b) + (x * y)
	t_2 = (a * b) + (z * t)
	t_3 = (c * i) + (a * b)
	tmp = 0
	if (c * i) <= -1.6e+103:
		tmp = t_3
	elif (c * i) <= -1.8e-53:
		tmp = t_1
	elif (c * i) <= -6.5e-308:
		tmp = t_2
	elif (c * i) <= 2.6e-223:
		tmp = t_1
	elif (c * i) <= 2.6e-165:
		tmp = t_2
	elif (c * i) <= 6.4e+120:
		tmp = t_1
	else:
		tmp = t_3
	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(z * t))
	t_3 = Float64(Float64(c * i) + Float64(a * b))
	tmp = 0.0
	if (Float64(c * i) <= -1.6e+103)
		tmp = t_3;
	elseif (Float64(c * i) <= -1.8e-53)
		tmp = t_1;
	elseif (Float64(c * i) <= -6.5e-308)
		tmp = t_2;
	elseif (Float64(c * i) <= 2.6e-223)
		tmp = t_1;
	elseif (Float64(c * i) <= 2.6e-165)
		tmp = t_2;
	elseif (Float64(c * i) <= 6.4e+120)
		tmp = t_1;
	else
		tmp = t_3;
	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) + (z * t);
	t_3 = (c * i) + (a * b);
	tmp = 0.0;
	if ((c * i) <= -1.6e+103)
		tmp = t_3;
	elseif ((c * i) <= -1.8e-53)
		tmp = t_1;
	elseif ((c * i) <= -6.5e-308)
		tmp = t_2;
	elseif ((c * i) <= 2.6e-223)
		tmp = t_1;
	elseif ((c * i) <= 2.6e-165)
		tmp = t_2;
	elseif ((c * i) <= 6.4e+120)
		tmp = t_1;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(c * i), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -1.6e+103], t$95$3, If[LessEqual[N[(c * i), $MachinePrecision], -1.8e-53], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], -6.5e-308], t$95$2, If[LessEqual[N[(c * i), $MachinePrecision], 2.6e-223], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], 2.6e-165], t$95$2, If[LessEqual[N[(c * i), $MachinePrecision], 6.4e+120], t$95$1, t$95$3]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;c \cdot i \leq -1.8 \cdot 10^{-53}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;c \cdot i \leq -6.5 \cdot 10^{-308}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;c \cdot i \leq 2.6 \cdot 10^{-165}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;c \cdot i \leq 6.4 \cdot 10^{+120}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 c i) < -1.59999999999999996e103 or 6.39999999999999964e120 < (*.f64 c i)

    1. Initial program 93.8%

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

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

    if -1.59999999999999996e103 < (*.f64 c i) < -1.7999999999999999e-53 or -6.4999999999999999e-308 < (*.f64 c i) < 2.6e-223 or 2.60000000000000007e-165 < (*.f64 c i) < 6.39999999999999964e120

    1. Initial program 98.5%

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

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

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

    if -1.7999999999999999e-53 < (*.f64 c i) < -6.4999999999999999e-308 or 2.6e-223 < (*.f64 c i) < 2.60000000000000007e-165

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\left(a \cdot b + t \cdot z\right)} + c \cdot i \]
    3. Step-by-step derivation
      1. +-commutative91.5%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1.6 \cdot 10^{+103}:\\ \;\;\;\;c \cdot i + a \cdot b\\ \mathbf{elif}\;c \cdot i \leq -1.8 \cdot 10^{-53}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;c \cdot i \leq -6.5 \cdot 10^{-308}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;c \cdot i \leq 2.6 \cdot 10^{-223}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;c \cdot i \leq 2.6 \cdot 10^{-165}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;c \cdot i \leq 6.4 \cdot 10^{+120}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c \cdot i + a \cdot b\\ \end{array} \]

Alternative 9: 65.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot b + z \cdot t\\ t_2 := z \cdot t + x \cdot y\\ \mathbf{if}\;c \cdot i \leq -1.6 \cdot 10^{-10}:\\ \;\;\;\;c \cdot i + x \cdot y\\ \mathbf{elif}\;c \cdot i \leq -5 \cdot 10^{-321}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq 3.5 \cdot 10^{-226}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq 3.65 \cdot 10^{-159}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq 10^{-28}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;c \cdot i \leq 1.25 \cdot 10^{+122}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;c \cdot i + a \cdot b\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* a b) (* z t))) (t_2 (+ (* z t) (* x y))))
   (if (<= (* c i) -1.6e-10)
     (+ (* c i) (* x y))
     (if (<= (* c i) -5e-321)
       t_1
       (if (<= (* c i) 3.5e-226)
         t_2
         (if (<= (* c i) 3.65e-159)
           t_1
           (if (<= (* c i) 1e-28)
             (+ (* a b) (* x y))
             (if (<= (* c i) 1.25e+122) t_2 (+ (* c i) (* a b))))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (a * b) + (z * t);
	double t_2 = (z * t) + (x * y);
	double tmp;
	if ((c * i) <= -1.6e-10) {
		tmp = (c * i) + (x * y);
	} else if ((c * i) <= -5e-321) {
		tmp = t_1;
	} else if ((c * i) <= 3.5e-226) {
		tmp = t_2;
	} else if ((c * i) <= 3.65e-159) {
		tmp = t_1;
	} else if ((c * i) <= 1e-28) {
		tmp = (a * b) + (x * y);
	} else if ((c * i) <= 1.25e+122) {
		tmp = t_2;
	} else {
		tmp = (c * i) + (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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (a * b) + (z * t)
    t_2 = (z * t) + (x * y)
    if ((c * i) <= (-1.6d-10)) then
        tmp = (c * i) + (x * y)
    else if ((c * i) <= (-5d-321)) then
        tmp = t_1
    else if ((c * i) <= 3.5d-226) then
        tmp = t_2
    else if ((c * i) <= 3.65d-159) then
        tmp = t_1
    else if ((c * i) <= 1d-28) then
        tmp = (a * b) + (x * y)
    else if ((c * i) <= 1.25d+122) then
        tmp = t_2
    else
        tmp = (c * i) + (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 t_1 = (a * b) + (z * t);
	double t_2 = (z * t) + (x * y);
	double tmp;
	if ((c * i) <= -1.6e-10) {
		tmp = (c * i) + (x * y);
	} else if ((c * i) <= -5e-321) {
		tmp = t_1;
	} else if ((c * i) <= 3.5e-226) {
		tmp = t_2;
	} else if ((c * i) <= 3.65e-159) {
		tmp = t_1;
	} else if ((c * i) <= 1e-28) {
		tmp = (a * b) + (x * y);
	} else if ((c * i) <= 1.25e+122) {
		tmp = t_2;
	} else {
		tmp = (c * i) + (a * b);
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (a * b) + (z * t)
	t_2 = (z * t) + (x * y)
	tmp = 0
	if (c * i) <= -1.6e-10:
		tmp = (c * i) + (x * y)
	elif (c * i) <= -5e-321:
		tmp = t_1
	elif (c * i) <= 3.5e-226:
		tmp = t_2
	elif (c * i) <= 3.65e-159:
		tmp = t_1
	elif (c * i) <= 1e-28:
		tmp = (a * b) + (x * y)
	elif (c * i) <= 1.25e+122:
		tmp = t_2
	else:
		tmp = (c * i) + (a * b)
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(a * b) + Float64(z * t))
	t_2 = Float64(Float64(z * t) + Float64(x * y))
	tmp = 0.0
	if (Float64(c * i) <= -1.6e-10)
		tmp = Float64(Float64(c * i) + Float64(x * y));
	elseif (Float64(c * i) <= -5e-321)
		tmp = t_1;
	elseif (Float64(c * i) <= 3.5e-226)
		tmp = t_2;
	elseif (Float64(c * i) <= 3.65e-159)
		tmp = t_1;
	elseif (Float64(c * i) <= 1e-28)
		tmp = Float64(Float64(a * b) + Float64(x * y));
	elseif (Float64(c * i) <= 1.25e+122)
		tmp = t_2;
	else
		tmp = Float64(Float64(c * i) + Float64(a * b));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (a * b) + (z * t);
	t_2 = (z * t) + (x * y);
	tmp = 0.0;
	if ((c * i) <= -1.6e-10)
		tmp = (c * i) + (x * y);
	elseif ((c * i) <= -5e-321)
		tmp = t_1;
	elseif ((c * i) <= 3.5e-226)
		tmp = t_2;
	elseif ((c * i) <= 3.65e-159)
		tmp = t_1;
	elseif ((c * i) <= 1e-28)
		tmp = (a * b) + (x * y);
	elseif ((c * i) <= 1.25e+122)
		tmp = t_2;
	else
		tmp = (c * i) + (a * b);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -1.6e-10], N[(N[(c * i), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -5e-321], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], 3.5e-226], t$95$2, If[LessEqual[N[(c * i), $MachinePrecision], 3.65e-159], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], 1e-28], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 1.25e+122], t$95$2, N[(N[(c * i), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;c \cdot i \leq -5 \cdot 10^{-321}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;c \cdot i \leq 3.5 \cdot 10^{-226}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;c \cdot i \leq 3.65 \cdot 10^{-159}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;c \cdot i \leq 1.25 \cdot 10^{+122}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if (*.f64 c i) < -1.5999999999999999e-10

    1. Initial program 98.4%

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

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

    if -1.5999999999999999e-10 < (*.f64 c i) < -4.99994e-321 or 3.5e-226 < (*.f64 c i) < 3.6499999999999998e-159

    1. Initial program 97.9%

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

      \[\leadsto \color{blue}{\left(a \cdot b + t \cdot z\right)} + c \cdot i \]
    3. Step-by-step derivation
      1. +-commutative86.0%

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

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

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

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

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

    if -4.99994e-321 < (*.f64 c i) < 3.5e-226 or 9.99999999999999971e-29 < (*.f64 c i) < 1.24999999999999997e122

    1. Initial program 99.9%

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

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

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

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

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

    if 3.6499999999999998e-159 < (*.f64 c i) < 9.99999999999999971e-29

    1. Initial program 96.8%

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

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

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

    if 1.24999999999999997e122 < (*.f64 c i)

    1. Initial program 90.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1.6 \cdot 10^{-10}:\\ \;\;\;\;c \cdot i + x \cdot y\\ \mathbf{elif}\;c \cdot i \leq -5 \cdot 10^{-321}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;c \cdot i \leq 3.5 \cdot 10^{-226}:\\ \;\;\;\;z \cdot t + x \cdot y\\ \mathbf{elif}\;c \cdot i \leq 3.65 \cdot 10^{-159}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;c \cdot i \leq 10^{-28}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;c \cdot i \leq 1.25 \cdot 10^{+122}:\\ \;\;\;\;z \cdot t + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c \cdot i + a \cdot b\\ \end{array} \]

Alternative 10: 97.5% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 100.0%

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

    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. associate-+l+0.0%

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

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

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

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

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

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

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

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

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

Alternative 11: 42.6% accurate, 0.6× speedup?

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

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

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

\mathbf{elif}\;c \cdot i \leq 1.45 \cdot 10^{-179}:\\
\;\;\;\;z \cdot t\\

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

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

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


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

    1. Initial program 95.3%

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

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

    if -1.1499999999999999e25 < (*.f64 c i) < -4.99999999999999963e-77 or 1.4499999999999999e-179 < (*.f64 c i) < 9.4999999999999994e-22

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

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

      \[\leadsto \color{blue}{c \cdot i + a \cdot b} \]
    4. Taylor expanded in c around 0 50.4%

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

    if -4.99999999999999963e-77 < (*.f64 c i) < 1.4499999999999999e-179 or 9.4999999999999994e-22 < (*.f64 c i) < 1.3499999999999999e69

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{\left(a \cdot b + t \cdot z\right)} + c \cdot i \]
    3. Step-by-step derivation
      1. +-commutative62.8%

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b + t \cdot z} \]
    6. Step-by-step derivation
      1. +-commutative58.3%

        \[\leadsto \color{blue}{t \cdot z + a \cdot b} \]
      2. fma-udef58.4%

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, z, a \cdot b\right)} \]
    7. Simplified58.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(t, z, a \cdot b\right)} \]
    8. Taylor expanded in t around inf 38.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1.15 \cdot 10^{+25}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -5 \cdot 10^{-77}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq 1.45 \cdot 10^{-179}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \cdot i \leq 9.5 \cdot 10^{-22}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq 1.35 \cdot 10^{+69}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]

Alternative 12: 76.5% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;y \leq 6.4 \cdot 10^{+77}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 2.6 \cdot 10^{+114}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;y \leq 4.7 \cdot 10^{+222}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3 or 6.4000000000000003e77 < y < 2.6e114

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

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

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

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

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

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

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

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

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

    if -3 < y < 6.4000000000000003e77 or 2.6e114 < y < 4.6999999999999999e222

    1. Initial program 98.1%

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

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

    if 4.6999999999999999e222 < y

    1. Initial program 95.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3:\\ \;\;\;\;z \cdot t + x \cdot y\\ \mathbf{elif}\;y \leq 6.4 \cdot 10^{+77}:\\ \;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{+114}:\\ \;\;\;\;z \cdot t + x \cdot y\\ \mathbf{elif}\;y \leq 4.7 \cdot 10^{+222}:\\ \;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \end{array} \]

Alternative 13: 77.7% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot t + x \cdot y\\ \mathbf{if}\;z \leq -2.9 \cdot 10^{+233}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -5.8 \cdot 10^{+204}:\\ \;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\ \mathbf{elif}\;z \leq -2.5 \cdot 10^{+125}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1700000000000:\\ \;\;\;\;c \cdot i + \left(a \cdot b + x \cdot y\right)\\ \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 (+ (* z t) (* x y))))
   (if (<= z -2.9e+233)
     t_1
     (if (<= z -5.8e+204)
       (+ (* c i) (+ (* a b) (* z t)))
       (if (<= z -2.5e+125)
         t_1
         (if (<= z 1700000000000.0)
           (+ (* c i) (+ (* a b) (* x y)))
           (+ (* 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 = (z * t) + (x * y);
	double tmp;
	if (z <= -2.9e+233) {
		tmp = t_1;
	} else if (z <= -5.8e+204) {
		tmp = (c * i) + ((a * b) + (z * t));
	} else if (z <= -2.5e+125) {
		tmp = t_1;
	} else if (z <= 1700000000000.0) {
		tmp = (c * i) + ((a * b) + (x * y));
	} else {
		tmp = (c * i) + (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 = (z * t) + (x * y)
    if (z <= (-2.9d+233)) then
        tmp = t_1
    else if (z <= (-5.8d+204)) then
        tmp = (c * i) + ((a * b) + (z * t))
    else if (z <= (-2.5d+125)) then
        tmp = t_1
    else if (z <= 1700000000000.0d0) then
        tmp = (c * i) + ((a * b) + (x * y))
    else
        tmp = (c * i) + (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 = (z * t) + (x * y);
	double tmp;
	if (z <= -2.9e+233) {
		tmp = t_1;
	} else if (z <= -5.8e+204) {
		tmp = (c * i) + ((a * b) + (z * t));
	} else if (z <= -2.5e+125) {
		tmp = t_1;
	} else if (z <= 1700000000000.0) {
		tmp = (c * i) + ((a * b) + (x * y));
	} else {
		tmp = (c * i) + (z * t);
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (z * t) + (x * y)
	tmp = 0
	if z <= -2.9e+233:
		tmp = t_1
	elif z <= -5.8e+204:
		tmp = (c * i) + ((a * b) + (z * t))
	elif z <= -2.5e+125:
		tmp = t_1
	elif z <= 1700000000000.0:
		tmp = (c * i) + ((a * b) + (x * y))
	else:
		tmp = (c * i) + (z * t)
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(z * t) + Float64(x * y))
	tmp = 0.0
	if (z <= -2.9e+233)
		tmp = t_1;
	elseif (z <= -5.8e+204)
		tmp = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(z * t)));
	elseif (z <= -2.5e+125)
		tmp = t_1;
	elseif (z <= 1700000000000.0)
		tmp = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(x * y)));
	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 = (z * t) + (x * y);
	tmp = 0.0;
	if (z <= -2.9e+233)
		tmp = t_1;
	elseif (z <= -5.8e+204)
		tmp = (c * i) + ((a * b) + (z * t));
	elseif (z <= -2.5e+125)
		tmp = t_1;
	elseif (z <= 1700000000000.0)
		tmp = (c * i) + ((a * b) + (x * y));
	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[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.9e+233], t$95$1, If[LessEqual[z, -5.8e+204], N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.5e+125], t$95$1, If[LessEqual[z, 1700000000000.0], N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := z \cdot t + x \cdot y\\
\mathbf{if}\;z \leq -2.9 \cdot 10^{+233}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;z \leq -2.5 \cdot 10^{+125}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 1700000000000:\\
\;\;\;\;c \cdot i + \left(a \cdot b + x \cdot y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -2.90000000000000012e233 or -5.80000000000000007e204 < z < -2.49999999999999981e125

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

    if -2.90000000000000012e233 < z < -5.80000000000000007e204

    1. Initial program 100.0%

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

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

    if -2.49999999999999981e125 < z < 1.7e12

    1. Initial program 98.1%

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

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

    if 1.7e12 < z

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.9 \cdot 10^{+233}:\\ \;\;\;\;z \cdot t + x \cdot y\\ \mathbf{elif}\;z \leq -5.8 \cdot 10^{+204}:\\ \;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\ \mathbf{elif}\;z \leq -2.5 \cdot 10^{+125}:\\ \;\;\;\;z \cdot t + x \cdot y\\ \mathbf{elif}\;z \leq 1700000000000:\\ \;\;\;\;c \cdot i + \left(a \cdot b + x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \end{array} \]

Alternative 14: 88.1% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -6.2 \cdot 10^{+100} \lor \neg \left(a \cdot b \leq 2.8 \cdot 10^{+137}\right):\\
\;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -6.20000000000000014e100 or 2.80000000000000001e137 < (*.f64 a b)

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

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

    if -6.20000000000000014e100 < (*.f64 a b) < 2.80000000000000001e137

    1. Initial program 98.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -6.2 \cdot 10^{+100} \lor \neg \left(a \cdot b \leq 2.8 \cdot 10^{+137}\right):\\ \;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;c \cdot i + \left(z \cdot t + x \cdot y\right)\\ \end{array} \]

Alternative 15: 52.5% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;y \leq 1.1 \cdot 10^{+51}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 6.5 \cdot 10^{+125}:\\
\;\;\;\;z \cdot t\\

\mathbf{elif}\;y \leq 1.9 \cdot 10^{+223}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -0.48999999999999999 or 1.9e223 < y

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

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

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

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

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

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

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

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

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

    if -0.48999999999999999 < y < 1.09999999999999996e51 or 6.4999999999999999e125 < y < 1.9e223

    1. Initial program 98.6%

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

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

    if 1.09999999999999996e51 < y < 6.4999999999999999e125

    1. Initial program 93.3%

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

      \[\leadsto \color{blue}{\left(a \cdot b + t \cdot z\right)} + c \cdot i \]
    3. Step-by-step derivation
      1. +-commutative62.7%

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b + t \cdot z} \]
    6. Step-by-step derivation
      1. +-commutative49.3%

        \[\leadsto \color{blue}{t \cdot z + a \cdot b} \]
      2. fma-udef49.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, z, a \cdot b\right)} \]
    7. Simplified49.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(t, z, a \cdot b\right)} \]
    8. Taylor expanded in t around inf 42.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -0.49:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{+51}:\\ \;\;\;\;c \cdot i + a \cdot b\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{+125}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{+223}:\\ \;\;\;\;c \cdot i + a \cdot b\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]

Alternative 16: 58.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot b + x \cdot y\\ \mathbf{if}\;y \leq -9 \cdot 10^{-105}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 8 \cdot 10^{-224}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;y \leq 0.0185:\\ \;\;\;\;c \cdot i + a \cdot b\\ \mathbf{elif}\;y \leq 2.25 \cdot 10^{+223}:\\ \;\;\;\;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) (* x y))))
   (if (<= y -9e-105)
     t_1
     (if (<= y 8e-224)
       (+ (* a b) (* z t))
       (if (<= y 0.0185)
         (+ (* c i) (* a b))
         (if (<= y 2.25e+223) (+ (* 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) + (x * y);
	double tmp;
	if (y <= -9e-105) {
		tmp = t_1;
	} else if (y <= 8e-224) {
		tmp = (a * b) + (z * t);
	} else if (y <= 0.0185) {
		tmp = (c * i) + (a * b);
	} else if (y <= 2.25e+223) {
		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) + (x * y)
    if (y <= (-9d-105)) then
        tmp = t_1
    else if (y <= 8d-224) then
        tmp = (a * b) + (z * t)
    else if (y <= 0.0185d0) then
        tmp = (c * i) + (a * b)
    else if (y <= 2.25d+223) 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) + (x * y);
	double tmp;
	if (y <= -9e-105) {
		tmp = t_1;
	} else if (y <= 8e-224) {
		tmp = (a * b) + (z * t);
	} else if (y <= 0.0185) {
		tmp = (c * i) + (a * b);
	} else if (y <= 2.25e+223) {
		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) + (x * y)
	tmp = 0
	if y <= -9e-105:
		tmp = t_1
	elif y <= 8e-224:
		tmp = (a * b) + (z * t)
	elif y <= 0.0185:
		tmp = (c * i) + (a * b)
	elif y <= 2.25e+223:
		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(x * y))
	tmp = 0.0
	if (y <= -9e-105)
		tmp = t_1;
	elseif (y <= 8e-224)
		tmp = Float64(Float64(a * b) + Float64(z * t));
	elseif (y <= 0.0185)
		tmp = Float64(Float64(c * i) + Float64(a * b));
	elseif (y <= 2.25e+223)
		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) + (x * y);
	tmp = 0.0;
	if (y <= -9e-105)
		tmp = t_1;
	elseif (y <= 8e-224)
		tmp = (a * b) + (z * t);
	elseif (y <= 0.0185)
		tmp = (c * i) + (a * b);
	elseif (y <= 2.25e+223)
		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[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9e-105], t$95$1, If[LessEqual[y, 8e-224], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.0185], N[(N[(c * i), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.25e+223], N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := a \cdot b + x \cdot y\\
\mathbf{if}\;y \leq -9 \cdot 10^{-105}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 8 \cdot 10^{-224}:\\
\;\;\;\;a \cdot b + z \cdot t\\

\mathbf{elif}\;y \leq 0.0185:\\
\;\;\;\;c \cdot i + a \cdot b\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -8.9999999999999995e-105 or 2.25e223 < y

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

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

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

    if -8.9999999999999995e-105 < y < 8.0000000000000002e-224

    1. Initial program 98.0%

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

      \[\leadsto \color{blue}{\left(a \cdot b + t \cdot z\right)} + c \cdot i \]
    3. Step-by-step derivation
      1. +-commutative92.6%

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

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

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

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

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

    if 8.0000000000000002e-224 < y < 0.0184999999999999991

    1. Initial program 100.0%

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

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

    if 0.0184999999999999991 < y < 2.25e223

    1. Initial program 95.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9 \cdot 10^{-105}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;y \leq 8 \cdot 10^{-224}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;y \leq 0.0185:\\ \;\;\;\;c \cdot i + a \cdot b\\ \mathbf{elif}\;y \leq 2.25 \cdot 10^{+223}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \end{array} \]

Alternative 17: 57.9% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.85 \cdot 10^{-88}:\\
\;\;\;\;c \cdot i + x \cdot y\\

\mathbf{elif}\;y \leq 3.2 \cdot 10^{-225}:\\
\;\;\;\;a \cdot b + z \cdot t\\

\mathbf{elif}\;y \leq 0.000106:\\
\;\;\;\;c \cdot i + a \cdot b\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -1.8499999999999999e-88

    1. Initial program 96.4%

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

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

    if -1.8499999999999999e-88 < y < 3.19999999999999975e-225

    1. Initial program 98.2%

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

      \[\leadsto \color{blue}{\left(a \cdot b + t \cdot z\right)} + c \cdot i \]
    3. Step-by-step derivation
      1. +-commutative91.7%

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

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

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

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

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

    if 3.19999999999999975e-225 < y < 1.06e-4

    1. Initial program 100.0%

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

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

    if 1.06e-4 < y < 4.6999999999999999e222

    1. Initial program 95.5%

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

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

    if 4.6999999999999999e222 < y

    1. Initial program 95.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.85 \cdot 10^{-88}:\\ \;\;\;\;c \cdot i + x \cdot y\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{-225}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;y \leq 0.000106:\\ \;\;\;\;c \cdot i + a \cdot b\\ \mathbf{elif}\;y \leq 4.7 \cdot 10^{+222}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \end{array} \]

Alternative 18: 53.9% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;y \leq 1.9 \cdot 10^{+33}:\\
\;\;\;\;c \cdot i + a \cdot b\\

\mathbf{elif}\;y \leq 4.8 \cdot 10^{+222}:\\
\;\;\;\;a \cdot b + z \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4.79999999999999982 or 4.8000000000000002e222 < y

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

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

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

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

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

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

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

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

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

    if -4.79999999999999982 < y < 1.90000000000000001e33

    1. Initial program 99.2%

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

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

    if 1.90000000000000001e33 < y < 4.8000000000000002e222

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

      \[\leadsto \color{blue}{\left(a \cdot b + t \cdot z\right)} + c \cdot i \]
    3. Step-by-step derivation
      1. +-commutative74.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.8:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{+33}:\\ \;\;\;\;c \cdot i + a \cdot b\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{+222}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]

Alternative 19: 42.0% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c i) < -2.5999999999999998e25 or 6.0000000000000005e126 < (*.f64 c i)

    1. Initial program 94.6%

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

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

    if -2.5999999999999998e25 < (*.f64 c i) < 6.0000000000000005e126

    1. Initial program 98.7%

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

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

      \[\leadsto \color{blue}{c \cdot i + a \cdot b} \]
    4. Taylor expanded in c around 0 33.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -2.6 \cdot 10^{+25}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq 6 \cdot 10^{+126}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]

Alternative 20: 27.5% accurate, 5.0× speedup?

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

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

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

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

    \[\leadsto \color{blue}{c \cdot i + a \cdot b} \]
  4. Taylor expanded in c around 0 25.0%

    \[\leadsto \color{blue}{a \cdot b} \]
  5. Final simplification25.0%

    \[\leadsto a \cdot b \]

Reproduce

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