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

Percentage Accurate: 96.2% → 98.0%
Time: 13.1s
Alternatives: 16
Speedup: 1.0×

Specification

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

\\
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 16 alternatives:

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

Initial Program: 96.2% accurate, 1.0× speedup?

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

\\
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\end{array}

Alternative 1: 98.0% accurate, 0.0× speedup?

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

\\
\mathsf{fma}\left(c, i, \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)\right)
\end{array}
Derivation
  1. Initial program 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-def98.4%

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

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

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

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

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

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

Alternative 2: 98.1% 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 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-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-def98.8%

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

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

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

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

\\
\mathsf{fma}\left(z, t, a \cdot b\right) + \left(x \cdot y + c \cdot i\right)
\end{array}
Derivation
  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-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-def98.8%

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 97.0% 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 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-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-def98.8%

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

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

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

      \[\leadsto \mathsf{fma}\left(c, i, \color{blue}{a \cdot b + \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 5: 42.7% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;a \cdot b \leq -2.55 \cdot 10^{+91}:\\
\;\;\;\;c \cdot i\\

\mathbf{elif}\;a \cdot b \leq -1.3 \cdot 10^{+73}:\\
\;\;\;\;a \cdot b\\

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 a b) < -1.49999999999999997e147 or -2.55000000000000007e91 < (*.f64 a b) < -1.3e73 or 5.2000000000000001e74 < (*.f64 a b)

    1. Initial program 94.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.49999999999999997e147 < (*.f64 a b) < -2.55000000000000007e91 or -1.09999999999999991e-282 < (*.f64 a b) < 1.05e-248

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

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

    if -1.3e73 < (*.f64 a b) < -5.7999999999999997e-69 or -2.80000000000000004e-238 < (*.f64 a b) < -1.09999999999999991e-282

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.7999999999999997e-69 < (*.f64 a b) < -2.80000000000000004e-238 or 1.05e-248 < (*.f64 a b) < 5.2000000000000001e74

    1. Initial program 98.6%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.5 \cdot 10^{+147}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -2.55 \cdot 10^{+91}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -1.3 \cdot 10^{+73}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -5.8 \cdot 10^{-69}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq -2.8 \cdot 10^{-238}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq -1.1 \cdot 10^{-282}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.05 \cdot 10^{-248}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 5.2 \cdot 10^{+74}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 42.1% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.6 \cdot 10^{+147}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -1.15 \cdot 10^{+91}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -1.85 \cdot 10^{+73}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -1.55 \cdot 10^{-139}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.1 \cdot 10^{-248}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 7.3 \cdot 10^{+114}:\\ \;\;\;\;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) -1.6e+147)
   (* a b)
   (if (<= (* a b) -1.15e+91)
     (* c i)
     (if (<= (* a b) -1.85e+73)
       (* a b)
       (if (<= (* a b) -1.55e-139)
         (* z t)
         (if (<= (* a b) 1.1e-248)
           (* c i)
           (if (<= (* a b) 7.3e+114) (* 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) <= -1.6e+147) {
		tmp = a * b;
	} else if ((a * b) <= -1.15e+91) {
		tmp = c * i;
	} else if ((a * b) <= -1.85e+73) {
		tmp = a * b;
	} else if ((a * b) <= -1.55e-139) {
		tmp = z * t;
	} else if ((a * b) <= 1.1e-248) {
		tmp = c * i;
	} else if ((a * b) <= 7.3e+114) {
		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) <= (-1.6d+147)) then
        tmp = a * b
    else if ((a * b) <= (-1.15d+91)) then
        tmp = c * i
    else if ((a * b) <= (-1.85d+73)) then
        tmp = a * b
    else if ((a * b) <= (-1.55d-139)) then
        tmp = z * t
    else if ((a * b) <= 1.1d-248) then
        tmp = c * i
    else if ((a * b) <= 7.3d+114) 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) <= -1.6e+147) {
		tmp = a * b;
	} else if ((a * b) <= -1.15e+91) {
		tmp = c * i;
	} else if ((a * b) <= -1.85e+73) {
		tmp = a * b;
	} else if ((a * b) <= -1.55e-139) {
		tmp = z * t;
	} else if ((a * b) <= 1.1e-248) {
		tmp = c * i;
	} else if ((a * b) <= 7.3e+114) {
		tmp = z * t;
	} else {
		tmp = a * b;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (a * b) <= -1.6e+147:
		tmp = a * b
	elif (a * b) <= -1.15e+91:
		tmp = c * i
	elif (a * b) <= -1.85e+73:
		tmp = a * b
	elif (a * b) <= -1.55e-139:
		tmp = z * t
	elif (a * b) <= 1.1e-248:
		tmp = c * i
	elif (a * b) <= 7.3e+114:
		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) <= -1.6e+147)
		tmp = Float64(a * b);
	elseif (Float64(a * b) <= -1.15e+91)
		tmp = Float64(c * i);
	elseif (Float64(a * b) <= -1.85e+73)
		tmp = Float64(a * b);
	elseif (Float64(a * b) <= -1.55e-139)
		tmp = Float64(z * t);
	elseif (Float64(a * b) <= 1.1e-248)
		tmp = Float64(c * i);
	elseif (Float64(a * b) <= 7.3e+114)
		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) <= -1.6e+147)
		tmp = a * b;
	elseif ((a * b) <= -1.15e+91)
		tmp = c * i;
	elseif ((a * b) <= -1.85e+73)
		tmp = a * b;
	elseif ((a * b) <= -1.55e-139)
		tmp = z * t;
	elseif ((a * b) <= 1.1e-248)
		tmp = c * i;
	elseif ((a * b) <= 7.3e+114)
		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], -1.6e+147], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -1.15e+91], N[(c * i), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -1.85e+73], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -1.55e-139], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.1e-248], N[(c * i), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 7.3e+114], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;a \cdot b \leq -1.15 \cdot 10^{+91}:\\
\;\;\;\;c \cdot i\\

\mathbf{elif}\;a \cdot b \leq -1.85 \cdot 10^{+73}:\\
\;\;\;\;a \cdot b\\

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -1.59999999999999989e147 or -1.14999999999999996e91 < (*.f64 a b) < -1.84999999999999987e73 or 7.3000000000000001e114 < (*.f64 a b)

    1. Initial program 94.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.59999999999999989e147 < (*.f64 a b) < -1.14999999999999996e91 or -1.55e-139 < (*.f64 a b) < 1.1e-248

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

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

    if -1.84999999999999987e73 < (*.f64 a b) < -1.55e-139 or 1.1e-248 < (*.f64 a b) < 7.3000000000000001e114

    1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.6 \cdot 10^{+147}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -1.15 \cdot 10^{+91}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -1.85 \cdot 10^{+73}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -1.55 \cdot 10^{-139}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.1 \cdot 10^{-248}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 7.3 \cdot 10^{+114}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 84.5% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;c \cdot i \leq -4.1 \cdot 10^{+123}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;c \cdot i \leq -4.7 \cdot 10^{+55}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;c \cdot i \leq 1.4 \cdot 10^{+110}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 c i) < -1.25e188 or -4.09999999999999989e123 < (*.f64 c i) < -4.7000000000000001e55

    1. Initial program 94.6%

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

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

    if -1.25e188 < (*.f64 c i) < -4.09999999999999989e123 or -4.7000000000000001e55 < (*.f64 c i) < 1.39999999999999993e110

    1. Initial program 98.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.39999999999999993e110 < (*.f64 c i)

    1. Initial program 97.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 inf 84.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1.25 \cdot 10^{+188}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -4.1 \cdot 10^{+123}:\\ \;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\ \mathbf{elif}\;c \cdot i \leq -4.7 \cdot 10^{+55}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;c \cdot i \leq 1.4 \cdot 10^{+110}:\\ \;\;\;\;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 8: 66.8% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;a \cdot b \leq -6 \cdot 10^{-268}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;a \cdot b \leq 8.5 \cdot 10^{+73}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -1.24999999999999993e48 or 8.4999999999999998e73 < (*.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 77.7%

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

    if -1.24999999999999993e48 < (*.f64 a b) < -5.9999999999999995e-268 or 1.45000000000000011e-249 < (*.f64 a b) < 8.4999999999999998e73

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

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

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

    if -5.9999999999999995e-268 < (*.f64 a b) < 1.45000000000000011e-249

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.25 \cdot 10^{+48}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -6 \cdot 10^{-268}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.45 \cdot 10^{-249}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 8.5 \cdot 10^{+73}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 66.6% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;a \cdot b \leq -4.8 \cdot 10^{-290}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;a \cdot b \leq 2.8 \cdot 10^{+74}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -8.8000000000000001e46 or 2.80000000000000002e74 < (*.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 77.7%

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

    if -8.8000000000000001e46 < (*.f64 a b) < -4.8000000000000001e-290 or 3.3000000000000002e-248 < (*.f64 a b) < 2.80000000000000002e74

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

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

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

    if -4.8000000000000001e-290 < (*.f64 a b) < 3.3000000000000002e-248

    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 x around inf 78.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -8.8 \cdot 10^{+46}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -4.8 \cdot 10^{-290}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 3.3 \cdot 10^{-248}:\\ \;\;\;\;x \cdot y + c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 2.8 \cdot 10^{+74}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 88.9% accurate, 0.6× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c i) < -1.20000000000000004e46 or 1.94999999999999989e105 < (*.f64 c i)

    1. Initial program 96.7%

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

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

    if -1.20000000000000004e46 < (*.f64 c i) < 1.94999999999999989e105

    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-def98.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 88.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot y + z \cdot t\\ \mathbf{if}\;c \cdot i \leq -6.6 \cdot 10^{+45}:\\ \;\;\;\;\left(a \cdot b + x \cdot y\right) + c \cdot i\\ \mathbf{elif}\;c \cdot i \leq 1.1 \cdot 10^{+107}:\\ \;\;\;\;a \cdot b + t_1\\ \mathbf{else}:\\ \;\;\;\;c \cdot i + 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 (<= (* c i) -6.6e+45)
     (+ (+ (* a b) (* x y)) (* c i))
     (if (<= (* c i) 1.1e+107) (+ (* a b) t_1) (+ (* c i) 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) <= -6.6e+45) {
		tmp = ((a * b) + (x * y)) + (c * i);
	} else if ((c * i) <= 1.1e+107) {
		tmp = (a * b) + t_1;
	} else {
		tmp = (c * i) + 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) <= (-6.6d+45)) then
        tmp = ((a * b) + (x * y)) + (c * i)
    else if ((c * i) <= 1.1d+107) then
        tmp = (a * b) + t_1
    else
        tmp = (c * i) + 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) <= -6.6e+45) {
		tmp = ((a * b) + (x * y)) + (c * i);
	} else if ((c * i) <= 1.1e+107) {
		tmp = (a * b) + t_1;
	} else {
		tmp = (c * i) + 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) <= -6.6e+45:
		tmp = ((a * b) + (x * y)) + (c * i)
	elif (c * i) <= 1.1e+107:
		tmp = (a * b) + t_1
	else:
		tmp = (c * i) + 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) <= -6.6e+45)
		tmp = Float64(Float64(Float64(a * b) + Float64(x * y)) + Float64(c * i));
	elseif (Float64(c * i) <= 1.1e+107)
		tmp = Float64(Float64(a * b) + t_1);
	else
		tmp = Float64(Float64(c * i) + 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) <= -6.6e+45)
		tmp = ((a * b) + (x * y)) + (c * i);
	elseif ((c * i) <= 1.1e+107)
		tmp = (a * b) + t_1;
	else
		tmp = (c * i) + 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[LessEqual[N[(c * i), $MachinePrecision], -6.6e+45], N[(N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 1.1e+107], N[(N[(a * b), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(c * i), $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 -6.6 \cdot 10^{+45}:\\
\;\;\;\;\left(a \cdot b + x \cdot y\right) + c \cdot i\\

\mathbf{elif}\;c \cdot i \leq 1.1 \cdot 10^{+107}:\\
\;\;\;\;a \cdot b + t_1\\

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


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

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

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

    if -6.6000000000000001e45 < (*.f64 c i) < 1.1e107

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.1e107 < (*.f64 c i)

    1. Initial program 97.3%

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

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

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

Alternative 12: 63.3% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -3.5 \cdot 10^{+119} \lor \neg \left(x \cdot y \leq 9 \cdot 10^{+229}\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) -3.5e+119) (not (<= (* x y) 9e+229)))
   (* 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) <= -3.5e+119) || !((x * y) <= 9e+229)) {
		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) <= (-3.5d+119)) .or. (.not. ((x * y) <= 9d+229))) 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) <= -3.5e+119) || !((x * y) <= 9e+229)) {
		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) <= -3.5e+119) or not ((x * y) <= 9e+229):
		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) <= -3.5e+119) || !(Float64(x * y) <= 9e+229))
		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) <= -3.5e+119) || ~(((x * y) <= 9e+229)))
		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], -3.5e+119], N[Not[LessEqual[N[(x * y), $MachinePrecision], 9e+229]], $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 -3.5 \cdot 10^{+119} \lor \neg \left(x \cdot y \leq 9 \cdot 10^{+229}\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) < -3.5000000000000001e119 or 9.00000000000000047e229 < (*.f64 x y)

    1. Initial program 97.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.5000000000000001e119 < (*.f64 x y) < 9.00000000000000047e229

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

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

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

Alternative 13: 66.3% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.5 \cdot 10^{+73} \lor \neg \left(a \cdot b \leq 1.26 \cdot 10^{+113}\right):\\
\;\;\;\;a \cdot b + c \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -1.50000000000000005e73 or 1.2599999999999999e113 < (*.f64 a b)

    1. Initial program 95.0%

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

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

    if -1.50000000000000005e73 < (*.f64 a b) < 1.2599999999999999e113

    1. Initial program 99.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 inf 60.6%

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

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

Alternative 14: 42.8% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.5 \cdot 10^{+147} \lor \neg \left(a \cdot b \leq 1.28 \cdot 10^{+92}\right):\\
\;\;\;\;a \cdot b\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -1.49999999999999997e147 or 1.27999999999999996e92 < (*.f64 a b)

    1. Initial program 94.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.49999999999999997e147 < (*.f64 a b) < 1.27999999999999996e92

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

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

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

Alternative 15: 96.2% accurate, 1.0× speedup?

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

\\
\left(x \cdot y + c \cdot i\right) + \left(a \cdot b + z \cdot t\right)
\end{array}
Derivation
  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-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-def98.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 27.2% accurate, 5.0× speedup?

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

\\
a \cdot b
\end{array}
Derivation
  1. Initial program 97.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-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-def98.8%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{a \cdot b} \]
  8. Final simplification31.0%

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

Reproduce

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