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

Percentage Accurate: 96.1% → 98.7%
Time: 8.5s
Alternatives: 12
Speedup: 0.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 96.1% accurate, 1.0× speedup?

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

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

Alternative 1: 98.7% accurate, 0.4× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{b}, z, \mathsf{fma}\left(\frac{y}{b}, x, a\right)\right) \cdot b\\


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

    1. Initial program 100.0%

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(y, x, \color{blue}{z \cdot t}\right)\right) \]
      7. lower-*.f6456.3

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

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

      \[\leadsto b \cdot \color{blue}{\left(a + \left(\frac{t \cdot z}{b} + \frac{x \cdot y}{b}\right)\right)} \]
    7. Step-by-step derivation
      1. Applied rewrites68.8%

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

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

    Alternative 2: 73.9% accurate, 0.4× speedup?

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

      1. Initial program 88.7%

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

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

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

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

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

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

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

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

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

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

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

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

        if -5.0000000000000001e109 < (+.f64 (*.f64 x y) (*.f64 z t)) < -1.99999999999999985e-24

        1. Initial program 100.0%

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(y, x, \color{blue}{z \cdot t}\right)\right) \]
          7. lower-*.f6488.0

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

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

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

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

          if -1.99999999999999985e-24 < (+.f64 (*.f64 x y) (*.f64 z t)) < 1.99999999999999996e150

          1. Initial program 98.0%

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

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

              \[\leadsto \color{blue}{b \cdot a} + c \cdot i \]
            2. lower-*.f6481.4

              \[\leadsto \color{blue}{b \cdot a} + c \cdot i \]
          5. Applied rewrites81.4%

            \[\leadsto \color{blue}{b \cdot a} + c \cdot i \]
          6. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \color{blue}{b \cdot a + c \cdot i} \]
            2. +-commutativeN/A

              \[\leadsto \color{blue}{c \cdot i + b \cdot a} \]
            3. lift-*.f64N/A

              \[\leadsto \color{blue}{c \cdot i} + b \cdot a \]
            4. *-commutativeN/A

              \[\leadsto \color{blue}{i \cdot c} + b \cdot a \]
            5. lower-fma.f6482.4

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

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

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

        Alternative 3: 98.1% accurate, 0.5× speedup?

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

          1. Initial program 100.0%

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

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

          1. Initial program 0.0%

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(y, x, \color{blue}{z \cdot t}\right)\right) \]
            7. lower-*.f6456.3

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

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

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

        Alternative 4: 88.8% accurate, 0.7× speedup?

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

          1. Initial program 90.6%

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(y, x, \color{blue}{z \cdot t}\right)\right) \]
            7. lower-*.f6489.9

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

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

          if -1.99999999999999985e-24 < (*.f64 x y) < 1.99999999999999996e150

          1. Initial program 95.6%

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

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

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

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

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

        Alternative 5: 86.3% accurate, 0.7× speedup?

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

          1. Initial program 81.5%

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

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

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

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

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

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

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

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

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

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

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

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

            if -4.9999999999999997e174 < (*.f64 x y) < 3.00000000000000024e220

            1. Initial program 95.7%

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

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

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

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

            if 3.00000000000000024e220 < (*.f64 x y)

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

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

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

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

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

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

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

                \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(y, x, \color{blue}{z \cdot t}\right)\right) \]
              7. lower-*.f64100.0

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

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

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

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

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

            Alternative 6: 43.0% accurate, 0.8× speedup?

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

              1. Initial program 88.6%

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

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

                  \[\leadsto \color{blue}{z \cdot t} \]
                2. lower-*.f6467.1

                  \[\leadsto \color{blue}{z \cdot t} \]
              5. Applied rewrites67.1%

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

              if -2.2000000000000001e39 < (*.f64 z t) < 2.85000000000000016e-294

              1. Initial program 95.1%

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

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

                  \[\leadsto \color{blue}{y \cdot x} \]
                2. lower-*.f6443.1

                  \[\leadsto \color{blue}{y \cdot x} \]
              5. Applied rewrites43.1%

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

              if 2.85000000000000016e-294 < (*.f64 z t) < 6.8000000000000002e91

              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 b around inf

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

                  \[\leadsto \color{blue}{b \cdot a} \]
                2. lower-*.f6448.6

                  \[\leadsto \color{blue}{b \cdot a} \]
              5. Applied rewrites48.6%

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

              \[\leadsto \begin{array}{l} \mathbf{if}\;t \cdot z \leq -2.2 \cdot 10^{+39}:\\ \;\;\;\;t \cdot z\\ \mathbf{elif}\;t \cdot z \leq 2.85 \cdot 10^{-294}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;t \cdot z \leq 6.8 \cdot 10^{+91}:\\ \;\;\;\;b \cdot a\\ \mathbf{else}:\\ \;\;\;\;t \cdot z\\ \end{array} \]
            5. Add Preprocessing

            Alternative 7: 42.5% accurate, 0.8× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \cdot a \leq -1 \cdot 10^{+72}:\\ \;\;\;\;b \cdot a\\ \mathbf{elif}\;b \cdot a \leq 10^{-244}:\\ \;\;\;\;i \cdot c\\ \mathbf{elif}\;b \cdot a \leq 10^{+156}:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;b \cdot a\\ \end{array} \end{array} \]
            (FPCore (x y z t a b c i)
             :precision binary64
             (if (<= (* b a) -1e+72)
               (* b a)
               (if (<= (* b a) 1e-244) (* i c) (if (<= (* b a) 1e+156) (* y x) (* b a)))))
            double code(double x, double y, double z, double t, double a, double b, double c, double i) {
            	double tmp;
            	if ((b * a) <= -1e+72) {
            		tmp = b * a;
            	} else if ((b * a) <= 1e-244) {
            		tmp = i * c;
            	} else if ((b * a) <= 1e+156) {
            		tmp = y * x;
            	} else {
            		tmp = b * a;
            	}
            	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 ((b * a) <= (-1d+72)) then
                    tmp = b * a
                else if ((b * a) <= 1d-244) then
                    tmp = i * c
                else if ((b * a) <= 1d+156) then
                    tmp = y * x
                else
                    tmp = b * a
                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 ((b * a) <= -1e+72) {
            		tmp = b * a;
            	} else if ((b * a) <= 1e-244) {
            		tmp = i * c;
            	} else if ((b * a) <= 1e+156) {
            		tmp = y * x;
            	} else {
            		tmp = b * a;
            	}
            	return tmp;
            }
            
            def code(x, y, z, t, a, b, c, i):
            	tmp = 0
            	if (b * a) <= -1e+72:
            		tmp = b * a
            	elif (b * a) <= 1e-244:
            		tmp = i * c
            	elif (b * a) <= 1e+156:
            		tmp = y * x
            	else:
            		tmp = b * a
            	return tmp
            
            function code(x, y, z, t, a, b, c, i)
            	tmp = 0.0
            	if (Float64(b * a) <= -1e+72)
            		tmp = Float64(b * a);
            	elseif (Float64(b * a) <= 1e-244)
            		tmp = Float64(i * c);
            	elseif (Float64(b * a) <= 1e+156)
            		tmp = Float64(y * x);
            	else
            		tmp = Float64(b * a);
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z, t, a, b, c, i)
            	tmp = 0.0;
            	if ((b * a) <= -1e+72)
            		tmp = b * a;
            	elseif ((b * a) <= 1e-244)
            		tmp = i * c;
            	elseif ((b * a) <= 1e+156)
            		tmp = y * x;
            	else
            		tmp = b * a;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(b * a), $MachinePrecision], -1e+72], N[(b * a), $MachinePrecision], If[LessEqual[N[(b * a), $MachinePrecision], 1e-244], N[(i * c), $MachinePrecision], If[LessEqual[N[(b * a), $MachinePrecision], 1e+156], N[(y * x), $MachinePrecision], N[(b * a), $MachinePrecision]]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;b \cdot a \leq -1 \cdot 10^{+72}:\\
            \;\;\;\;b \cdot a\\
            
            \mathbf{elif}\;b \cdot a \leq 10^{-244}:\\
            \;\;\;\;i \cdot c\\
            
            \mathbf{elif}\;b \cdot a \leq 10^{+156}:\\
            \;\;\;\;y \cdot x\\
            
            \mathbf{else}:\\
            \;\;\;\;b \cdot a\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if (*.f64 a b) < -9.99999999999999944e71 or 9.9999999999999998e155 < (*.f64 a b)

              1. Initial program 91.5%

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

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

                  \[\leadsto \color{blue}{b \cdot a} \]
                2. lower-*.f6462.9

                  \[\leadsto \color{blue}{b \cdot a} \]
              5. Applied rewrites62.9%

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

              if -9.99999999999999944e71 < (*.f64 a b) < 9.9999999999999993e-245

              1. Initial program 94.2%

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

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

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

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

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

              if 9.9999999999999993e-245 < (*.f64 a b) < 9.9999999999999998e155

              1. Initial program 96.6%

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

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

                  \[\leadsto \color{blue}{y \cdot x} \]
                2. lower-*.f6435.6

                  \[\leadsto \color{blue}{y \cdot x} \]
              5. Applied rewrites35.6%

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

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \cdot a \leq -1 \cdot 10^{+72}:\\ \;\;\;\;b \cdot a\\ \mathbf{elif}\;b \cdot a \leq 10^{-244}:\\ \;\;\;\;i \cdot c\\ \mathbf{elif}\;b \cdot a \leq 10^{+156}:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;b \cdot a\\ \end{array} \]
            5. Add Preprocessing

            Alternative 8: 67.4% accurate, 0.9× speedup?

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

              1. Initial program 91.8%

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{fma}\left(b, a, t \cdot z\right) \]
              7. Step-by-step derivation
                1. Applied rewrites79.4%

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

                if -2.00000000000000016e91 < (*.f64 a b) < 1e164

                1. Initial program 95.3%

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(y, x, \color{blue}{z \cdot t}\right)\right) \]
                  7. lower-*.f6474.4

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

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

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

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

                  if 1e164 < (*.f64 a b)

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(b, a, x \cdot y\right) \]
                  7. Step-by-step derivation
                    1. Applied rewrites81.4%

                      \[\leadsto \mathsf{fma}\left(b, a, y \cdot x\right) \]
                  8. Recombined 3 regimes into one program.
                  9. Final simplification73.0%

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

                  Alternative 9: 65.9% accurate, 0.9× speedup?

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

                    1. Initial program 87.3%

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

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

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

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

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

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

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

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

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

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

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

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

                      if -1.9999999999999999e214 < (*.f64 a b) < 1e164

                      1. Initial program 95.8%

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

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

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

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

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

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

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

                          \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(y, x, \color{blue}{z \cdot t}\right)\right) \]
                        7. lower-*.f6475.8

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

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

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

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

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

                      Alternative 10: 64.2% accurate, 0.9× speedup?

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

                        1. Initial program 87.3%

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

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

                            \[\leadsto \color{blue}{b \cdot a} \]
                          2. lower-*.f6478.1

                            \[\leadsto \color{blue}{b \cdot a} \]
                        5. Applied rewrites78.1%

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

                        if -1.9999999999999999e214 < (*.f64 a b) < 1e164

                        1. Initial program 95.8%

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(y, x, \color{blue}{z \cdot t}\right)\right) \]
                          7. lower-*.f6475.8

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

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

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

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

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

                        Alternative 11: 43.1% accurate, 1.1× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \cdot a \leq -1 \cdot 10^{+72}:\\ \;\;\;\;b \cdot a\\ \mathbf{elif}\;b \cdot a \leq 10^{+86}:\\ \;\;\;\;i \cdot c\\ \mathbf{else}:\\ \;\;\;\;b \cdot a\\ \end{array} \end{array} \]
                        (FPCore (x y z t a b c i)
                         :precision binary64
                         (if (<= (* b a) -1e+72) (* b a) (if (<= (* b a) 1e+86) (* i c) (* b a))))
                        double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                        	double tmp;
                        	if ((b * a) <= -1e+72) {
                        		tmp = b * a;
                        	} else if ((b * a) <= 1e+86) {
                        		tmp = i * c;
                        	} else {
                        		tmp = b * a;
                        	}
                        	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 ((b * a) <= (-1d+72)) then
                                tmp = b * a
                            else if ((b * a) <= 1d+86) then
                                tmp = i * c
                            else
                                tmp = b * a
                            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 ((b * a) <= -1e+72) {
                        		tmp = b * a;
                        	} else if ((b * a) <= 1e+86) {
                        		tmp = i * c;
                        	} else {
                        		tmp = b * a;
                        	}
                        	return tmp;
                        }
                        
                        def code(x, y, z, t, a, b, c, i):
                        	tmp = 0
                        	if (b * a) <= -1e+72:
                        		tmp = b * a
                        	elif (b * a) <= 1e+86:
                        		tmp = i * c
                        	else:
                        		tmp = b * a
                        	return tmp
                        
                        function code(x, y, z, t, a, b, c, i)
                        	tmp = 0.0
                        	if (Float64(b * a) <= -1e+72)
                        		tmp = Float64(b * a);
                        	elseif (Float64(b * a) <= 1e+86)
                        		tmp = Float64(i * c);
                        	else
                        		tmp = Float64(b * a);
                        	end
                        	return tmp
                        end
                        
                        function tmp_2 = code(x, y, z, t, a, b, c, i)
                        	tmp = 0.0;
                        	if ((b * a) <= -1e+72)
                        		tmp = b * a;
                        	elseif ((b * a) <= 1e+86)
                        		tmp = i * c;
                        	else
                        		tmp = b * a;
                        	end
                        	tmp_2 = tmp;
                        end
                        
                        code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(b * a), $MachinePrecision], -1e+72], N[(b * a), $MachinePrecision], If[LessEqual[N[(b * a), $MachinePrecision], 1e+86], N[(i * c), $MachinePrecision], N[(b * a), $MachinePrecision]]]
                        
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;b \cdot a \leq -1 \cdot 10^{+72}:\\
                        \;\;\;\;b \cdot a\\
                        
                        \mathbf{elif}\;b \cdot a \leq 10^{+86}:\\
                        \;\;\;\;i \cdot c\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;b \cdot a\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if (*.f64 a b) < -9.99999999999999944e71 or 1e86 < (*.f64 a b)

                          1. Initial program 92.2%

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

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

                              \[\leadsto \color{blue}{b \cdot a} \]
                            2. lower-*.f6459.6

                              \[\leadsto \color{blue}{b \cdot a} \]
                          5. Applied rewrites59.6%

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

                          if -9.99999999999999944e71 < (*.f64 a b) < 1e86

                          1. Initial program 94.8%

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

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

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

                          \[\leadsto \begin{array}{l} \mathbf{if}\;b \cdot a \leq -1 \cdot 10^{+72}:\\ \;\;\;\;b \cdot a\\ \mathbf{elif}\;b \cdot a \leq 10^{+86}:\\ \;\;\;\;i \cdot c\\ \mathbf{else}:\\ \;\;\;\;b \cdot a\\ \end{array} \]
                        5. Add Preprocessing

                        Alternative 12: 27.9% accurate, 5.0× speedup?

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

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

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

                            \[\leadsto \color{blue}{b \cdot a} \]
                          2. lower-*.f6427.5

                            \[\leadsto \color{blue}{b \cdot a} \]
                        5. Applied rewrites27.5%

                          \[\leadsto \color{blue}{b \cdot a} \]
                        6. Add Preprocessing

                        Reproduce

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