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

Percentage Accurate: 95.9% → 97.9%
Time: 9.1s
Alternatives: 11
Speedup: 1.3×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 95.9% accurate, 1.0× speedup?

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

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

Alternative 1: 97.9% accurate, 1.3× speedup?

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

\\
\mathsf{fma}\left(i, c, \mathsf{fma}\left(b, a, \mathsf{fma}\left(t, z, x \cdot y\right)\right)\right)
\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. Step-by-step derivation
    1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 62.1% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, x, z \cdot t\right)\\
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+131}:\\
\;\;\;\;a \cdot b\\

\mathbf{elif}\;a \cdot b \leq -2 \cdot 10^{+28}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;a \cdot b \leq 10^{-219}:\\
\;\;\;\;\mathsf{fma}\left(z, t, c \cdot i\right)\\

\mathbf{elif}\;a \cdot b \leq 10^{+86}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -1.9999999999999998e131 or 1e86 < (*.f64 a b)

    1. Initial program 91.2%

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

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

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

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

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

    if -1.9999999999999998e131 < (*.f64 a b) < -1.99999999999999992e28 or 1e-219 < (*.f64 a b) < 1e86

    1. Initial program 97.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 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-*.f6472.9

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

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

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

      if -1.99999999999999992e28 < (*.f64 a b) < 1e-219

      1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto c \cdot i + \color{blue}{t \cdot z} \]
      7. Step-by-step derivation
        1. Applied rewrites68.1%

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

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

      Alternative 3: 74.8% accurate, 0.6× speedup?

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

        1. Initial program 90.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 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-*.f6487.6

            \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(y, x, \color{blue}{z \cdot t}\right)\right) \]
        5. Applied rewrites87.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 rewrites79.3%

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

          if -2.00000000000000001e160 < (+.f64 (*.f64 x y) (*.f64 z t)) < 1e220

          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. *-commutativeN/A

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

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

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

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

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

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

        Alternative 4: 74.9% accurate, 0.6× speedup?

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

          1. Initial program 90.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 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-*.f6487.6

              \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(y, x, \color{blue}{z \cdot t}\right)\right) \]
          5. Applied rewrites87.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 rewrites79.3%

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

            if -2.00000000000000001e160 < (+.f64 (*.f64 x y) (*.f64 z t)) < 1e220

            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 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}{t \cdot z + c \cdot i}\right) \]
              4. *-commutativeN/A

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

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

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

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

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

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

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

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

            Alternative 5: 87.7% accurate, 0.7× speedup?

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

              1. Initial program 86.3%

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

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

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

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

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

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

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

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

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

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

              if -1.00000000000000004e121 < (*.f64 c i) < 9.99999999999999944e71

              1. Initial program 98.7%

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

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

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

              if 9.99999999999999944e71 < (*.f64 c i)

              1. Initial program 94.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{fma}\left(i, c, \color{blue}{x \cdot y}\right) \]
              6. Step-by-step derivation
                1. *-commutativeN/A

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

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

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

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

            Alternative 6: 86.1% accurate, 0.7× speedup?

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

              1. Initial program 87.8%

                \[\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}{t \cdot z + c \cdot i}\right) \]
                4. *-commutativeN/A

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

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

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

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

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

                \[\leadsto c \cdot i + \color{blue}{t \cdot z} \]
              7. Step-by-step derivation
                1. Applied rewrites85.5%

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

                if -1.00000000000000006e136 < (*.f64 c i) < 9.99999999999999944e71

                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 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-*.f6494.2

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

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

                if 9.99999999999999944e71 < (*.f64 c i)

                1. Initial program 94.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(i, c, \color{blue}{x \cdot y}\right) \]
                6. Step-by-step derivation
                  1. *-commutativeN/A

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

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

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

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

              Alternative 7: 41.7% accurate, 0.8× speedup?

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

                1. Initial program 91.9%

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

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

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

                if -2.00000000000000008e201 < (*.f64 c i) < -2e-66

                1. Initial program 91.6%

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

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

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

                    \[\leadsto \color{blue}{z \cdot t} \]
                5. Applied rewrites46.2%

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

                if -2e-66 < (*.f64 c i) < 9.99999999999999944e71

                1. Initial program 99.2%

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

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

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

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

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

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

              Alternative 8: 65.7% accurate, 0.9× speedup?

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

                1. Initial program 90.1%

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

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

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

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

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

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

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

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

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

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

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

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

                  if -2e13 < (*.f64 c i) < 4e177

                  1. Initial program 98.7%

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

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

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

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

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

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

                  Alternative 9: 63.1% accurate, 0.9× speedup?

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

                    1. Initial program 91.2%

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

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

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

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

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

                    if -1.9999999999999998e131 < (*.f64 a b) < 1e86

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

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

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

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

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

                    Alternative 10: 42.1% accurate, 1.1× speedup?

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

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

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

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

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

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

                      if -2e13 < (*.f64 c i) < 9.99999999999999944e71

                      1. Initial program 98.6%

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

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

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

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

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

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

                    Alternative 11: 27.1% 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. *-commutativeN/A

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

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

                      \[\leadsto \color{blue}{b \cdot a} \]
                    6. Final simplification34.2%

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

                    Reproduce

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