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

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

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

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


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

    1. Initial program 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-def99.2%

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

      \[\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 3: 42.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.85 \cdot 10^{+152}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -7.8 \cdot 10^{+86}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq -1.76 \cdot 10^{+55}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -1.05 \cdot 10^{-78}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -1.4 \cdot 10^{-248}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 2.4 \cdot 10^{-293}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 9.8 \cdot 10^{-73}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 6.2 \cdot 10^{+82}:\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= (* a b) -1.85e+152)
   (* a b)
   (if (<= (* a b) -7.8e+86)
     (* z t)
     (if (<= (* a b) -1.76e+55)
       (* a b)
       (if (<= (* a b) -1.05e-78)
         (* c i)
         (if (<= (* a b) -1.4e-248)
           (* z t)
           (if (<= (* a b) 2.4e-293)
             (* c i)
             (if (<= (* a b) 9.8e-73)
               (* z t)
               (if (<= (* a b) 6.2e+82) (* c i) (* a b))))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((a * b) <= -1.85e+152) {
		tmp = a * b;
	} else if ((a * b) <= -7.8e+86) {
		tmp = z * t;
	} else if ((a * b) <= -1.76e+55) {
		tmp = a * b;
	} else if ((a * b) <= -1.05e-78) {
		tmp = c * i;
	} else if ((a * b) <= -1.4e-248) {
		tmp = z * t;
	} else if ((a * b) <= 2.4e-293) {
		tmp = c * i;
	} else if ((a * b) <= 9.8e-73) {
		tmp = z * t;
	} else if ((a * b) <= 6.2e+82) {
		tmp = c * i;
	} else {
		tmp = a * b;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: tmp
    if ((a * b) <= (-1.85d+152)) then
        tmp = a * b
    else if ((a * b) <= (-7.8d+86)) then
        tmp = z * t
    else if ((a * b) <= (-1.76d+55)) then
        tmp = a * b
    else if ((a * b) <= (-1.05d-78)) then
        tmp = c * i
    else if ((a * b) <= (-1.4d-248)) then
        tmp = z * t
    else if ((a * b) <= 2.4d-293) then
        tmp = c * i
    else if ((a * b) <= 9.8d-73) then
        tmp = z * t
    else if ((a * b) <= 6.2d+82) then
        tmp = c * i
    else
        tmp = a * b
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((a * b) <= -1.85e+152) {
		tmp = a * b;
	} else if ((a * b) <= -7.8e+86) {
		tmp = z * t;
	} else if ((a * b) <= -1.76e+55) {
		tmp = a * b;
	} else if ((a * b) <= -1.05e-78) {
		tmp = c * i;
	} else if ((a * b) <= -1.4e-248) {
		tmp = z * t;
	} else if ((a * b) <= 2.4e-293) {
		tmp = c * i;
	} else if ((a * b) <= 9.8e-73) {
		tmp = z * t;
	} else if ((a * b) <= 6.2e+82) {
		tmp = c * i;
	} else {
		tmp = a * b;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (a * b) <= -1.85e+152:
		tmp = a * b
	elif (a * b) <= -7.8e+86:
		tmp = z * t
	elif (a * b) <= -1.76e+55:
		tmp = a * b
	elif (a * b) <= -1.05e-78:
		tmp = c * i
	elif (a * b) <= -1.4e-248:
		tmp = z * t
	elif (a * b) <= 2.4e-293:
		tmp = c * i
	elif (a * b) <= 9.8e-73:
		tmp = z * t
	elif (a * b) <= 6.2e+82:
		tmp = c * i
	else:
		tmp = a * b
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (Float64(a * b) <= -1.85e+152)
		tmp = Float64(a * b);
	elseif (Float64(a * b) <= -7.8e+86)
		tmp = Float64(z * t);
	elseif (Float64(a * b) <= -1.76e+55)
		tmp = Float64(a * b);
	elseif (Float64(a * b) <= -1.05e-78)
		tmp = Float64(c * i);
	elseif (Float64(a * b) <= -1.4e-248)
		tmp = Float64(z * t);
	elseif (Float64(a * b) <= 2.4e-293)
		tmp = Float64(c * i);
	elseif (Float64(a * b) <= 9.8e-73)
		tmp = Float64(z * t);
	elseif (Float64(a * b) <= 6.2e+82)
		tmp = Float64(c * i);
	else
		tmp = Float64(a * b);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if ((a * b) <= -1.85e+152)
		tmp = a * b;
	elseif ((a * b) <= -7.8e+86)
		tmp = z * t;
	elseif ((a * b) <= -1.76e+55)
		tmp = a * b;
	elseif ((a * b) <= -1.05e-78)
		tmp = c * i;
	elseif ((a * b) <= -1.4e-248)
		tmp = z * t;
	elseif ((a * b) <= 2.4e-293)
		tmp = c * i;
	elseif ((a * b) <= 9.8e-73)
		tmp = z * t;
	elseif ((a * b) <= 6.2e+82)
		tmp = c * i;
	else
		tmp = a * b;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -1.85e+152], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -7.8e+86], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -1.76e+55], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -1.05e-78], N[(c * i), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -1.4e-248], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2.4e-293], N[(c * i), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 9.8e-73], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 6.2e+82], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;a \cdot b \leq -7.8 \cdot 10^{+86}:\\
\;\;\;\;z \cdot t\\

\mathbf{elif}\;a \cdot b \leq -1.76 \cdot 10^{+55}:\\
\;\;\;\;a \cdot b\\

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -1.84999999999999998e152 or -7.8000000000000004e86 < (*.f64 a b) < -1.75999999999999992e55 or 6.20000000000000065e82 < (*.f64 a b)

    1. Initial program 90.6%

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

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

    if -1.84999999999999998e152 < (*.f64 a b) < -7.8000000000000004e86 or -1.05e-78 < (*.f64 a b) < -1.40000000000000005e-248 or 2.3999999999999999e-293 < (*.f64 a b) < 9.80000000000000057e-73

    1. Initial program 95.6%

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

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

    if -1.75999999999999992e55 < (*.f64 a b) < -1.05e-78 or -1.40000000000000005e-248 < (*.f64 a b) < 2.3999999999999999e-293 or 9.80000000000000057e-73 < (*.f64 a b) < 6.20000000000000065e82

    1. Initial program 98.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.85 \cdot 10^{+152}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -7.8 \cdot 10^{+86}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq -1.76 \cdot 10^{+55}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -1.05 \cdot 10^{-78}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -1.4 \cdot 10^{-248}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 2.4 \cdot 10^{-293}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 9.8 \cdot 10^{-73}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 6.2 \cdot 10^{+82}:\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]

Alternative 4: 42.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.25 \cdot 10^{+152}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -9.2 \cdot 10^{+82}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq -2.7 \cdot 10^{+56}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -4.6 \cdot 10^{-96}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -7 \cdot 10^{-221}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 2.9 \cdot 10^{-291}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 8 \cdot 10^{-69}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.4 \cdot 10^{+84}:\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= (* a b) -1.25e+152)
   (* a b)
   (if (<= (* a b) -9.2e+82)
     (* z t)
     (if (<= (* a b) -2.7e+56)
       (* a b)
       (if (<= (* a b) -4.6e-96)
         (* c i)
         (if (<= (* a b) -7e-221)
           (* x y)
           (if (<= (* a b) 2.9e-291)
             (* c i)
             (if (<= (* a b) 8e-69)
               (* z t)
               (if (<= (* a b) 1.4e+84) (* c i) (* a b))))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((a * b) <= -1.25e+152) {
		tmp = a * b;
	} else if ((a * b) <= -9.2e+82) {
		tmp = z * t;
	} else if ((a * b) <= -2.7e+56) {
		tmp = a * b;
	} else if ((a * b) <= -4.6e-96) {
		tmp = c * i;
	} else if ((a * b) <= -7e-221) {
		tmp = x * y;
	} else if ((a * b) <= 2.9e-291) {
		tmp = c * i;
	} else if ((a * b) <= 8e-69) {
		tmp = z * t;
	} else if ((a * b) <= 1.4e+84) {
		tmp = c * i;
	} else {
		tmp = a * b;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: tmp
    if ((a * b) <= (-1.25d+152)) then
        tmp = a * b
    else if ((a * b) <= (-9.2d+82)) then
        tmp = z * t
    else if ((a * b) <= (-2.7d+56)) then
        tmp = a * b
    else if ((a * b) <= (-4.6d-96)) then
        tmp = c * i
    else if ((a * b) <= (-7d-221)) then
        tmp = x * y
    else if ((a * b) <= 2.9d-291) then
        tmp = c * i
    else if ((a * b) <= 8d-69) then
        tmp = z * t
    else if ((a * b) <= 1.4d+84) then
        tmp = c * i
    else
        tmp = a * b
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((a * b) <= -1.25e+152) {
		tmp = a * b;
	} else if ((a * b) <= -9.2e+82) {
		tmp = z * t;
	} else if ((a * b) <= -2.7e+56) {
		tmp = a * b;
	} else if ((a * b) <= -4.6e-96) {
		tmp = c * i;
	} else if ((a * b) <= -7e-221) {
		tmp = x * y;
	} else if ((a * b) <= 2.9e-291) {
		tmp = c * i;
	} else if ((a * b) <= 8e-69) {
		tmp = z * t;
	} else if ((a * b) <= 1.4e+84) {
		tmp = c * i;
	} else {
		tmp = a * b;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (a * b) <= -1.25e+152:
		tmp = a * b
	elif (a * b) <= -9.2e+82:
		tmp = z * t
	elif (a * b) <= -2.7e+56:
		tmp = a * b
	elif (a * b) <= -4.6e-96:
		tmp = c * i
	elif (a * b) <= -7e-221:
		tmp = x * y
	elif (a * b) <= 2.9e-291:
		tmp = c * i
	elif (a * b) <= 8e-69:
		tmp = z * t
	elif (a * b) <= 1.4e+84:
		tmp = c * i
	else:
		tmp = a * b
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (Float64(a * b) <= -1.25e+152)
		tmp = Float64(a * b);
	elseif (Float64(a * b) <= -9.2e+82)
		tmp = Float64(z * t);
	elseif (Float64(a * b) <= -2.7e+56)
		tmp = Float64(a * b);
	elseif (Float64(a * b) <= -4.6e-96)
		tmp = Float64(c * i);
	elseif (Float64(a * b) <= -7e-221)
		tmp = Float64(x * y);
	elseif (Float64(a * b) <= 2.9e-291)
		tmp = Float64(c * i);
	elseif (Float64(a * b) <= 8e-69)
		tmp = Float64(z * t);
	elseif (Float64(a * b) <= 1.4e+84)
		tmp = Float64(c * i);
	else
		tmp = Float64(a * b);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if ((a * b) <= -1.25e+152)
		tmp = a * b;
	elseif ((a * b) <= -9.2e+82)
		tmp = z * t;
	elseif ((a * b) <= -2.7e+56)
		tmp = a * b;
	elseif ((a * b) <= -4.6e-96)
		tmp = c * i;
	elseif ((a * b) <= -7e-221)
		tmp = x * y;
	elseif ((a * b) <= 2.9e-291)
		tmp = c * i;
	elseif ((a * b) <= 8e-69)
		tmp = z * t;
	elseif ((a * b) <= 1.4e+84)
		tmp = c * i;
	else
		tmp = a * b;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -1.25e+152], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -9.2e+82], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -2.7e+56], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -4.6e-96], N[(c * i), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -7e-221], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2.9e-291], N[(c * i), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 8e-69], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.4e+84], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;a \cdot b \leq -9.2 \cdot 10^{+82}:\\
\;\;\;\;z \cdot t\\

\mathbf{elif}\;a \cdot b \leq -2.7 \cdot 10^{+56}:\\
\;\;\;\;a \cdot b\\

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 a b) < -1.25e152 or -9.19999999999999953e82 < (*.f64 a b) < -2.7000000000000001e56 or 1.39999999999999991e84 < (*.f64 a b)

    1. Initial program 90.6%

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

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

    if -1.25e152 < (*.f64 a b) < -9.19999999999999953e82 or 2.90000000000000002e-291 < (*.f64 a b) < 7.9999999999999997e-69

    1. Initial program 95.4%

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

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

    if -2.7000000000000001e56 < (*.f64 a b) < -4.6e-96 or -6.9999999999999998e-221 < (*.f64 a b) < 2.90000000000000002e-291 or 7.9999999999999997e-69 < (*.f64 a b) < 1.39999999999999991e84

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

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

    if -4.6e-96 < (*.f64 a b) < -6.9999999999999998e-221

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.25 \cdot 10^{+152}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -9.2 \cdot 10^{+82}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq -2.7 \cdot 10^{+56}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -4.6 \cdot 10^{-96}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -7 \cdot 10^{-221}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 2.9 \cdot 10^{-291}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 8 \cdot 10^{-69}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.4 \cdot 10^{+84}:\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]

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


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

    1. Initial program 100.0%

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\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}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \end{array} \]

Alternative 6: 84.3% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;c \cdot i \leq 9 \cdot 10^{+105}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;c \cdot i \leq 4 \cdot 10^{+171}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;c \cdot i \leq 5.2 \cdot 10^{+245}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 c i) < -2.25000000000000012e77 or 9.0000000000000002e105 < (*.f64 c i) < 3.99999999999999982e171

    1. Initial program 86.4%

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

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

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

    if -2.25000000000000012e77 < (*.f64 c i) < 9.0000000000000002e105 or 3.99999999999999982e171 < (*.f64 c i) < 5.20000000000000008e245

    1. Initial program 98.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.20000000000000008e245 < (*.f64 c i)

    1. Initial program 88.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -2.25 \cdot 10^{+77}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;c \cdot i \leq 9 \cdot 10^{+105}:\\ \;\;\;\;a \cdot b + \left(z \cdot t + x \cdot y\right)\\ \mathbf{elif}\;c \cdot i \leq 4 \cdot 10^{+171}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;c \cdot i \leq 5.2 \cdot 10^{+245}:\\ \;\;\;\;a \cdot b + \left(z \cdot t + x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot t + c \cdot i\\ \end{array} \]

Alternative 7: 66.1% accurate, 0.8× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 c i) < -4.9000000000000004e37 or 4.5000000000000003e68 < (*.f64 c i)

    1. Initial program 90.1%

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

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

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

    if -4.9000000000000004e37 < (*.f64 c i) < -1.44999999999999994e-283

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.44999999999999994e-283 < (*.f64 c i) < 4.5000000000000003e68

    1. Initial program 98.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -4.9 \cdot 10^{+37}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -1.45 \cdot 10^{-283}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;c \cdot i \leq 4.5 \cdot 10^{+68}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \end{array} \]

Alternative 8: 88.2% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -2.1 \cdot 10^{+21} \lor \neg \left(c \cdot i \leq 6 \cdot 10^{+69}\right):\\
\;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c i) < -2.1e21 or 5.99999999999999967e69 < (*.f64 c i)

    1. Initial program 90.4%

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

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

    if -2.1e21 < (*.f64 c i) < 5.99999999999999967e69

    1. Initial program 98.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 88.6% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 86.7%

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

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

    if -6.29999999999999969e35 < (*.f64 c i) < 1.84999999999999994e70

    1. Initial program 98.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.84999999999999994e70 < (*.f64 c i)

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

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

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

Alternative 10: 59.9% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;a \leq -1.96 \cdot 10^{+90} \lor \neg \left(a \leq 8 \cdot 10^{-136}\right):\\
\;\;\;\;a \cdot b + x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if a < -5.6000000000000005e157

    1. Initial program 93.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.6000000000000005e157 < a < -3.0999999999999998e96

    1. Initial program 75.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+75.0%

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

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

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

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

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

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

    if -3.0999999999999998e96 < a < -1.95999999999999998e90 or 8.00000000000000001e-136 < a

    1. Initial program 96.2%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.95999999999999998e90 < a < 8.00000000000000001e-136

    1. Initial program 96.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -5.6 \cdot 10^{+157}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;a \leq -3.1 \cdot 10^{+96}:\\ \;\;\;\;c \cdot i + x \cdot y\\ \mathbf{elif}\;a \leq -1.96 \cdot 10^{+90} \lor \neg \left(a \leq 8 \cdot 10^{-136}\right):\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;z \cdot t + c \cdot i\\ \end{array} \]

Alternative 11: 60.0% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{+145} \lor \neg \left(x \leq 3.15 \cdot 10^{-161}\right):\\
\;\;\;\;a \cdot b + x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.09999999999999988e145 or 3.1500000000000001e-161 < x

    1. Initial program 93.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.09999999999999988e145 < x < 3.1500000000000001e-161

    1. Initial program 96.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.1 \cdot 10^{+145} \lor \neg \left(x \leq 3.15 \cdot 10^{-161}\right):\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \end{array} \]

Alternative 12: 42.8% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -1.14999999999999994e55 or 2.19999999999999999e83 < (*.f64 a b)

    1. Initial program 91.7%

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

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

    if -1.14999999999999994e55 < (*.f64 a b) < 2.19999999999999999e83

    1. Initial program 97.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.15 \cdot 10^{+55}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq 2.2 \cdot 10^{+83}:\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]

Alternative 13: 54.3% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.55 \cdot 10^{-8}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq 1.05 \cdot 10^{+179}:\\ \;\;\;\;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 -2.55e-8)
   (* x y)
   (if (<= y 1.05e+179) (+ (* 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 <= -2.55e-8) {
		tmp = x * y;
	} else if (y <= 1.05e+179) {
		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 <= (-2.55d-8)) then
        tmp = x * y
    else if (y <= 1.05d+179) 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 <= -2.55e-8) {
		tmp = x * y;
	} else if (y <= 1.05e+179) {
		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 <= -2.55e-8:
		tmp = x * y
	elif y <= 1.05e+179:
		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 <= -2.55e-8)
		tmp = Float64(x * y);
	elseif (y <= 1.05e+179)
		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 <= -2.55e-8)
		tmp = x * y;
	elseif (y <= 1.05e+179)
		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, -2.55e-8], N[(x * y), $MachinePrecision], If[LessEqual[y, 1.05e+179], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.55 \cdot 10^{-8}:\\
\;\;\;\;x \cdot y\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.55e-8 or 1.0499999999999999e179 < y

    1. Initial program 92.4%

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

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

    if -2.55e-8 < y < 1.0499999999999999e179

    1. Initial program 96.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.55 \cdot 10^{-8}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq 1.05 \cdot 10^{+179}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]

Alternative 14: 60.6% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.4 \cdot 10^{+91}:\\
\;\;\;\;a \cdot b + z \cdot t\\

\mathbf{elif}\;a \leq 3.2 \cdot 10^{-137}:\\
\;\;\;\;z \cdot t + c \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -1.3999999999999999e91

    1. Initial program 90.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.3999999999999999e91 < a < 3.20000000000000021e-137

    1. Initial program 96.0%

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

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

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

    if 3.20000000000000021e-137 < a

    1. Initial program 96.1%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.4 \cdot 10^{+91}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;a \leq 3.2 \cdot 10^{-137}:\\ \;\;\;\;z \cdot t + c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \end{array} \]

Alternative 15: 28.6% accurate, 5.0× speedup?

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

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

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

    \[\leadsto \color{blue}{a \cdot b} \]
  3. Final simplification31.2%

    \[\leadsto a \cdot b \]

Reproduce

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