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

Percentage Accurate: 95.7% → 97.9%
Time: 11.0s
Alternatives: 17
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 17 alternatives:

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

Initial Program: 95.7% 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.0× speedup?

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

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

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

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

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

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

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

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

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

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

Alternative 2: 97.5% accurate, 0.1× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

    1. Initial program 0.0%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(c, i, t \cdot z\right)} \]
    6. Simplified62.5%

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

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

Alternative 3: 96.8% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 66.5% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot b + c \cdot i\\ t_2 := a \cdot b + z \cdot t\\ t_3 := a \cdot b + x \cdot y\\ \mathbf{if}\;x \cdot y \leq -2.8 \cdot 10^{+84}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \cdot y \leq -4.45 \cdot 10^{-231}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot y \leq -1.2 \cdot 10^{-298}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot y \leq 7.5 \cdot 10^{-167}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot y \leq 120000000000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot y \leq 1.06 \cdot 10^{+103}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot y \leq 1.32 \cdot 10^{+126}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* a b) (* c i)))
        (t_2 (+ (* a b) (* z t)))
        (t_3 (+ (* a b) (* x y))))
   (if (<= (* x y) -2.8e+84)
     t_3
     (if (<= (* x y) -4.45e-231)
       t_1
       (if (<= (* x y) -1.2e-298)
         t_2
         (if (<= (* x y) 7.5e-167)
           t_1
           (if (<= (* x y) 120000000000.0)
             t_2
             (if (<= (* x y) 1.06e+103)
               t_1
               (if (<= (* x y) 1.32e+126) t_2 t_3)))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (a * b) + (c * i);
	double t_2 = (a * b) + (z * t);
	double t_3 = (a * b) + (x * y);
	double tmp;
	if ((x * y) <= -2.8e+84) {
		tmp = t_3;
	} else if ((x * y) <= -4.45e-231) {
		tmp = t_1;
	} else if ((x * y) <= -1.2e-298) {
		tmp = t_2;
	} else if ((x * y) <= 7.5e-167) {
		tmp = t_1;
	} else if ((x * y) <= 120000000000.0) {
		tmp = t_2;
	} else if ((x * y) <= 1.06e+103) {
		tmp = t_1;
	} else if ((x * y) <= 1.32e+126) {
		tmp = t_2;
	} else {
		tmp = t_3;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = (a * b) + (c * i)
    t_2 = (a * b) + (z * t)
    t_3 = (a * b) + (x * y)
    if ((x * y) <= (-2.8d+84)) then
        tmp = t_3
    else if ((x * y) <= (-4.45d-231)) then
        tmp = t_1
    else if ((x * y) <= (-1.2d-298)) then
        tmp = t_2
    else if ((x * y) <= 7.5d-167) then
        tmp = t_1
    else if ((x * y) <= 120000000000.0d0) then
        tmp = t_2
    else if ((x * y) <= 1.06d+103) then
        tmp = t_1
    else if ((x * y) <= 1.32d+126) then
        tmp = t_2
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (a * b) + (c * i);
	double t_2 = (a * b) + (z * t);
	double t_3 = (a * b) + (x * y);
	double tmp;
	if ((x * y) <= -2.8e+84) {
		tmp = t_3;
	} else if ((x * y) <= -4.45e-231) {
		tmp = t_1;
	} else if ((x * y) <= -1.2e-298) {
		tmp = t_2;
	} else if ((x * y) <= 7.5e-167) {
		tmp = t_1;
	} else if ((x * y) <= 120000000000.0) {
		tmp = t_2;
	} else if ((x * y) <= 1.06e+103) {
		tmp = t_1;
	} else if ((x * y) <= 1.32e+126) {
		tmp = t_2;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (a * b) + (c * i)
	t_2 = (a * b) + (z * t)
	t_3 = (a * b) + (x * y)
	tmp = 0
	if (x * y) <= -2.8e+84:
		tmp = t_3
	elif (x * y) <= -4.45e-231:
		tmp = t_1
	elif (x * y) <= -1.2e-298:
		tmp = t_2
	elif (x * y) <= 7.5e-167:
		tmp = t_1
	elif (x * y) <= 120000000000.0:
		tmp = t_2
	elif (x * y) <= 1.06e+103:
		tmp = t_1
	elif (x * y) <= 1.32e+126:
		tmp = t_2
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(a * b) + Float64(c * i))
	t_2 = Float64(Float64(a * b) + Float64(z * t))
	t_3 = Float64(Float64(a * b) + Float64(x * y))
	tmp = 0.0
	if (Float64(x * y) <= -2.8e+84)
		tmp = t_3;
	elseif (Float64(x * y) <= -4.45e-231)
		tmp = t_1;
	elseif (Float64(x * y) <= -1.2e-298)
		tmp = t_2;
	elseif (Float64(x * y) <= 7.5e-167)
		tmp = t_1;
	elseif (Float64(x * y) <= 120000000000.0)
		tmp = t_2;
	elseif (Float64(x * y) <= 1.06e+103)
		tmp = t_1;
	elseif (Float64(x * y) <= 1.32e+126)
		tmp = t_2;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (a * b) + (c * i);
	t_2 = (a * b) + (z * t);
	t_3 = (a * b) + (x * y);
	tmp = 0.0;
	if ((x * y) <= -2.8e+84)
		tmp = t_3;
	elseif ((x * y) <= -4.45e-231)
		tmp = t_1;
	elseif ((x * y) <= -1.2e-298)
		tmp = t_2;
	elseif ((x * y) <= 7.5e-167)
		tmp = t_1;
	elseif ((x * y) <= 120000000000.0)
		tmp = t_2;
	elseif ((x * y) <= 1.06e+103)
		tmp = t_1;
	elseif ((x * y) <= 1.32e+126)
		tmp = t_2;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2.8e+84], t$95$3, If[LessEqual[N[(x * y), $MachinePrecision], -4.45e-231], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -1.2e-298], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 7.5e-167], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 120000000000.0], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 1.06e+103], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1.32e+126], t$95$2, t$95$3]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \cdot y \leq -4.45 \cdot 10^{-231}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \cdot y \leq -1.2 \cdot 10^{-298}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \cdot y \leq 7.5 \cdot 10^{-167}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \cdot y \leq 120000000000:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \cdot y \leq 1.06 \cdot 10^{+103}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \cdot y \leq 1.32 \cdot 10^{+126}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -2.79999999999999982e84 or 1.32000000000000002e126 < (*.f64 x y)

    1. Initial program 93.9%

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

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

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

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

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

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

    if -2.79999999999999982e84 < (*.f64 x y) < -4.4500000000000003e-231 or -1.19999999999999994e-298 < (*.f64 x y) < 7.5000000000000007e-167 or 1.2e11 < (*.f64 x y) < 1.0599999999999999e103

    1. Initial program 98.3%

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

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

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

    if -4.4500000000000003e-231 < (*.f64 x y) < -1.19999999999999994e-298 or 7.5000000000000007e-167 < (*.f64 x y) < 1.2e11 or 1.0599999999999999e103 < (*.f64 x y) < 1.32000000000000002e126

    1. Initial program 98.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2.8 \cdot 10^{+84}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -4.45 \cdot 10^{-231}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq -1.2 \cdot 10^{-298}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 7.5 \cdot 10^{-167}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 120000000000:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 1.06 \cdot 10^{+103}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 1.32 \cdot 10^{+126}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 66.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot b + c \cdot i\\ t_2 := a \cdot b + z \cdot t\\ t_3 := a \cdot b + x \cdot y\\ \mathbf{if}\;x \cdot y \leq -4.8 \cdot 10^{+86}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-103}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-292}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 1.9 \cdot 10^{-168}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot y \leq 95000000000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot y \leq 9.2 \cdot 10^{+102}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot y \leq 2.6 \cdot 10^{+126}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* a b) (* c i)))
        (t_2 (+ (* a b) (* z t)))
        (t_3 (+ (* a b) (* x y))))
   (if (<= (* x y) -4.8e+86)
     t_3
     (if (<= (* x y) -5e-103)
       t_1
       (if (<= (* x y) -5e-292)
         (+ (* c i) (* z t))
         (if (<= (* x y) 1.9e-168)
           t_1
           (if (<= (* x y) 95000000000.0)
             t_2
             (if (<= (* x y) 9.2e+102)
               t_1
               (if (<= (* x y) 2.6e+126) t_2 t_3)))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (a * b) + (c * i);
	double t_2 = (a * b) + (z * t);
	double t_3 = (a * b) + (x * y);
	double tmp;
	if ((x * y) <= -4.8e+86) {
		tmp = t_3;
	} else if ((x * y) <= -5e-103) {
		tmp = t_1;
	} else if ((x * y) <= -5e-292) {
		tmp = (c * i) + (z * t);
	} else if ((x * y) <= 1.9e-168) {
		tmp = t_1;
	} else if ((x * y) <= 95000000000.0) {
		tmp = t_2;
	} else if ((x * y) <= 9.2e+102) {
		tmp = t_1;
	} else if ((x * y) <= 2.6e+126) {
		tmp = t_2;
	} else {
		tmp = t_3;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = (a * b) + (c * i)
    t_2 = (a * b) + (z * t)
    t_3 = (a * b) + (x * y)
    if ((x * y) <= (-4.8d+86)) then
        tmp = t_3
    else if ((x * y) <= (-5d-103)) then
        tmp = t_1
    else if ((x * y) <= (-5d-292)) then
        tmp = (c * i) + (z * t)
    else if ((x * y) <= 1.9d-168) then
        tmp = t_1
    else if ((x * y) <= 95000000000.0d0) then
        tmp = t_2
    else if ((x * y) <= 9.2d+102) then
        tmp = t_1
    else if ((x * y) <= 2.6d+126) then
        tmp = t_2
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (a * b) + (c * i);
	double t_2 = (a * b) + (z * t);
	double t_3 = (a * b) + (x * y);
	double tmp;
	if ((x * y) <= -4.8e+86) {
		tmp = t_3;
	} else if ((x * y) <= -5e-103) {
		tmp = t_1;
	} else if ((x * y) <= -5e-292) {
		tmp = (c * i) + (z * t);
	} else if ((x * y) <= 1.9e-168) {
		tmp = t_1;
	} else if ((x * y) <= 95000000000.0) {
		tmp = t_2;
	} else if ((x * y) <= 9.2e+102) {
		tmp = t_1;
	} else if ((x * y) <= 2.6e+126) {
		tmp = t_2;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (a * b) + (c * i)
	t_2 = (a * b) + (z * t)
	t_3 = (a * b) + (x * y)
	tmp = 0
	if (x * y) <= -4.8e+86:
		tmp = t_3
	elif (x * y) <= -5e-103:
		tmp = t_1
	elif (x * y) <= -5e-292:
		tmp = (c * i) + (z * t)
	elif (x * y) <= 1.9e-168:
		tmp = t_1
	elif (x * y) <= 95000000000.0:
		tmp = t_2
	elif (x * y) <= 9.2e+102:
		tmp = t_1
	elif (x * y) <= 2.6e+126:
		tmp = t_2
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(a * b) + Float64(c * i))
	t_2 = Float64(Float64(a * b) + Float64(z * t))
	t_3 = Float64(Float64(a * b) + Float64(x * y))
	tmp = 0.0
	if (Float64(x * y) <= -4.8e+86)
		tmp = t_3;
	elseif (Float64(x * y) <= -5e-103)
		tmp = t_1;
	elseif (Float64(x * y) <= -5e-292)
		tmp = Float64(Float64(c * i) + Float64(z * t));
	elseif (Float64(x * y) <= 1.9e-168)
		tmp = t_1;
	elseif (Float64(x * y) <= 95000000000.0)
		tmp = t_2;
	elseif (Float64(x * y) <= 9.2e+102)
		tmp = t_1;
	elseif (Float64(x * y) <= 2.6e+126)
		tmp = t_2;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (a * b) + (c * i);
	t_2 = (a * b) + (z * t);
	t_3 = (a * b) + (x * y);
	tmp = 0.0;
	if ((x * y) <= -4.8e+86)
		tmp = t_3;
	elseif ((x * y) <= -5e-103)
		tmp = t_1;
	elseif ((x * y) <= -5e-292)
		tmp = (c * i) + (z * t);
	elseif ((x * y) <= 1.9e-168)
		tmp = t_1;
	elseif ((x * y) <= 95000000000.0)
		tmp = t_2;
	elseif ((x * y) <= 9.2e+102)
		tmp = t_1;
	elseif ((x * y) <= 2.6e+126)
		tmp = t_2;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -4.8e+86], t$95$3, If[LessEqual[N[(x * y), $MachinePrecision], -5e-103], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -5e-292], N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.9e-168], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 95000000000.0], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 9.2e+102], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2.6e+126], t$95$2, t$95$3]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-103}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;x \cdot y \leq 1.9 \cdot 10^{-168}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \cdot y \leq 95000000000:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \cdot y \leq 9.2 \cdot 10^{+102}:\\
\;\;\;\;t_1\\

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

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


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

    1. Initial program 93.9%

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

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

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

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

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

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

    if -4.8000000000000001e86 < (*.f64 x y) < -4.99999999999999966e-103 or -4.99999999999999981e-292 < (*.f64 x y) < 1.9e-168 or 9.5e10 < (*.f64 x y) < 9.1999999999999995e102

    1. Initial program 99.0%

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

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

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

    if -4.99999999999999966e-103 < (*.f64 x y) < -4.99999999999999981e-292

    1. Initial program 96.8%

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

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

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

    if 1.9e-168 < (*.f64 x y) < 9.5e10 or 9.1999999999999995e102 < (*.f64 x y) < 2.6e126

    1. Initial program 97.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -4.8 \cdot 10^{+86}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-103}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-292}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 1.9 \cdot 10^{-168}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 95000000000:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 9.2 \cdot 10^{+102}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 2.6 \cdot 10^{+126}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 65.6% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-103}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;x \cdot y \leq 8 \cdot 10^{-168}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \cdot y \leq 105000000000:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \cdot y \leq 8.4 \cdot 10^{+102}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \cdot y \leq 1.95 \cdot 10^{+191}:\\
\;\;\;\;t_2\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

    if -7.39999999999999983e86 < (*.f64 x y) < -4.99999999999999966e-103 or -8.4999999999999997e-288 < (*.f64 x y) < 8.0000000000000004e-168 or 1.05e11 < (*.f64 x y) < 8.40000000000000006e102

    1. Initial program 99.0%

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

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

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

    if -4.99999999999999966e-103 < (*.f64 x y) < -8.4999999999999997e-288

    1. Initial program 96.8%

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

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

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

    if 8.0000000000000004e-168 < (*.f64 x y) < 1.05e11 or 8.40000000000000006e102 < (*.f64 x y) < 1.95e191

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.95e191 < (*.f64 x y)

    1. Initial program 86.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -7.4 \cdot 10^{+86}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-103}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq -8.5 \cdot 10^{-288}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 8 \cdot 10^{-168}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 105000000000:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 8.4 \cdot 10^{+102}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 1.95 \cdot 10^{+191}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 97.1% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

    1. Initial program 0.0%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. 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-def50.0%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 44.0% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 a b) < -2.35000000000000011e89 or 1.20000000000000006e126 < (*.f64 a b)

    1. Initial program 95.7%

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

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

    if -2.35000000000000011e89 < (*.f64 a b) < -4.79999999999999998e-161 or 1.25000000000000001e-36 < (*.f64 a b) < 1.3800000000000001e76

    1. Initial program 96.8%

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

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

    if -4.79999999999999998e-161 < (*.f64 a b) < 4.00000000000000026e-152

    1. Initial program 98.7%

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

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

    if 4.00000000000000026e-152 < (*.f64 a b) < 1.25000000000000001e-36 or 1.3800000000000001e76 < (*.f64 a b) < 1.20000000000000006e126

    1. Initial program 95.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -2.35 \cdot 10^{+89}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -4.8 \cdot 10^{-161}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 4 \cdot 10^{-152}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 1.25 \cdot 10^{-36}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.38 \cdot 10^{+76}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 1.2 \cdot 10^{+126}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 43.5% accurate, 0.8× speedup?

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -9.19999999999999938e104 or 8.8e21 < (*.f64 a b)

    1. Initial program 95.5%

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

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

    if -9.19999999999999938e104 < (*.f64 a b) < -1.24999999999999994e-178 or 1.60000000000000011e-151 < (*.f64 a b) < 8.8e21

    1. Initial program 97.1%

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

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

    if -1.24999999999999994e-178 < (*.f64 a b) < 1.60000000000000011e-151

    1. Initial program 98.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -9.2 \cdot 10^{+104}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -1.25 \cdot 10^{-178}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.6 \cdot 10^{-151}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 8.8 \cdot 10^{+21}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 87.5% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
\mathbf{if}\;c \cdot i \leq -1.48 \cdot 10^{+119} \lor \neg \left(c \cdot i \leq 1.16 \cdot 10^{+123}\right):\\
\;\;\;\;c \cdot i + t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c i) < -1.47999999999999995e119 or 1.16e123 < (*.f64 c i)

    1. Initial program 91.8%

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

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

    if -1.47999999999999995e119 < (*.f64 c i) < 1.16e123

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 87.5% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -3.7 \cdot 10^{+90} \lor \neg \left(x \cdot y \leq 2.2 \cdot 10^{+196}\right):\\
\;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -3.7e90 or 2.19999999999999998e196 < (*.f64 x y)

    1. Initial program 93.6%

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.7e90 < (*.f64 x y) < 2.19999999999999998e196

    1. Initial program 98.3%

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

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

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

Alternative 12: 85.2% accurate, 0.8× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;x \cdot y + c \cdot i\\


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

    1. Initial program 83.8%

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

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

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

    if -5.9000000000000001e119 < (*.f64 c i) < 1.3e132

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.3e132 < (*.f64 c i)

    1. Initial program 97.9%

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

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

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

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

Alternative 13: 86.6% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 100.0%

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

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

    if -1.19999999999999996e-29 < (*.f64 x y) < 2.19999999999999998e196

    1. Initial program 98.1%

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

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

    if 2.19999999999999998e196 < (*.f64 x y)

    1. Initial program 86.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 64.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.75 \cdot 10^{+126} \lor \neg \left(x \cdot y \leq 4.1 \cdot 10^{+196}\right):\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -1.7500000000000001e126 or 4.0999999999999996e196 < (*.f64 x y)

    1. Initial program 92.8%

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

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

    if -1.7500000000000001e126 < (*.f64 x y) < 4.0999999999999996e196

    1. Initial program 98.4%

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

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

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

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

Alternative 15: 66.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -4.2 \cdot 10^{+34} \lor \neg \left(c \cdot i \leq 3.7 \cdot 10^{+123}\right):\\
\;\;\;\;a \cdot b + c \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c i) < -4.20000000000000035e34 or 3.69999999999999996e123 < (*.f64 c i)

    1. Initial program 92.0%

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

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

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

    if -4.20000000000000035e34 < (*.f64 c i) < 3.69999999999999996e123

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -4.2 \cdot 10^{+34} \lor \neg \left(c \cdot i \leq 3.7 \cdot 10^{+123}\right):\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 43.9% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -5.7 \cdot 10^{+119} \lor \neg \left(c \cdot i \leq 3.4 \cdot 10^{+126}\right):\\
\;\;\;\;c \cdot i\\

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


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

    1. Initial program 91.7%

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

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

    if -5.7000000000000002e119 < (*.f64 c i) < 3.39999999999999989e126

    1. Initial program 99.4%

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

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

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

Alternative 17: 28.1% accurate, 5.0× speedup?

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

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

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

    \[\leadsto \color{blue}{a \cdot b} \]
  4. Final simplification32.1%

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

Reproduce

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