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

Percentage Accurate: 95.6% → 97.7%
Time: 7.7s
Alternatives: 11
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 11 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.6% accurate, 1.0× speedup?

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

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

Alternative 1: 97.7% accurate, 1.3× speedup?

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

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

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

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

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

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

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

Alternative 2: 75.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(t, z, x \cdot y\right)\\ t_2 := x \cdot y + t \cdot z\\ \mathbf{if}\;t\_2 \leq -1 \cdot 10^{+138}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 10^{+205}:\\ \;\;\;\;\mathsf{fma}\left(b, a, c \cdot i\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) (* t z))))
   (if (<= t_2 -1e+138) t_1 (if (<= t_2 1e+205) (fma b a (* c i)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = fma(t, z, (x * y));
	double t_2 = (x * y) + (t * z);
	double tmp;
	if (t_2 <= -1e+138) {
		tmp = t_1;
	} else if (t_2 <= 1e+205) {
		tmp = fma(b, a, (c * i));
	} 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(t * z))
	tmp = 0.0
	if (t_2 <= -1e+138)
		tmp = t_1;
	elseif (t_2 <= 1e+205)
		tmp = fma(b, a, Float64(c * i));
	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[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+138], t$95$1, If[LessEqual[t$95$2, 1e+205], N[(b * a + N[(c * i), $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 + t \cdot z\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+138}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (*.f64 x y) (*.f64 z t)) < -1e138 or 1.00000000000000002e205 < (+.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 94.4%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Add Preprocessing
    3. Taylor expanded in a around 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-*.f6491.3

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

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

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

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

          if -1e138 < (+.f64 (*.f64 x y) (*.f64 z t)) < 1.00000000000000002e205

          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-*.f6490.1

              \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
          5. Applied rewrites90.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 rewrites77.1%

              \[\leadsto \mathsf{fma}\left(b, a, c \cdot i\right) \]
          8. Recombined 2 regimes into one program.
          9. Final simplification79.6%

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

          Alternative 3: 62.2% accurate, 0.7× speedup?

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

            1. Initial program 95.9%

              \[\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-*.f6464.7

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

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

            if -5.0000000000000001e26 < (*.f64 c i) < -5.00000000000000035e-230

            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 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 rewrites42.3%

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

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

                  if -5.00000000000000035e-230 < (*.f64 c i) < 2.00000000000000012e140

                  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 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-*.f6480.7

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

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

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

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

                    Alternative 4: 88.7% accurate, 0.7× speedup?

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

                      1. Initial program 97.5%

                        \[\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-*.f6497.5

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

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

                      if -2e113 < (*.f64 a b) < 1.00000000000000006e-9

                      1. Initial program 97.4%

                        \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
                      2. Add Preprocessing
                      3. Taylor expanded in a around 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-*.f6493.3

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

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

                      if 1.00000000000000006e-9 < (*.f64 a b)

                      1. Initial program 98.3%

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

                        \[\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-*.f6492.1

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

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

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

                    Alternative 5: 87.9% accurate, 0.7× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \cdot z \leq -1 \cdot 10^{+178}:\\ \;\;\;\;\mathsf{fma}\left(z, t, c \cdot i\right)\\ \mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{+25}:\\ \;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, x \cdot y\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 (<= (* t z) -1e+178)
                       (fma z t (* c i))
                       (if (<= (* t z) 5e+25)
                         (fma b a (fma i c (* 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 ((t * z) <= -1e+178) {
                    		tmp = fma(z, t, (c * i));
                    	} else if ((t * z) <= 5e+25) {
                    		tmp = fma(b, a, fma(i, c, (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(t * z) <= -1e+178)
                    		tmp = fma(z, t, Float64(c * i));
                    	elseif (Float64(t * z) <= 5e+25)
                    		tmp = fma(b, a, fma(i, c, 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[LessEqual[N[(t * z), $MachinePrecision], -1e+178], N[(z * t + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 5e+25], N[(b * a + N[(i * c + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b * a + N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;t \cdot z \leq -1 \cdot 10^{+178}:\\
                    \;\;\;\;\mathsf{fma}\left(z, t, c \cdot i\right)\\
                    
                    \mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{+25}:\\
                    \;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, x \cdot y\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 3 regimes
                    2. if (*.f64 z t) < -1.0000000000000001e178

                      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 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-*.f6493.3

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

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

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

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

                          if -1.0000000000000001e178 < (*.f64 z t) < 5.00000000000000024e25

                          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 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-*.f6495.1

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

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

                          if 5.00000000000000024e25 < (*.f64 z t)

                          1. Initial program 100.0%

                            \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
                          2. Add Preprocessing
                          3. Taylor expanded in x around 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-*.f6487.4

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

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

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

                        Alternative 6: 85.9% accurate, 0.7× speedup?

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

                          1. Initial program 94.7%

                            \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
                          2. Add Preprocessing
                          3. Taylor expanded in a around 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-*.f6493.2

                              \[\leadsto \mathsf{fma}\left(i, c, \mathsf{fma}\left(t, z, \color{blue}{y \cdot x}\right)\right) \]
                          5. Applied rewrites93.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 rewrites93.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 rewrites23.6%

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

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

                                if -1e138 < (*.f64 x y) < 4.99999999999999964e209

                                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 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-*.f6488.8

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

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

                                if 4.99999999999999964e209 < (*.f64 x y)

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

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

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

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

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

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

                                  Alternative 7: 42.6% accurate, 0.8× speedup?

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

                                    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 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-*.f6462.6

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

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

                                    if -10 < (*.f64 c i) < -5.0000000000000002e-237

                                    1. Initial program 100.0%

                                      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
                                    2. Add Preprocessing
                                    3. Taylor expanded in x around 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-*.f6455.5

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

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

                                          \[\leadsto b \cdot a \]
                                        2. Taylor expanded in z around inf

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

                                            \[\leadsto \color{blue}{t \cdot z} \]
                                        4. Applied rewrites39.1%

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

                                        if -5.0000000000000002e-237 < (*.f64 c i) < 2.00000000000000012e140

                                        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 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.4

                                            \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{t \cdot z}\right)\right) \]
                                        5. Applied rewrites68.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 rewrites65.5%

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

                                              \[\leadsto b \cdot a \]
                                          4. Recombined 3 regimes into one program.
                                          5. Final simplification51.6%

                                            \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -10:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -5 \cdot 10^{-237}:\\ \;\;\;\;t \cdot z\\ \mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{+140}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]
                                          6. Add Preprocessing

                                          Alternative 8: 62.0% accurate, 0.9× speedup?

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

                                            1. Initial program 95.9%

                                              \[\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-*.f6464.7

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

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

                                            if -5.0000000000000001e26 < (*.f64 c i) < 2.00000000000000012e140

                                            1. Initial program 98.7%

                                              \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in 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-*.f6477.4

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

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

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

                                                  \[\leadsto \mathsf{fma}\left(b, \color{blue}{a}, y \cdot x\right) \]
                                              4. Recombined 2 regimes into one program.
                                              5. Final simplification69.9%

                                                \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -5 \cdot 10^{+26}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{+140}:\\ \;\;\;\;\mathsf{fma}\left(b, a, x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]
                                              6. Add Preprocessing

                                              Alternative 9: 60.7% accurate, 0.9× speedup?

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

                                                1. Initial program 96.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-*.f6463.4

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

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

                                                if -5e10 < (*.f64 c i) < 2e147

                                                1. Initial program 98.7%

                                                  \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
                                                2. Add Preprocessing
                                                3. Taylor expanded in 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-*.f6465.7

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

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

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

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

                                                Alternative 10: 42.5% accurate, 1.1× speedup?

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

                                                  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 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-*.f6462.8

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

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

                                                  if -5e10 < (*.f64 c i) < 2.00000000000000012e140

                                                  1. Initial program 98.7%

                                                    \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
                                                  2. Add Preprocessing
                                                  3. Taylor expanded in 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-*.f6465.4

                                                      \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{t \cdot z}\right)\right) \]
                                                  5. Applied rewrites65.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 rewrites61.5%

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

                                                        \[\leadsto b \cdot a \]
                                                    4. Recombined 2 regimes into one program.
                                                    5. Final simplification48.1%

                                                      \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -50000000000:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{+140}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]
                                                    6. Add Preprocessing

                                                    Alternative 11: 27.3% accurate, 5.0× speedup?

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

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

                                                        \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{t \cdot z}\right)\right) \]
                                                    5. Applied rewrites74.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 rewrites49.4%

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

                                                          \[\leadsto b \cdot a \]
                                                        2. Final simplification28.8%

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

                                                        Reproduce

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