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

Percentage Accurate: 95.9% → 98.0%
Time: 8.2s
Alternatives: 14
Speedup: 1.3×

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 14 alternatives:

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

Initial Program: 95.9% accurate, 1.0× speedup?

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

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

Alternative 1: 98.0% accurate, 1.3× speedup?

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

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

    \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-+.f64N/A

      \[\leadsto \color{blue}{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i} \]
    2. lift-+.f64N/A

      \[\leadsto \color{blue}{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right)} + c \cdot i \]
    3. associate-+l+N/A

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

      \[\leadsto \color{blue}{\left(x \cdot y + z \cdot t\right)} + \left(a \cdot b + c \cdot i\right) \]
    5. +-commutativeN/A

      \[\leadsto \color{blue}{\left(z \cdot t + x \cdot y\right)} + \left(a \cdot b + c \cdot i\right) \]
    6. associate-+l+N/A

      \[\leadsto \color{blue}{z \cdot t + \left(x \cdot y + \left(a \cdot b + c \cdot i\right)\right)} \]
    7. lift-*.f64N/A

      \[\leadsto \color{blue}{z \cdot t} + \left(x \cdot y + \left(a \cdot b + c \cdot i\right)\right) \]
    8. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, t, x \cdot y + \left(a \cdot b + c \cdot i\right)\right)} \]
    9. lift-*.f64N/A

      \[\leadsto \mathsf{fma}\left(z, t, \color{blue}{x \cdot y} + \left(a \cdot b + c \cdot i\right)\right) \]
    10. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(z, t, \color{blue}{y \cdot x} + \left(a \cdot b + c \cdot i\right)\right) \]
    11. lower-fma.f64N/A

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

      \[\leadsto \mathsf{fma}\left(z, t, \mathsf{fma}\left(y, x, \color{blue}{c \cdot i + a \cdot b}\right)\right) \]
    13. lift-*.f64N/A

      \[\leadsto \mathsf{fma}\left(z, t, \mathsf{fma}\left(y, x, \color{blue}{c \cdot i} + a \cdot b\right)\right) \]
    14. *-commutativeN/A

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

      \[\leadsto \mathsf{fma}\left(z, t, \mathsf{fma}\left(y, x, \color{blue}{\mathsf{fma}\left(i, c, a \cdot b\right)}\right)\right) \]
    16. lift-*.f64N/A

      \[\leadsto \mathsf{fma}\left(z, t, \mathsf{fma}\left(y, x, \mathsf{fma}\left(i, c, \color{blue}{a \cdot b}\right)\right)\right) \]
    17. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(z, t, \mathsf{fma}\left(y, x, \mathsf{fma}\left(i, c, \color{blue}{b \cdot a}\right)\right)\right) \]
    18. lower-*.f6499.6

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

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

Alternative 2: 74.2% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(t, z, x \cdot y\right)\\ t_2 := x \cdot y + z \cdot t\\ \mathbf{if}\;t\_2 \leq -1 \cdot 10^{+87}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+35}:\\ \;\;\;\;\mathsf{fma}\left(b, a, c \cdot i\right)\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+191}:\\ \;\;\;\;\mathsf{fma}\left(y, x, a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (fma t z (* x y))) (t_2 (+ (* x y) (* z t))))
   (if (<= t_2 -1e+87)
     t_1
     (if (<= t_2 2e+35)
       (fma b a (* c i))
       (if (<= t_2 5e+191) (fma y x (* a b)) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = fma(t, z, (x * y));
	double t_2 = (x * y) + (z * t);
	double tmp;
	if (t_2 <= -1e+87) {
		tmp = t_1;
	} else if (t_2 <= 2e+35) {
		tmp = fma(b, a, (c * i));
	} else if (t_2 <= 5e+191) {
		tmp = fma(y, x, (a * b));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i)
	t_1 = fma(t, z, Float64(x * y))
	t_2 = Float64(Float64(x * y) + Float64(z * t))
	tmp = 0.0
	if (t_2 <= -1e+87)
		tmp = t_1;
	elseif (t_2 <= 2e+35)
		tmp = fma(b, a, Float64(c * i));
	elseif (t_2 <= 5e+191)
		tmp = fma(y, x, Float64(a * b));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+87], t$95$1, If[LessEqual[t$95$2, 2e+35], N[(b * a + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+191], N[(y * x + N[(a * b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, z, x \cdot y\right)\\
t_2 := x \cdot y + z \cdot t\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+87}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+35}:\\
\;\;\;\;\mathsf{fma}\left(b, a, c \cdot i\right)\\

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+191}:\\
\;\;\;\;\mathsf{fma}\left(y, x, a \cdot b\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 (*.f64 x y) (*.f64 z t)) < -9.9999999999999996e86 or 5.0000000000000002e191 < (+.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 91.1%

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

      \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{i \cdot c} + \left(t \cdot z + x \cdot y\right) \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, t \cdot z + x \cdot y\right)} \]
      3. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(i, c, \color{blue}{\mathsf{fma}\left(t, z, x \cdot y\right)}\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(i, c, \mathsf{fma}\left(t, z, \color{blue}{y \cdot x}\right)\right) \]
      5. lower-*.f6485.8

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

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

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

        \[\leadsto \mathsf{fma}\left(z, t, c \cdot i\right) \]
      3. Step-by-step derivation
        1. Applied rewrites58.5%

          \[\leadsto \mathsf{fma}\left(z, t, i \cdot c\right) \]
        2. Taylor expanded in c around 0

          \[\leadsto t \cdot z + \color{blue}{x \cdot y} \]
        3. Step-by-step derivation
          1. Applied rewrites77.6%

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

          if -9.9999999999999996e86 < (+.f64 (*.f64 x y) (*.f64 z t)) < 1.9999999999999999e35

          1. Initial program 98.9%

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

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

              \[\leadsto \color{blue}{b \cdot a} + \left(c \cdot i + x \cdot y\right) \]
            2. lower-fma.f64N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i + x \cdot y\right)} \]
            3. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{i \cdot c} + x \cdot y\right) \]
            4. lower-fma.f64N/A

              \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{\mathsf{fma}\left(i, c, x \cdot y\right)}\right) \]
            5. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
            6. lower-*.f6489.0

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

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

            \[\leadsto \mathsf{fma}\left(b, a, c \cdot i\right) \]
          7. Step-by-step derivation
            1. Applied rewrites83.1%

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

            if 1.9999999999999999e35 < (+.f64 (*.f64 x y) (*.f64 z t)) < 5.0000000000000002e191

            1. Initial program 99.9%

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

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

                \[\leadsto \color{blue}{b \cdot a} + \left(c \cdot i + x \cdot y\right) \]
              2. lower-fma.f64N/A

                \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i + x \cdot y\right)} \]
              3. *-commutativeN/A

                \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{i \cdot c} + x \cdot y\right) \]
              4. lower-fma.f64N/A

                \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{\mathsf{fma}\left(i, c, x \cdot y\right)}\right) \]
              5. *-commutativeN/A

                \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
              6. lower-*.f6482.9

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

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

              \[\leadsto \mathsf{fma}\left(b, a, c \cdot i\right) \]
            7. Step-by-step derivation
              1. Applied rewrites48.9%

                \[\leadsto \mathsf{fma}\left(b, a, c \cdot i\right) \]
              2. Taylor expanded in c around 0

                \[\leadsto a \cdot b + \color{blue}{x \cdot y} \]
              3. Step-by-step derivation
                1. Applied rewrites71.1%

                  \[\leadsto \mathsf{fma}\left(b, \color{blue}{a}, y \cdot x\right) \]
                2. Step-by-step derivation
                  1. Applied rewrites71.2%

                    \[\leadsto \mathsf{fma}\left(y, x, a \cdot b\right) \]
                3. Recombined 3 regimes into one program.
                4. Add Preprocessing

                Alternative 3: 74.3% accurate, 0.4× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(t, z, x \cdot y\right)\\ t_2 := x \cdot y + z \cdot t\\ \mathbf{if}\;t\_2 \leq -4 \cdot 10^{+87}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+35}:\\ \;\;\;\;\mathsf{fma}\left(i, c, b \cdot a\right)\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+191}:\\ \;\;\;\;\mathsf{fma}\left(y, x, a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                (FPCore (x y z t a b c i)
                 :precision binary64
                 (let* ((t_1 (fma t z (* x y))) (t_2 (+ (* x y) (* z t))))
                   (if (<= t_2 -4e+87)
                     t_1
                     (if (<= t_2 2e+35)
                       (fma i c (* b a))
                       (if (<= t_2 5e+191) (fma y x (* a b)) t_1)))))
                double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                	double t_1 = fma(t, z, (x * y));
                	double t_2 = (x * y) + (z * t);
                	double tmp;
                	if (t_2 <= -4e+87) {
                		tmp = t_1;
                	} else if (t_2 <= 2e+35) {
                		tmp = fma(i, c, (b * a));
                	} else if (t_2 <= 5e+191) {
                		tmp = fma(y, x, (a * b));
                	} else {
                		tmp = t_1;
                	}
                	return tmp;
                }
                
                function code(x, y, z, t, a, b, c, i)
                	t_1 = fma(t, z, Float64(x * y))
                	t_2 = Float64(Float64(x * y) + Float64(z * t))
                	tmp = 0.0
                	if (t_2 <= -4e+87)
                		tmp = t_1;
                	elseif (t_2 <= 2e+35)
                		tmp = fma(i, c, Float64(b * a));
                	elseif (t_2 <= 5e+191)
                		tmp = fma(y, x, Float64(a * b));
                	else
                		tmp = t_1;
                	end
                	return tmp
                end
                
                code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e+87], t$95$1, If[LessEqual[t$95$2, 2e+35], N[(i * c + N[(b * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+191], N[(y * x + N[(a * b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_1 := \mathsf{fma}\left(t, z, x \cdot y\right)\\
                t_2 := x \cdot y + z \cdot t\\
                \mathbf{if}\;t\_2 \leq -4 \cdot 10^{+87}:\\
                \;\;\;\;t\_1\\
                
                \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+35}:\\
                \;\;\;\;\mathsf{fma}\left(i, c, b \cdot a\right)\\
                
                \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+191}:\\
                \;\;\;\;\mathsf{fma}\left(y, x, a \cdot b\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_1\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if (+.f64 (*.f64 x y) (*.f64 z t)) < -3.9999999999999998e87 or 5.0000000000000002e191 < (+.f64 (*.f64 x y) (*.f64 z t))

                  1. Initial program 91.9%

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

                    \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
                  4. Step-by-step derivation
                    1. *-commutativeN/A

                      \[\leadsto \color{blue}{i \cdot c} + \left(t \cdot z + x \cdot y\right) \]
                    2. lower-fma.f64N/A

                      \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, t \cdot z + x \cdot y\right)} \]
                    3. lower-fma.f64N/A

                      \[\leadsto \mathsf{fma}\left(i, c, \color{blue}{\mathsf{fma}\left(t, z, x \cdot y\right)}\right) \]
                    4. *-commutativeN/A

                      \[\leadsto \mathsf{fma}\left(i, c, \mathsf{fma}\left(t, z, \color{blue}{y \cdot x}\right)\right) \]
                    5. lower-*.f6486.5

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

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

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

                      \[\leadsto \mathsf{fma}\left(z, t, c \cdot i\right) \]
                    3. Step-by-step derivation
                      1. Applied rewrites59.0%

                        \[\leadsto \mathsf{fma}\left(z, t, i \cdot c\right) \]
                      2. Taylor expanded in c around 0

                        \[\leadsto t \cdot z + \color{blue}{x \cdot y} \]
                      3. Step-by-step derivation
                        1. Applied rewrites78.2%

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

                        if -3.9999999999999998e87 < (+.f64 (*.f64 x y) (*.f64 z t)) < 1.9999999999999999e35

                        1. Initial program 98.0%

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

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

                            \[\leadsto \color{blue}{b \cdot a} + \left(c \cdot i + x \cdot y\right) \]
                          2. lower-fma.f64N/A

                            \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i + x \cdot y\right)} \]
                          3. *-commutativeN/A

                            \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{i \cdot c} + x \cdot y\right) \]
                          4. lower-fma.f64N/A

                            \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{\mathsf{fma}\left(i, c, x \cdot y\right)}\right) \]
                          5. *-commutativeN/A

                            \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
                          6. lower-*.f6488.1

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

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

                          \[\leadsto \mathsf{fma}\left(b, a, c \cdot i\right) \]
                        7. Step-by-step derivation
                          1. Applied rewrites82.3%

                            \[\leadsto \mathsf{fma}\left(b, a, c \cdot i\right) \]
                          2. Taylor expanded in x around 0

                            \[\leadsto a \cdot b + \color{blue}{c \cdot i} \]
                          3. Step-by-step derivation
                            1. Applied rewrites82.3%

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

                            if 1.9999999999999999e35 < (+.f64 (*.f64 x y) (*.f64 z t)) < 5.0000000000000002e191

                            1. Initial program 99.9%

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

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

                                \[\leadsto \color{blue}{b \cdot a} + \left(c \cdot i + x \cdot y\right) \]
                              2. lower-fma.f64N/A

                                \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i + x \cdot y\right)} \]
                              3. *-commutativeN/A

                                \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{i \cdot c} + x \cdot y\right) \]
                              4. lower-fma.f64N/A

                                \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{\mathsf{fma}\left(i, c, x \cdot y\right)}\right) \]
                              5. *-commutativeN/A

                                \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
                              6. lower-*.f6482.9

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

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

                              \[\leadsto \mathsf{fma}\left(b, a, c \cdot i\right) \]
                            7. Step-by-step derivation
                              1. Applied rewrites48.9%

                                \[\leadsto \mathsf{fma}\left(b, a, c \cdot i\right) \]
                              2. Taylor expanded in c around 0

                                \[\leadsto a \cdot b + \color{blue}{x \cdot y} \]
                              3. Step-by-step derivation
                                1. Applied rewrites71.1%

                                  \[\leadsto \mathsf{fma}\left(b, \color{blue}{a}, y \cdot x\right) \]
                                2. Step-by-step derivation
                                  1. Applied rewrites71.2%

                                    \[\leadsto \mathsf{fma}\left(y, x, a \cdot b\right) \]
                                3. Recombined 3 regimes into one program.
                                4. Add Preprocessing

                                Alternative 4: 42.2% accurate, 0.5× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+127}:\\ \;\;\;\;t \cdot z\\ \mathbf{elif}\;z \cdot t \leq -2 \cdot 10^{-91}:\\ \;\;\;\;i \cdot c\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-321}:\\ \;\;\;\;b \cdot a\\ \mathbf{elif}\;z \cdot t \leq 10^{+24}:\\ \;\;\;\;i \cdot c\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+193}:\\ \;\;\;\;b \cdot a\\ \mathbf{else}:\\ \;\;\;\;t \cdot z\\ \end{array} \end{array} \]
                                (FPCore (x y z t a b c i)
                                 :precision binary64
                                 (if (<= (* z t) -5e+127)
                                   (* t z)
                                   (if (<= (* z t) -2e-91)
                                     (* i c)
                                     (if (<= (* z t) -5e-321)
                                       (* b a)
                                       (if (<= (* z t) 1e+24)
                                         (* i c)
                                         (if (<= (* z t) 2e+193) (* b a) (* t z)))))))
                                double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                	double tmp;
                                	if ((z * t) <= -5e+127) {
                                		tmp = t * z;
                                	} else if ((z * t) <= -2e-91) {
                                		tmp = i * c;
                                	} else if ((z * t) <= -5e-321) {
                                		tmp = b * a;
                                	} else if ((z * t) <= 1e+24) {
                                		tmp = i * c;
                                	} else if ((z * t) <= 2e+193) {
                                		tmp = b * a;
                                	} else {
                                		tmp = t * z;
                                	}
                                	return tmp;
                                }
                                
                                real(8) function code(x, y, z, t, a, b, c, i)
                                    real(8), intent (in) :: x
                                    real(8), intent (in) :: y
                                    real(8), intent (in) :: z
                                    real(8), intent (in) :: t
                                    real(8), intent (in) :: a
                                    real(8), intent (in) :: b
                                    real(8), intent (in) :: c
                                    real(8), intent (in) :: i
                                    real(8) :: tmp
                                    if ((z * t) <= (-5d+127)) then
                                        tmp = t * z
                                    else if ((z * t) <= (-2d-91)) then
                                        tmp = i * c
                                    else if ((z * t) <= (-5d-321)) then
                                        tmp = b * a
                                    else if ((z * t) <= 1d+24) then
                                        tmp = i * c
                                    else if ((z * t) <= 2d+193) then
                                        tmp = b * a
                                    else
                                        tmp = t * z
                                    end if
                                    code = tmp
                                end function
                                
                                public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                	double tmp;
                                	if ((z * t) <= -5e+127) {
                                		tmp = t * z;
                                	} else if ((z * t) <= -2e-91) {
                                		tmp = i * c;
                                	} else if ((z * t) <= -5e-321) {
                                		tmp = b * a;
                                	} else if ((z * t) <= 1e+24) {
                                		tmp = i * c;
                                	} else if ((z * t) <= 2e+193) {
                                		tmp = b * a;
                                	} else {
                                		tmp = t * z;
                                	}
                                	return tmp;
                                }
                                
                                def code(x, y, z, t, a, b, c, i):
                                	tmp = 0
                                	if (z * t) <= -5e+127:
                                		tmp = t * z
                                	elif (z * t) <= -2e-91:
                                		tmp = i * c
                                	elif (z * t) <= -5e-321:
                                		tmp = b * a
                                	elif (z * t) <= 1e+24:
                                		tmp = i * c
                                	elif (z * t) <= 2e+193:
                                		tmp = b * a
                                	else:
                                		tmp = t * z
                                	return tmp
                                
                                function code(x, y, z, t, a, b, c, i)
                                	tmp = 0.0
                                	if (Float64(z * t) <= -5e+127)
                                		tmp = Float64(t * z);
                                	elseif (Float64(z * t) <= -2e-91)
                                		tmp = Float64(i * c);
                                	elseif (Float64(z * t) <= -5e-321)
                                		tmp = Float64(b * a);
                                	elseif (Float64(z * t) <= 1e+24)
                                		tmp = Float64(i * c);
                                	elseif (Float64(z * t) <= 2e+193)
                                		tmp = Float64(b * a);
                                	else
                                		tmp = Float64(t * z);
                                	end
                                	return tmp
                                end
                                
                                function tmp_2 = code(x, y, z, t, a, b, c, i)
                                	tmp = 0.0;
                                	if ((z * t) <= -5e+127)
                                		tmp = t * z;
                                	elseif ((z * t) <= -2e-91)
                                		tmp = i * c;
                                	elseif ((z * t) <= -5e-321)
                                		tmp = b * a;
                                	elseif ((z * t) <= 1e+24)
                                		tmp = i * c;
                                	elseif ((z * t) <= 2e+193)
                                		tmp = b * a;
                                	else
                                		tmp = t * z;
                                	end
                                	tmp_2 = tmp;
                                end
                                
                                code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -5e+127], N[(t * z), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -2e-91], N[(i * c), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -5e-321], N[(b * a), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+24], N[(i * c), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+193], N[(b * a), $MachinePrecision], N[(t * z), $MachinePrecision]]]]]]
                                
                                \begin{array}{l}
                                
                                \\
                                \begin{array}{l}
                                \mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+127}:\\
                                \;\;\;\;t \cdot z\\
                                
                                \mathbf{elif}\;z \cdot t \leq -2 \cdot 10^{-91}:\\
                                \;\;\;\;i \cdot c\\
                                
                                \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-321}:\\
                                \;\;\;\;b \cdot a\\
                                
                                \mathbf{elif}\;z \cdot t \leq 10^{+24}:\\
                                \;\;\;\;i \cdot c\\
                                
                                \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+193}:\\
                                \;\;\;\;b \cdot a\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;t \cdot z\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 3 regimes
                                2. if (*.f64 z t) < -5.0000000000000004e127 or 2.00000000000000013e193 < (*.f64 z t)

                                  1. Initial program 93.8%

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

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

                                      \[\leadsto \color{blue}{b \cdot a} + \left(c \cdot i + x \cdot y\right) \]
                                    2. lower-fma.f64N/A

                                      \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i + x \cdot y\right)} \]
                                    3. *-commutativeN/A

                                      \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{i \cdot c} + x \cdot y\right) \]
                                    4. lower-fma.f64N/A

                                      \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{\mathsf{fma}\left(i, c, x \cdot y\right)}\right) \]
                                    5. *-commutativeN/A

                                      \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
                                    6. lower-*.f6435.1

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

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

                                    \[\leadsto \mathsf{fma}\left(b, a, c \cdot i\right) \]
                                  7. Step-by-step derivation
                                    1. Applied rewrites24.2%

                                      \[\leadsto \mathsf{fma}\left(b, a, c \cdot i\right) \]
                                    2. Taylor expanded in i around inf

                                      \[\leadsto i \cdot \color{blue}{\left(c + \left(\frac{a \cdot b}{i} + \frac{x \cdot y}{i}\right)\right)} \]
                                    3. Step-by-step derivation
                                      1. Applied rewrites36.6%

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

                                        \[\leadsto \color{blue}{t \cdot z} \]
                                      3. Step-by-step derivation
                                        1. lower-*.f6469.0

                                          \[\leadsto \color{blue}{t \cdot z} \]
                                      4. Applied rewrites69.0%

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

                                      if -5.0000000000000004e127 < (*.f64 z t) < -2.00000000000000004e-91 or -4.99994e-321 < (*.f64 z t) < 9.9999999999999998e23

                                      1. Initial program 96.6%

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

                                        \[\leadsto \color{blue}{c \cdot i} \]
                                      4. Step-by-step derivation
                                        1. *-commutativeN/A

                                          \[\leadsto \color{blue}{i \cdot c} \]
                                        2. lower-*.f6443.2

                                          \[\leadsto \color{blue}{i \cdot c} \]
                                      5. Applied rewrites43.2%

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

                                      if -2.00000000000000004e-91 < (*.f64 z t) < -4.99994e-321 or 9.9999999999999998e23 < (*.f64 z t) < 2.00000000000000013e193

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

                                        \[\leadsto \color{blue}{a \cdot b + \left(c \cdot i + t \cdot z\right)} \]
                                      4. Step-by-step derivation
                                        1. *-commutativeN/A

                                          \[\leadsto \color{blue}{b \cdot a} + \left(c \cdot i + t \cdot z\right) \]
                                        2. lower-fma.f64N/A

                                          \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i + t \cdot z\right)} \]
                                        3. *-commutativeN/A

                                          \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{i \cdot c} + t \cdot z\right) \]
                                        4. lower-fma.f64N/A

                                          \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{\mathsf{fma}\left(i, c, t \cdot z\right)}\right) \]
                                        5. lower-*.f6468.9

                                          \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{t \cdot z}\right)\right) \]
                                      5. Applied rewrites68.9%

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

                                        \[\leadsto a \cdot b + \color{blue}{t \cdot z} \]
                                      7. Step-by-step derivation
                                        1. Applied rewrites60.9%

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

                                          \[\leadsto a \cdot b \]
                                        3. Step-by-step derivation
                                          1. Applied rewrites50.3%

                                            \[\leadsto b \cdot a \]
                                        4. Recombined 3 regimes into one program.
                                        5. Add Preprocessing

                                        Alternative 5: 66.2% accurate, 0.5× speedup?

                                        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(a, b, t \cdot z\right)\\ t_2 := \mathsf{fma}\left(i, c, b \cdot a\right)\\ \mathbf{if}\;c \cdot i \leq -2 \cdot 10^{+162}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;c \cdot i \leq -1 \cdot 10^{-308}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{-172}:\\ \;\;\;\;\mathsf{fma}\left(b, a, y \cdot x\right)\\ \mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{-7}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
                                        (FPCore (x y z t a b c i)
                                         :precision binary64
                                         (let* ((t_1 (fma a b (* t z))) (t_2 (fma i c (* b a))))
                                           (if (<= (* c i) -2e+162)
                                             t_2
                                             (if (<= (* c i) -1e-308)
                                               t_1
                                               (if (<= (* c i) 2e-172)
                                                 (fma b a (* y x))
                                                 (if (<= (* c i) 2e-7) 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 = fma(a, b, (t * z));
                                        	double t_2 = fma(i, c, (b * a));
                                        	double tmp;
                                        	if ((c * i) <= -2e+162) {
                                        		tmp = t_2;
                                        	} else if ((c * i) <= -1e-308) {
                                        		tmp = t_1;
                                        	} else if ((c * i) <= 2e-172) {
                                        		tmp = fma(b, a, (y * x));
                                        	} else if ((c * i) <= 2e-7) {
                                        		tmp = t_1;
                                        	} else {
                                        		tmp = t_2;
                                        	}
                                        	return tmp;
                                        }
                                        
                                        function code(x, y, z, t, a, b, c, i)
                                        	t_1 = fma(a, b, Float64(t * z))
                                        	t_2 = fma(i, c, Float64(b * a))
                                        	tmp = 0.0
                                        	if (Float64(c * i) <= -2e+162)
                                        		tmp = t_2;
                                        	elseif (Float64(c * i) <= -1e-308)
                                        		tmp = t_1;
                                        	elseif (Float64(c * i) <= 2e-172)
                                        		tmp = fma(b, a, Float64(y * x));
                                        	elseif (Float64(c * i) <= 2e-7)
                                        		tmp = t_1;
                                        	else
                                        		tmp = t_2;
                                        	end
                                        	return tmp
                                        end
                                        
                                        code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(a * b + N[(t * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(i * c + N[(b * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -2e+162], t$95$2, If[LessEqual[N[(c * i), $MachinePrecision], -1e-308], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], 2e-172], N[(b * a + N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 2e-7], t$95$1, t$95$2]]]]]]
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        \begin{array}{l}
                                        t_1 := \mathsf{fma}\left(a, b, t \cdot z\right)\\
                                        t_2 := \mathsf{fma}\left(i, c, b \cdot a\right)\\
                                        \mathbf{if}\;c \cdot i \leq -2 \cdot 10^{+162}:\\
                                        \;\;\;\;t\_2\\
                                        
                                        \mathbf{elif}\;c \cdot i \leq -1 \cdot 10^{-308}:\\
                                        \;\;\;\;t\_1\\
                                        
                                        \mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{-172}:\\
                                        \;\;\;\;\mathsf{fma}\left(b, a, y \cdot x\right)\\
                                        
                                        \mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{-7}:\\
                                        \;\;\;\;t\_1\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;t\_2\\
                                        
                                        
                                        \end{array}
                                        \end{array}
                                        
                                        Derivation
                                        1. Split input into 3 regimes
                                        2. if (*.f64 c i) < -1.9999999999999999e162 or 1.9999999999999999e-7 < (*.f64 c i)

                                          1. Initial program 88.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

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

                                              \[\leadsto \color{blue}{b \cdot a} + \left(c \cdot i + x \cdot y\right) \]
                                            2. lower-fma.f64N/A

                                              \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i + x \cdot y\right)} \]
                                            3. *-commutativeN/A

                                              \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{i \cdot c} + x \cdot y\right) \]
                                            4. lower-fma.f64N/A

                                              \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{\mathsf{fma}\left(i, c, x \cdot y\right)}\right) \]
                                            5. *-commutativeN/A

                                              \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
                                            6. lower-*.f6484.5

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

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

                                            \[\leadsto \mathsf{fma}\left(b, a, c \cdot i\right) \]
                                          7. Step-by-step derivation
                                            1. Applied rewrites78.0%

                                              \[\leadsto \mathsf{fma}\left(b, a, c \cdot i\right) \]
                                            2. Taylor expanded in x around 0

                                              \[\leadsto a \cdot b + \color{blue}{c \cdot i} \]
                                            3. Step-by-step derivation
                                              1. Applied rewrites82.3%

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

                                              if -1.9999999999999999e162 < (*.f64 c i) < -9.9999999999999991e-309 or 2.0000000000000001e-172 < (*.f64 c i) < 1.9999999999999999e-7

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

                                                \[\leadsto \color{blue}{a \cdot b + \left(c \cdot i + t \cdot z\right)} \]
                                              4. Step-by-step derivation
                                                1. *-commutativeN/A

                                                  \[\leadsto \color{blue}{b \cdot a} + \left(c \cdot i + t \cdot z\right) \]
                                                2. lower-fma.f64N/A

                                                  \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i + t \cdot z\right)} \]
                                                3. *-commutativeN/A

                                                  \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{i \cdot c} + t \cdot z\right) \]
                                                4. lower-fma.f64N/A

                                                  \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{\mathsf{fma}\left(i, c, t \cdot z\right)}\right) \]
                                                5. lower-*.f6478.0

                                                  \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{t \cdot z}\right)\right) \]
                                              5. Applied rewrites78.0%

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

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

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

                                                if -9.9999999999999991e-309 < (*.f64 c i) < 2.0000000000000001e-172

                                                1. Initial program 100.0%

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

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

                                                    \[\leadsto \color{blue}{b \cdot a} + \left(c \cdot i + x \cdot y\right) \]
                                                  2. lower-fma.f64N/A

                                                    \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i + x \cdot y\right)} \]
                                                  3. *-commutativeN/A

                                                    \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{i \cdot c} + x \cdot y\right) \]
                                                  4. lower-fma.f64N/A

                                                    \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{\mathsf{fma}\left(i, c, x \cdot y\right)}\right) \]
                                                  5. *-commutativeN/A

                                                    \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
                                                  6. lower-*.f6472.0

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

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

                                                  \[\leadsto \mathsf{fma}\left(b, a, c \cdot i\right) \]
                                                7. Step-by-step derivation
                                                  1. Applied rewrites24.3%

                                                    \[\leadsto \mathsf{fma}\left(b, a, c \cdot i\right) \]
                                                  2. Taylor expanded in c around 0

                                                    \[\leadsto a \cdot b + \color{blue}{x \cdot y} \]
                                                  3. Step-by-step derivation
                                                    1. Applied rewrites72.0%

                                                      \[\leadsto \mathsf{fma}\left(b, \color{blue}{a}, y \cdot x\right) \]
                                                  4. Recombined 3 regimes into one program.
                                                  5. Add Preprocessing

                                                  Alternative 6: 63.3% accurate, 0.7× speedup?

                                                  \[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(a, b, t \cdot z\right)\\ \mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+21}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \cdot t \leq -1 \cdot 10^{-86}:\\ \;\;\;\;i \cdot c\\ \mathbf{elif}\;z \cdot t \leq 10^{+118}:\\ \;\;\;\;\mathsf{fma}\left(b, a, y \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                                                  (FPCore (x y z t a b c i)
                                                   :precision binary64
                                                   (let* ((t_1 (fma a b (* t z))))
                                                     (if (<= (* z t) -5e+21)
                                                       t_1
                                                       (if (<= (* z t) -1e-86)
                                                         (* i c)
                                                         (if (<= (* z t) 1e+118) (fma b a (* y x)) t_1)))))
                                                  double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                                  	double t_1 = fma(a, b, (t * z));
                                                  	double tmp;
                                                  	if ((z * t) <= -5e+21) {
                                                  		tmp = t_1;
                                                  	} else if ((z * t) <= -1e-86) {
                                                  		tmp = i * c;
                                                  	} else if ((z * t) <= 1e+118) {
                                                  		tmp = fma(b, a, (y * x));
                                                  	} else {
                                                  		tmp = t_1;
                                                  	}
                                                  	return tmp;
                                                  }
                                                  
                                                  function code(x, y, z, t, a, b, c, i)
                                                  	t_1 = fma(a, b, Float64(t * z))
                                                  	tmp = 0.0
                                                  	if (Float64(z * t) <= -5e+21)
                                                  		tmp = t_1;
                                                  	elseif (Float64(z * t) <= -1e-86)
                                                  		tmp = Float64(i * c);
                                                  	elseif (Float64(z * t) <= 1e+118)
                                                  		tmp = fma(b, a, Float64(y * x));
                                                  	else
                                                  		tmp = t_1;
                                                  	end
                                                  	return tmp
                                                  end
                                                  
                                                  code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(a * b + N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -5e+21], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], -1e-86], N[(i * c), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+118], N[(b * a + N[(y * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
                                                  
                                                  \begin{array}{l}
                                                  
                                                  \\
                                                  \begin{array}{l}
                                                  t_1 := \mathsf{fma}\left(a, b, t \cdot z\right)\\
                                                  \mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+21}:\\
                                                  \;\;\;\;t\_1\\
                                                  
                                                  \mathbf{elif}\;z \cdot t \leq -1 \cdot 10^{-86}:\\
                                                  \;\;\;\;i \cdot c\\
                                                  
                                                  \mathbf{elif}\;z \cdot t \leq 10^{+118}:\\
                                                  \;\;\;\;\mathsf{fma}\left(b, a, y \cdot x\right)\\
                                                  
                                                  \mathbf{else}:\\
                                                  \;\;\;\;t\_1\\
                                                  
                                                  
                                                  \end{array}
                                                  \end{array}
                                                  
                                                  Derivation
                                                  1. Split input into 3 regimes
                                                  2. if (*.f64 z t) < -5e21 or 9.99999999999999967e117 < (*.f64 z t)

                                                    1. Initial program 93.7%

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

                                                      \[\leadsto \color{blue}{a \cdot b + \left(c \cdot i + t \cdot z\right)} \]
                                                    4. Step-by-step derivation
                                                      1. *-commutativeN/A

                                                        \[\leadsto \color{blue}{b \cdot a} + \left(c \cdot i + t \cdot z\right) \]
                                                      2. lower-fma.f64N/A

                                                        \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i + t \cdot z\right)} \]
                                                      3. *-commutativeN/A

                                                        \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{i \cdot c} + t \cdot z\right) \]
                                                      4. lower-fma.f64N/A

                                                        \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{\mathsf{fma}\left(i, c, t \cdot z\right)}\right) \]
                                                      5. lower-*.f6482.6

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

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

                                                      \[\leadsto a \cdot b + \color{blue}{t \cdot z} \]
                                                    7. Step-by-step derivation
                                                      1. Applied rewrites77.2%

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

                                                      if -5e21 < (*.f64 z t) < -1.00000000000000008e-86

                                                      1. Initial program 86.7%

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

                                                        \[\leadsto \color{blue}{c \cdot i} \]
                                                      4. Step-by-step derivation
                                                        1. *-commutativeN/A

                                                          \[\leadsto \color{blue}{i \cdot c} \]
                                                        2. lower-*.f6474.5

                                                          \[\leadsto \color{blue}{i \cdot c} \]
                                                      5. Applied rewrites74.5%

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

                                                      if -1.00000000000000008e-86 < (*.f64 z t) < 9.99999999999999967e117

                                                      1. Initial program 97.6%

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

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

                                                          \[\leadsto \color{blue}{b \cdot a} + \left(c \cdot i + x \cdot y\right) \]
                                                        2. lower-fma.f64N/A

                                                          \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i + x \cdot y\right)} \]
                                                        3. *-commutativeN/A

                                                          \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{i \cdot c} + x \cdot y\right) \]
                                                        4. lower-fma.f64N/A

                                                          \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{\mathsf{fma}\left(i, c, x \cdot y\right)}\right) \]
                                                        5. *-commutativeN/A

                                                          \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
                                                        6. lower-*.f6491.8

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

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

                                                        \[\leadsto \mathsf{fma}\left(b, a, c \cdot i\right) \]
                                                      7. Step-by-step derivation
                                                        1. Applied rewrites63.3%

                                                          \[\leadsto \mathsf{fma}\left(b, a, c \cdot i\right) \]
                                                        2. Taylor expanded in c around 0

                                                          \[\leadsto a \cdot b + \color{blue}{x \cdot y} \]
                                                        3. Step-by-step derivation
                                                          1. Applied rewrites62.7%

                                                            \[\leadsto \mathsf{fma}\left(b, \color{blue}{a}, y \cdot x\right) \]
                                                        4. Recombined 3 regimes into one program.
                                                        5. Add Preprocessing

                                                        Alternative 7: 89.0% accurate, 0.7× speedup?

                                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+23} \lor \neg \left(a \cdot b \leq 4 \cdot 10^{-13}\right):\\ \;\;\;\;\mathsf{fma}\left(x, y, \mathsf{fma}\left(c, i, a \cdot b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, t, \mathsf{fma}\left(c, i, x \cdot y\right)\right)\\ \end{array} \end{array} \]
                                                        (FPCore (x y z t a b c i)
                                                         :precision binary64
                                                         (if (or (<= (* a b) -2e+23) (not (<= (* a b) 4e-13)))
                                                           (fma x y (fma c i (* a b)))
                                                           (fma z t (fma c i (* x y)))))
                                                        double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                                        	double tmp;
                                                        	if (((a * b) <= -2e+23) || !((a * b) <= 4e-13)) {
                                                        		tmp = fma(x, y, fma(c, i, (a * b)));
                                                        	} else {
                                                        		tmp = fma(z, t, fma(c, i, (x * y)));
                                                        	}
                                                        	return tmp;
                                                        }
                                                        
                                                        function code(x, y, z, t, a, b, c, i)
                                                        	tmp = 0.0
                                                        	if ((Float64(a * b) <= -2e+23) || !(Float64(a * b) <= 4e-13))
                                                        		tmp = fma(x, y, fma(c, i, Float64(a * b)));
                                                        	else
                                                        		tmp = fma(z, t, fma(c, i, Float64(x * y)));
                                                        	end
                                                        	return tmp
                                                        end
                                                        
                                                        code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -2e+23], N[Not[LessEqual[N[(a * b), $MachinePrecision], 4e-13]], $MachinePrecision]], N[(x * y + N[(c * i + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * t + N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                                        
                                                        \begin{array}{l}
                                                        
                                                        \\
                                                        \begin{array}{l}
                                                        \mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+23} \lor \neg \left(a \cdot b \leq 4 \cdot 10^{-13}\right):\\
                                                        \;\;\;\;\mathsf{fma}\left(x, y, \mathsf{fma}\left(c, i, a \cdot b\right)\right)\\
                                                        
                                                        \mathbf{else}:\\
                                                        \;\;\;\;\mathsf{fma}\left(z, t, \mathsf{fma}\left(c, i, x \cdot y\right)\right)\\
                                                        
                                                        
                                                        \end{array}
                                                        \end{array}
                                                        
                                                        Derivation
                                                        1. Split input into 2 regimes
                                                        2. if (*.f64 a b) < -1.9999999999999998e23 or 4.0000000000000001e-13 < (*.f64 a b)

                                                          1. Initial program 91.6%

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

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

                                                              \[\leadsto \color{blue}{b \cdot a} + \left(c \cdot i + x \cdot y\right) \]
                                                            2. lower-fma.f64N/A

                                                              \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i + x \cdot y\right)} \]
                                                            3. *-commutativeN/A

                                                              \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{i \cdot c} + x \cdot y\right) \]
                                                            4. lower-fma.f64N/A

                                                              \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{\mathsf{fma}\left(i, c, x \cdot y\right)}\right) \]
                                                            5. *-commutativeN/A

                                                              \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
                                                            6. lower-*.f6482.7

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

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

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

                                                            if -1.9999999999999998e23 < (*.f64 a b) < 4.0000000000000001e-13

                                                            1. Initial program 99.2%

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

                                                              \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
                                                            4. Step-by-step derivation
                                                              1. *-commutativeN/A

                                                                \[\leadsto \color{blue}{i \cdot c} + \left(t \cdot z + x \cdot y\right) \]
                                                              2. lower-fma.f64N/A

                                                                \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, t \cdot z + x \cdot y\right)} \]
                                                              3. lower-fma.f64N/A

                                                                \[\leadsto \mathsf{fma}\left(i, c, \color{blue}{\mathsf{fma}\left(t, z, x \cdot y\right)}\right) \]
                                                              4. *-commutativeN/A

                                                                \[\leadsto \mathsf{fma}\left(i, c, \mathsf{fma}\left(t, z, \color{blue}{y \cdot x}\right)\right) \]
                                                              5. lower-*.f6498.2

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

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

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

                                                              \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+23} \lor \neg \left(a \cdot b \leq 4 \cdot 10^{-13}\right):\\ \;\;\;\;\mathsf{fma}\left(x, y, \mathsf{fma}\left(c, i, a \cdot b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, t, \mathsf{fma}\left(c, i, x \cdot y\right)\right)\\ \end{array} \]
                                                            9. Add Preprocessing

                                                            Alternative 8: 89.0% accurate, 0.7× speedup?

                                                            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+23} \lor \neg \left(a \cdot b \leq 4 \cdot 10^{-13}\right):\\ \;\;\;\;\mathsf{fma}\left(x, y, \mathsf{fma}\left(c, i, a \cdot b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(i, c, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\\ \end{array} \end{array} \]
                                                            (FPCore (x y z t a b c i)
                                                             :precision binary64
                                                             (if (or (<= (* a b) -2e+23) (not (<= (* a b) 4e-13)))
                                                               (fma x y (fma c i (* a b)))
                                                               (fma i c (fma t z (* y x)))))
                                                            double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                                            	double tmp;
                                                            	if (((a * b) <= -2e+23) || !((a * b) <= 4e-13)) {
                                                            		tmp = fma(x, y, fma(c, i, (a * b)));
                                                            	} else {
                                                            		tmp = fma(i, c, fma(t, z, (y * x)));
                                                            	}
                                                            	return tmp;
                                                            }
                                                            
                                                            function code(x, y, z, t, a, b, c, i)
                                                            	tmp = 0.0
                                                            	if ((Float64(a * b) <= -2e+23) || !(Float64(a * b) <= 4e-13))
                                                            		tmp = fma(x, y, fma(c, i, Float64(a * b)));
                                                            	else
                                                            		tmp = fma(i, c, fma(t, z, Float64(y * x)));
                                                            	end
                                                            	return tmp
                                                            end
                                                            
                                                            code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -2e+23], N[Not[LessEqual[N[(a * b), $MachinePrecision], 4e-13]], $MachinePrecision]], N[(x * y + N[(c * i + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(i * c + N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                                            
                                                            \begin{array}{l}
                                                            
                                                            \\
                                                            \begin{array}{l}
                                                            \mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+23} \lor \neg \left(a \cdot b \leq 4 \cdot 10^{-13}\right):\\
                                                            \;\;\;\;\mathsf{fma}\left(x, y, \mathsf{fma}\left(c, i, a \cdot b\right)\right)\\
                                                            
                                                            \mathbf{else}:\\
                                                            \;\;\;\;\mathsf{fma}\left(i, c, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\\
                                                            
                                                            
                                                            \end{array}
                                                            \end{array}
                                                            
                                                            Derivation
                                                            1. Split input into 2 regimes
                                                            2. if (*.f64 a b) < -1.9999999999999998e23 or 4.0000000000000001e-13 < (*.f64 a b)

                                                              1. Initial program 91.6%

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

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

                                                                  \[\leadsto \color{blue}{b \cdot a} + \left(c \cdot i + x \cdot y\right) \]
                                                                2. lower-fma.f64N/A

                                                                  \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i + x \cdot y\right)} \]
                                                                3. *-commutativeN/A

                                                                  \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{i \cdot c} + x \cdot y\right) \]
                                                                4. lower-fma.f64N/A

                                                                  \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{\mathsf{fma}\left(i, c, x \cdot y\right)}\right) \]
                                                                5. *-commutativeN/A

                                                                  \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
                                                                6. lower-*.f6482.7

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

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

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

                                                                if -1.9999999999999998e23 < (*.f64 a b) < 4.0000000000000001e-13

                                                                1. Initial program 99.2%

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

                                                                  \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
                                                                4. Step-by-step derivation
                                                                  1. *-commutativeN/A

                                                                    \[\leadsto \color{blue}{i \cdot c} + \left(t \cdot z + x \cdot y\right) \]
                                                                  2. lower-fma.f64N/A

                                                                    \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, t \cdot z + x \cdot y\right)} \]
                                                                  3. lower-fma.f64N/A

                                                                    \[\leadsto \mathsf{fma}\left(i, c, \color{blue}{\mathsf{fma}\left(t, z, x \cdot y\right)}\right) \]
                                                                  4. *-commutativeN/A

                                                                    \[\leadsto \mathsf{fma}\left(i, c, \mathsf{fma}\left(t, z, \color{blue}{y \cdot x}\right)\right) \]
                                                                  5. lower-*.f6498.2

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

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

                                                                \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+23} \lor \neg \left(a \cdot b \leq 4 \cdot 10^{-13}\right):\\ \;\;\;\;\mathsf{fma}\left(x, y, \mathsf{fma}\left(c, i, a \cdot b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(i, c, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\\ \end{array} \]
                                                              9. Add Preprocessing

                                                              Alternative 9: 88.8% accurate, 0.7× speedup?

                                                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+186} \lor \neg \left(x \cdot y \leq 10^{+45}\right):\\ \;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, y \cdot x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\ \end{array} \end{array} \]
                                                              (FPCore (x y z t a b c i)
                                                               :precision binary64
                                                               (if (or (<= (* x y) -1e+186) (not (<= (* x y) 1e+45)))
                                                                 (fma b a (fma i c (* y x)))
                                                                 (fma b a (fma i c (* t z)))))
                                                              double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                                              	double tmp;
                                                              	if (((x * y) <= -1e+186) || !((x * y) <= 1e+45)) {
                                                              		tmp = fma(b, a, fma(i, c, (y * x)));
                                                              	} else {
                                                              		tmp = fma(b, a, fma(i, c, (t * z)));
                                                              	}
                                                              	return tmp;
                                                              }
                                                              
                                                              function code(x, y, z, t, a, b, c, i)
                                                              	tmp = 0.0
                                                              	if ((Float64(x * y) <= -1e+186) || !(Float64(x * y) <= 1e+45))
                                                              		tmp = fma(b, a, fma(i, c, Float64(y * x)));
                                                              	else
                                                              		tmp = fma(b, a, fma(i, c, Float64(t * z)));
                                                              	end
                                                              	return tmp
                                                              end
                                                              
                                                              code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -1e+186], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1e+45]], $MachinePrecision]], N[(b * a + N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b * a + N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                                              
                                                              \begin{array}{l}
                                                              
                                                              \\
                                                              \begin{array}{l}
                                                              \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+186} \lor \neg \left(x \cdot y \leq 10^{+45}\right):\\
                                                              \;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, y \cdot x\right)\right)\\
                                                              
                                                              \mathbf{else}:\\
                                                              \;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\
                                                              
                                                              
                                                              \end{array}
                                                              \end{array}
                                                              
                                                              Derivation
                                                              1. Split input into 2 regimes
                                                              2. if (*.f64 x y) < -9.9999999999999998e185 or 9.9999999999999993e44 < (*.f64 x y)

                                                                1. Initial program 93.2%

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

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

                                                                    \[\leadsto \color{blue}{b \cdot a} + \left(c \cdot i + x \cdot y\right) \]
                                                                  2. lower-fma.f64N/A

                                                                    \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i + x \cdot y\right)} \]
                                                                  3. *-commutativeN/A

                                                                    \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{i \cdot c} + x \cdot y\right) \]
                                                                  4. lower-fma.f64N/A

                                                                    \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{\mathsf{fma}\left(i, c, x \cdot y\right)}\right) \]
                                                                  5. *-commutativeN/A

                                                                    \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
                                                                  6. lower-*.f6486.7

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

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

                                                                if -9.9999999999999998e185 < (*.f64 x y) < 9.9999999999999993e44

                                                                1. Initial program 96.1%

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

                                                                  \[\leadsto \color{blue}{a \cdot b + \left(c \cdot i + t \cdot z\right)} \]
                                                                4. Step-by-step derivation
                                                                  1. *-commutativeN/A

                                                                    \[\leadsto \color{blue}{b \cdot a} + \left(c \cdot i + t \cdot z\right) \]
                                                                  2. lower-fma.f64N/A

                                                                    \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i + t \cdot z\right)} \]
                                                                  3. *-commutativeN/A

                                                                    \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{i \cdot c} + t \cdot z\right) \]
                                                                  4. lower-fma.f64N/A

                                                                    \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{\mathsf{fma}\left(i, c, t \cdot z\right)}\right) \]
                                                                  5. lower-*.f6489.2

                                                                    \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{t \cdot z}\right)\right) \]
                                                                5. Applied rewrites89.2%

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

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

                                                              Alternative 10: 84.6% accurate, 0.7× speedup?

                                                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+87} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{+64}\right):\\ \;\;\;\;\mathsf{fma}\left(t, z, x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\ \end{array} \end{array} \]
                                                              (FPCore (x y z t a b c i)
                                                               :precision binary64
                                                               (if (or (<= (* x y) -1e+87) (not (<= (* x y) 2e+64)))
                                                                 (fma t z (* x y))
                                                                 (fma b a (fma i c (* t z)))))
                                                              double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                                              	double tmp;
                                                              	if (((x * y) <= -1e+87) || !((x * y) <= 2e+64)) {
                                                              		tmp = fma(t, z, (x * y));
                                                              	} else {
                                                              		tmp = fma(b, a, fma(i, c, (t * z)));
                                                              	}
                                                              	return tmp;
                                                              }
                                                              
                                                              function code(x, y, z, t, a, b, c, i)
                                                              	tmp = 0.0
                                                              	if ((Float64(x * y) <= -1e+87) || !(Float64(x * y) <= 2e+64))
                                                              		tmp = fma(t, z, Float64(x * y));
                                                              	else
                                                              		tmp = fma(b, a, fma(i, c, Float64(t * z)));
                                                              	end
                                                              	return tmp
                                                              end
                                                              
                                                              code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -1e+87], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2e+64]], $MachinePrecision]], N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(b * a + N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                                              
                                                              \begin{array}{l}
                                                              
                                                              \\
                                                              \begin{array}{l}
                                                              \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+87} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{+64}\right):\\
                                                              \;\;\;\;\mathsf{fma}\left(t, z, x \cdot y\right)\\
                                                              
                                                              \mathbf{else}:\\
                                                              \;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\
                                                              
                                                              
                                                              \end{array}
                                                              \end{array}
                                                              
                                                              Derivation
                                                              1. Split input into 2 regimes
                                                              2. if (*.f64 x y) < -9.9999999999999996e86 or 2.00000000000000004e64 < (*.f64 x y)

                                                                1. Initial program 93.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

                                                                  \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
                                                                4. Step-by-step derivation
                                                                  1. *-commutativeN/A

                                                                    \[\leadsto \color{blue}{i \cdot c} + \left(t \cdot z + x \cdot y\right) \]
                                                                  2. lower-fma.f64N/A

                                                                    \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, t \cdot z + x \cdot y\right)} \]
                                                                  3. lower-fma.f64N/A

                                                                    \[\leadsto \mathsf{fma}\left(i, c, \color{blue}{\mathsf{fma}\left(t, z, x \cdot y\right)}\right) \]
                                                                  4. *-commutativeN/A

                                                                    \[\leadsto \mathsf{fma}\left(i, c, \mathsf{fma}\left(t, z, \color{blue}{y \cdot x}\right)\right) \]
                                                                  5. lower-*.f6486.8

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

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

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

                                                                    \[\leadsto \mathsf{fma}\left(z, t, c \cdot i\right) \]
                                                                  3. Step-by-step derivation
                                                                    1. Applied rewrites35.7%

                                                                      \[\leadsto \mathsf{fma}\left(z, t, i \cdot c\right) \]
                                                                    2. Taylor expanded in c around 0

                                                                      \[\leadsto t \cdot z + \color{blue}{x \cdot y} \]
                                                                    3. Step-by-step derivation
                                                                      1. Applied rewrites76.1%

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

                                                                      if -9.9999999999999996e86 < (*.f64 x y) < 2.00000000000000004e64

                                                                      1. Initial program 96.4%

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

                                                                        \[\leadsto \color{blue}{a \cdot b + \left(c \cdot i + t \cdot z\right)} \]
                                                                      4. Step-by-step derivation
                                                                        1. *-commutativeN/A

                                                                          \[\leadsto \color{blue}{b \cdot a} + \left(c \cdot i + t \cdot z\right) \]
                                                                        2. lower-fma.f64N/A

                                                                          \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i + t \cdot z\right)} \]
                                                                        3. *-commutativeN/A

                                                                          \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{i \cdot c} + t \cdot z\right) \]
                                                                        4. lower-fma.f64N/A

                                                                          \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{\mathsf{fma}\left(i, c, t \cdot z\right)}\right) \]
                                                                        5. lower-*.f6491.3

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

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

                                                                      \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+87} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{+64}\right):\\ \;\;\;\;\mathsf{fma}\left(t, z, x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\ \end{array} \]
                                                                    6. Add Preprocessing

                                                                    Alternative 11: 87.6% accurate, 0.7× speedup?

                                                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+191}:\\ \;\;\;\;\mathsf{fma}\left(i, c, b \cdot a\right)\\ \mathbf{elif}\;a \cdot b \leq 4 \cdot 10^{-13}:\\ \;\;\;\;\mathsf{fma}\left(i, c, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, y \cdot x\right)\right)\\ \end{array} \end{array} \]
                                                                    (FPCore (x y z t a b c i)
                                                                     :precision binary64
                                                                     (if (<= (* a b) -5e+191)
                                                                       (fma i c (* b a))
                                                                       (if (<= (* a b) 4e-13)
                                                                         (fma i c (fma t z (* y x)))
                                                                         (fma b a (fma i c (* y x))))))
                                                                    double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                                                    	double tmp;
                                                                    	if ((a * b) <= -5e+191) {
                                                                    		tmp = fma(i, c, (b * a));
                                                                    	} else if ((a * b) <= 4e-13) {
                                                                    		tmp = fma(i, c, fma(t, z, (y * x)));
                                                                    	} else {
                                                                    		tmp = fma(b, a, fma(i, c, (y * x)));
                                                                    	}
                                                                    	return tmp;
                                                                    }
                                                                    
                                                                    function code(x, y, z, t, a, b, c, i)
                                                                    	tmp = 0.0
                                                                    	if (Float64(a * b) <= -5e+191)
                                                                    		tmp = fma(i, c, Float64(b * a));
                                                                    	elseif (Float64(a * b) <= 4e-13)
                                                                    		tmp = fma(i, c, fma(t, z, Float64(y * x)));
                                                                    	else
                                                                    		tmp = fma(b, a, fma(i, c, Float64(y * x)));
                                                                    	end
                                                                    	return tmp
                                                                    end
                                                                    
                                                                    code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -5e+191], N[(i * c + N[(b * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 4e-13], N[(i * c + N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b * a + N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                                                                    
                                                                    \begin{array}{l}
                                                                    
                                                                    \\
                                                                    \begin{array}{l}
                                                                    \mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+191}:\\
                                                                    \;\;\;\;\mathsf{fma}\left(i, c, b \cdot a\right)\\
                                                                    
                                                                    \mathbf{elif}\;a \cdot b \leq 4 \cdot 10^{-13}:\\
                                                                    \;\;\;\;\mathsf{fma}\left(i, c, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\\
                                                                    
                                                                    \mathbf{else}:\\
                                                                    \;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, y \cdot x\right)\right)\\
                                                                    
                                                                    
                                                                    \end{array}
                                                                    \end{array}
                                                                    
                                                                    Derivation
                                                                    1. Split input into 3 regimes
                                                                    2. if (*.f64 a b) < -5.0000000000000002e191

                                                                      1. Initial program 89.1%

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

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

                                                                          \[\leadsto \color{blue}{b \cdot a} + \left(c \cdot i + x \cdot y\right) \]
                                                                        2. lower-fma.f64N/A

                                                                          \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i + x \cdot y\right)} \]
                                                                        3. *-commutativeN/A

                                                                          \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{i \cdot c} + x \cdot y\right) \]
                                                                        4. lower-fma.f64N/A

                                                                          \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{\mathsf{fma}\left(i, c, x \cdot y\right)}\right) \]
                                                                        5. *-commutativeN/A

                                                                          \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
                                                                        6. lower-*.f6484.0

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

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

                                                                        \[\leadsto \mathsf{fma}\left(b, a, c \cdot i\right) \]
                                                                      7. Step-by-step derivation
                                                                        1. Applied rewrites84.6%

                                                                          \[\leadsto \mathsf{fma}\left(b, a, c \cdot i\right) \]
                                                                        2. Taylor expanded in x around 0

                                                                          \[\leadsto a \cdot b + \color{blue}{c \cdot i} \]
                                                                        3. Step-by-step derivation
                                                                          1. Applied rewrites90.0%

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

                                                                          if -5.0000000000000002e191 < (*.f64 a b) < 4.0000000000000001e-13

                                                                          1. Initial program 98.6%

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

                                                                            \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
                                                                          4. Step-by-step derivation
                                                                            1. *-commutativeN/A

                                                                              \[\leadsto \color{blue}{i \cdot c} + \left(t \cdot z + x \cdot y\right) \]
                                                                            2. lower-fma.f64N/A

                                                                              \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, t \cdot z + x \cdot y\right)} \]
                                                                            3. lower-fma.f64N/A

                                                                              \[\leadsto \mathsf{fma}\left(i, c, \color{blue}{\mathsf{fma}\left(t, z, x \cdot y\right)}\right) \]
                                                                            4. *-commutativeN/A

                                                                              \[\leadsto \mathsf{fma}\left(i, c, \mathsf{fma}\left(t, z, \color{blue}{y \cdot x}\right)\right) \]
                                                                            5. lower-*.f6494.6

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

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

                                                                          if 4.0000000000000001e-13 < (*.f64 a b)

                                                                          1. Initial program 91.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

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

                                                                              \[\leadsto \color{blue}{b \cdot a} + \left(c \cdot i + x \cdot y\right) \]
                                                                            2. lower-fma.f64N/A

                                                                              \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i + x \cdot y\right)} \]
                                                                            3. *-commutativeN/A

                                                                              \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{i \cdot c} + x \cdot y\right) \]
                                                                            4. lower-fma.f64N/A

                                                                              \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{\mathsf{fma}\left(i, c, x \cdot y\right)}\right) \]
                                                                            5. *-commutativeN/A

                                                                              \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
                                                                            6. lower-*.f6485.2

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

                                                                            \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, y \cdot x\right)\right)} \]
                                                                        4. Recombined 3 regimes into one program.
                                                                        5. Add Preprocessing

                                                                        Alternative 12: 63.0% accurate, 0.9× speedup?

                                                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1 \cdot 10^{+286} \lor \neg \left(c \cdot i \leq 10^{+130}\right):\\ \;\;\;\;i \cdot c\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, b, t \cdot z\right)\\ \end{array} \end{array} \]
                                                                        (FPCore (x y z t a b c i)
                                                                         :precision binary64
                                                                         (if (or (<= (* c i) -1e+286) (not (<= (* c i) 1e+130)))
                                                                           (* i c)
                                                                           (fma a b (* t z))))
                                                                        double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                                                        	double tmp;
                                                                        	if (((c * i) <= -1e+286) || !((c * i) <= 1e+130)) {
                                                                        		tmp = i * c;
                                                                        	} else {
                                                                        		tmp = fma(a, b, (t * z));
                                                                        	}
                                                                        	return tmp;
                                                                        }
                                                                        
                                                                        function code(x, y, z, t, a, b, c, i)
                                                                        	tmp = 0.0
                                                                        	if ((Float64(c * i) <= -1e+286) || !(Float64(c * i) <= 1e+130))
                                                                        		tmp = Float64(i * c);
                                                                        	else
                                                                        		tmp = fma(a, b, Float64(t * z));
                                                                        	end
                                                                        	return tmp
                                                                        end
                                                                        
                                                                        code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(c * i), $MachinePrecision], -1e+286], N[Not[LessEqual[N[(c * i), $MachinePrecision], 1e+130]], $MachinePrecision]], N[(i * c), $MachinePrecision], N[(a * b + N[(t * z), $MachinePrecision]), $MachinePrecision]]
                                                                        
                                                                        \begin{array}{l}
                                                                        
                                                                        \\
                                                                        \begin{array}{l}
                                                                        \mathbf{if}\;c \cdot i \leq -1 \cdot 10^{+286} \lor \neg \left(c \cdot i \leq 10^{+130}\right):\\
                                                                        \;\;\;\;i \cdot c\\
                                                                        
                                                                        \mathbf{else}:\\
                                                                        \;\;\;\;\mathsf{fma}\left(a, b, t \cdot z\right)\\
                                                                        
                                                                        
                                                                        \end{array}
                                                                        \end{array}
                                                                        
                                                                        Derivation
                                                                        1. Split input into 2 regimes
                                                                        2. if (*.f64 c i) < -1.00000000000000003e286 or 1.0000000000000001e130 < (*.f64 c i)

                                                                          1. Initial program 82.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

                                                                            \[\leadsto \color{blue}{c \cdot i} \]
                                                                          4. Step-by-step derivation
                                                                            1. *-commutativeN/A

                                                                              \[\leadsto \color{blue}{i \cdot c} \]
                                                                            2. lower-*.f6478.7

                                                                              \[\leadsto \color{blue}{i \cdot c} \]
                                                                          5. Applied rewrites78.7%

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

                                                                          if -1.00000000000000003e286 < (*.f64 c i) < 1.0000000000000001e130

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

                                                                            \[\leadsto \color{blue}{a \cdot b + \left(c \cdot i + t \cdot z\right)} \]
                                                                          4. Step-by-step derivation
                                                                            1. *-commutativeN/A

                                                                              \[\leadsto \color{blue}{b \cdot a} + \left(c \cdot i + t \cdot z\right) \]
                                                                            2. lower-fma.f64N/A

                                                                              \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i + t \cdot z\right)} \]
                                                                            3. *-commutativeN/A

                                                                              \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{i \cdot c} + t \cdot z\right) \]
                                                                            4. lower-fma.f64N/A

                                                                              \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{\mathsf{fma}\left(i, c, t \cdot z\right)}\right) \]
                                                                            5. lower-*.f6472.9

                                                                              \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{t \cdot z}\right)\right) \]
                                                                          5. Applied rewrites72.9%

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

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

                                                                              \[\leadsto \mathsf{fma}\left(a, \color{blue}{b}, t \cdot z\right) \]
                                                                          8. Recombined 2 regimes into one program.
                                                                          9. Final simplification67.0%

                                                                            \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1 \cdot 10^{+286} \lor \neg \left(c \cdot i \leq 10^{+130}\right):\\ \;\;\;\;i \cdot c\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, b, t \cdot z\right)\\ \end{array} \]
                                                                          10. Add Preprocessing

                                                                          Alternative 13: 43.6% accurate, 1.1× speedup?

                                                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+211} \lor \neg \left(a \cdot b \leq 10^{+65}\right):\\ \;\;\;\;b \cdot a\\ \mathbf{else}:\\ \;\;\;\;i \cdot c\\ \end{array} \end{array} \]
                                                                          (FPCore (x y z t a b c i)
                                                                           :precision binary64
                                                                           (if (or (<= (* a b) -5e+211) (not (<= (* a b) 1e+65))) (* b a) (* i c)))
                                                                          double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                                                          	double tmp;
                                                                          	if (((a * b) <= -5e+211) || !((a * b) <= 1e+65)) {
                                                                          		tmp = b * a;
                                                                          	} else {
                                                                          		tmp = i * c;
                                                                          	}
                                                                          	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) <= (-5d+211)) .or. (.not. ((a * b) <= 1d+65))) then
                                                                                  tmp = b * a
                                                                              else
                                                                                  tmp = i * c
                                                                              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) <= -5e+211) || !((a * b) <= 1e+65)) {
                                                                          		tmp = b * a;
                                                                          	} else {
                                                                          		tmp = i * c;
                                                                          	}
                                                                          	return tmp;
                                                                          }
                                                                          
                                                                          def code(x, y, z, t, a, b, c, i):
                                                                          	tmp = 0
                                                                          	if ((a * b) <= -5e+211) or not ((a * b) <= 1e+65):
                                                                          		tmp = b * a
                                                                          	else:
                                                                          		tmp = i * c
                                                                          	return tmp
                                                                          
                                                                          function code(x, y, z, t, a, b, c, i)
                                                                          	tmp = 0.0
                                                                          	if ((Float64(a * b) <= -5e+211) || !(Float64(a * b) <= 1e+65))
                                                                          		tmp = Float64(b * a);
                                                                          	else
                                                                          		tmp = Float64(i * c);
                                                                          	end
                                                                          	return tmp
                                                                          end
                                                                          
                                                                          function tmp_2 = code(x, y, z, t, a, b, c, i)
                                                                          	tmp = 0.0;
                                                                          	if (((a * b) <= -5e+211) || ~(((a * b) <= 1e+65)))
                                                                          		tmp = b * a;
                                                                          	else
                                                                          		tmp = i * c;
                                                                          	end
                                                                          	tmp_2 = tmp;
                                                                          end
                                                                          
                                                                          code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -5e+211], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1e+65]], $MachinePrecision]], N[(b * a), $MachinePrecision], N[(i * c), $MachinePrecision]]
                                                                          
                                                                          \begin{array}{l}
                                                                          
                                                                          \\
                                                                          \begin{array}{l}
                                                                          \mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+211} \lor \neg \left(a \cdot b \leq 10^{+65}\right):\\
                                                                          \;\;\;\;b \cdot a\\
                                                                          
                                                                          \mathbf{else}:\\
                                                                          \;\;\;\;i \cdot c\\
                                                                          
                                                                          
                                                                          \end{array}
                                                                          \end{array}
                                                                          
                                                                          Derivation
                                                                          1. Split input into 2 regimes
                                                                          2. if (*.f64 a b) < -4.9999999999999995e211 or 9.9999999999999999e64 < (*.f64 a b)

                                                                            1. Initial program 89.9%

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

                                                                              \[\leadsto \color{blue}{a \cdot b + \left(c \cdot i + t \cdot z\right)} \]
                                                                            4. Step-by-step derivation
                                                                              1. *-commutativeN/A

                                                                                \[\leadsto \color{blue}{b \cdot a} + \left(c \cdot i + t \cdot z\right) \]
                                                                              2. lower-fma.f64N/A

                                                                                \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i + t \cdot z\right)} \]
                                                                              3. *-commutativeN/A

                                                                                \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{i \cdot c} + t \cdot z\right) \]
                                                                              4. lower-fma.f64N/A

                                                                                \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{\mathsf{fma}\left(i, c, t \cdot z\right)}\right) \]
                                                                              5. lower-*.f6485.4

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

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

                                                                              \[\leadsto a \cdot b + \color{blue}{t \cdot z} \]
                                                                            7. Step-by-step derivation
                                                                              1. Applied rewrites80.7%

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

                                                                                \[\leadsto a \cdot b \]
                                                                              3. Step-by-step derivation
                                                                                1. Applied rewrites70.5%

                                                                                  \[\leadsto b \cdot a \]

                                                                                if -4.9999999999999995e211 < (*.f64 a b) < 9.9999999999999999e64

                                                                                1. Initial program 98.2%

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

                                                                                  \[\leadsto \color{blue}{c \cdot i} \]
                                                                                4. Step-by-step derivation
                                                                                  1. *-commutativeN/A

                                                                                    \[\leadsto \color{blue}{i \cdot c} \]
                                                                                  2. lower-*.f6432.6

                                                                                    \[\leadsto \color{blue}{i \cdot c} \]
                                                                                5. Applied rewrites32.6%

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

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

                                                                              Alternative 14: 27.7% accurate, 5.0× speedup?

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

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

                                                                                \[\leadsto \color{blue}{a \cdot b + \left(c \cdot i + t \cdot z\right)} \]
                                                                              4. Step-by-step derivation
                                                                                1. *-commutativeN/A

                                                                                  \[\leadsto \color{blue}{b \cdot a} + \left(c \cdot i + t \cdot z\right) \]
                                                                                2. lower-fma.f64N/A

                                                                                  \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i + t \cdot z\right)} \]
                                                                                3. *-commutativeN/A

                                                                                  \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{i \cdot c} + t \cdot z\right) \]
                                                                                4. lower-fma.f64N/A

                                                                                  \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{\mathsf{fma}\left(i, c, t \cdot z\right)}\right) \]
                                                                                5. lower-*.f6475.4

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

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

                                                                                \[\leadsto a \cdot b + \color{blue}{t \cdot z} \]
                                                                              7. Step-by-step derivation
                                                                                1. Applied rewrites54.1%

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

                                                                                  \[\leadsto a \cdot b \]
                                                                                3. Step-by-step derivation
                                                                                  1. Applied rewrites29.3%

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

                                                                                  Reproduce

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