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

Percentage Accurate: 96.2% → 98.0%
Time: 9.0s
Alternatives: 11
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 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: 96.2% accurate, 1.0× speedup?

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

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

Alternative 1: 98.0% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, y, a \cdot b\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. associate-+r+N/A

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

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

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

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

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

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

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

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

    Alternative 2: 42.4% accurate, 0.6× speedup?

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

      1. Initial program 89.5%

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

        \[\leadsto \color{blue}{a \cdot b} \]
      4. Step-by-step derivation
        1. lower-*.f6459.5

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

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

      if -1.20000000000000012e130 < (*.f64 a b) < -2.6e-247 or 7.20000000000000013e-137 < (*.f64 a b) < 1.34999999999999995e68

      1. Initial program 100.0%

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

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

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

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

      if -2.6e-247 < (*.f64 a b) < 7.20000000000000013e-137

      1. Initial program 98.1%

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

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

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

        \[\leadsto \color{blue}{x \cdot y} \]
    3. Recombined 3 regimes into one program.
    4. Add Preprocessing

    Alternative 3: 75.7% accurate, 0.6× speedup?

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

      1. Initial program 91.6%

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

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

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

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

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

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

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

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

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

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

        if -4.0000000000000002e130 < (+.f64 (*.f64 x y) (*.f64 z t)) < 2.0000000000000001e182

        1. Initial program 99.3%

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

          \[\leadsto \color{blue}{a \cdot b} + c \cdot i \]
        4. Step-by-step derivation
          1. lower-*.f6481.6

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

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

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

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

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

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

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

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

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

      Alternative 4: 89.5% accurate, 0.7× speedup?

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

        1. Initial program 95.5%

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

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

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

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

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

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

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

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

        if -9.99999999999999955e-7 < (*.f64 x y) < 2.0000000000000001e96

        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 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}{\left(c \cdot i + t \cdot z\right) + a \cdot b} \]
          2. associate-+l+N/A

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

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

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

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

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

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

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

      Alternative 5: 89.8% accurate, 0.7× speedup?

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

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

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

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

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

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

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

        if -4e103 < (*.f64 x y) < 5.0000000000000002e107

        1. Initial program 96.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}{\left(c \cdot i + t \cdot z\right) + a \cdot b} \]
          2. associate-+l+N/A

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

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

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

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

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

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

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

      Alternative 6: 86.2% accurate, 0.7× speedup?

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

        1. Initial program 97.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. associate-+r+N/A

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

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

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

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

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

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

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

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

          if -1.99999999999999991e111 < (*.f64 x y) < 5.0000000000000002e107

          1. Initial program 96.3%

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

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

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

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

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

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

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

          if 5.0000000000000002e107 < (*.f64 x y)

          1. Initial program 91.3%

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

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

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

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

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

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

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

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

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

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

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

          Alternative 7: 65.7% accurate, 0.9× speedup?

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

            1. Initial program 89.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. associate-+r+N/A

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

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

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

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

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

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

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

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

              if -1e133 < (*.f64 z t) < 2.0000000000000001e206

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

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

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

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

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

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

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

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

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

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

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

              Alternative 8: 63.6% accurate, 0.9× speedup?

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

                1. Initial program 89.6%

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

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

                    \[\leadsto \color{blue}{t \cdot z} \]
                5. Applied rewrites77.4%

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

                if -1e133 < (*.f64 z t) < 2.0000000000000001e206

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

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

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

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

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

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

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

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

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

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

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

                Alternative 9: 62.6% accurate, 0.9× speedup?

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

                  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. lower-*.f6473.7

                      \[\leadsto \color{blue}{x \cdot y} \]
                  5. Applied rewrites73.7%

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

                  if -4.50000000000000001e103 < (*.f64 x y) < 2.70000000000000007e181

                  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 0

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

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

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

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

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

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

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

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

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

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

                  Alternative 10: 42.8% accurate, 1.1× speedup?

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

                    1. Initial program 89.5%

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

                      \[\leadsto \color{blue}{a \cdot b} \]
                    4. Step-by-step derivation
                      1. lower-*.f6459.5

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

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

                    if -1.20000000000000012e130 < (*.f64 a b) < 1.34999999999999995e68

                    1. Initial program 99.4%

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

                      \[\leadsto \color{blue}{c \cdot i} \]
                    4. Step-by-step derivation
                      1. lower-*.f6437.8

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

                      \[\leadsto \color{blue}{c \cdot i} \]
                  3. Recombined 2 regimes into one program.
                  4. Add Preprocessing

                  Alternative 11: 27.0% 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 95.7%

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

                    \[\leadsto \color{blue}{a \cdot b} \]
                  4. Step-by-step derivation
                    1. lower-*.f6427.7

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

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

                  Reproduce

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