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

Percentage Accurate: 95.9% → 98.0%
Time: 9.5s
Alternatives: 12
Speedup: 0.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 95.9% accurate, 1.0× speedup?

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

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

Alternative 1: 98.0% accurate, 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, \mathsf{fma}\left(a, b, z \cdot t\right)\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 (fma a b (* z t))))))
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, fma(a, b, (z * t)));
	}
	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, fma(a, b, Float64(z * t)));
	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 + N[(z * t), $MachinePrecision]), $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, \mathsf{fma}\left(a, b, z \cdot t\right)\right)\\


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

    1. Initial program 100.0%

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

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

    1. Initial program 0.0%

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

      \[\leadsto \color{blue}{a \cdot b + \left(t \cdot z + x \cdot y\right)} \]
    4. Step-by-step derivation
      1. 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-*.f6490.0

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

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

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

Alternative 2: 42.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -8.2 \cdot 10^{+106}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -1.35 \cdot 10^{-97}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{-310}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 1.65 \cdot 10^{-137}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;x \cdot y \leq 3.6 \cdot 10^{-72}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 3.4 \cdot 10^{+78}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= (* x y) -8.2e+106)
   (* x y)
   (if (<= (* x y) -1.35e-97)
     (* c i)
     (if (<= (* x y) -2e-310)
       (* z t)
       (if (<= (* x y) 1.65e-137)
         (* a b)
         (if (<= (* x y) 3.6e-72)
           (* c i)
           (if (<= (* x y) 3.4e+78) (* 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) <= -8.2e+106) {
		tmp = x * y;
	} else if ((x * y) <= -1.35e-97) {
		tmp = c * i;
	} else if ((x * y) <= -2e-310) {
		tmp = z * t;
	} else if ((x * y) <= 1.65e-137) {
		tmp = a * b;
	} else if ((x * y) <= 3.6e-72) {
		tmp = c * i;
	} else if ((x * y) <= 3.4e+78) {
		tmp = z * t;
	} else {
		tmp = x * y;
	}
	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 ((x * y) <= (-8.2d+106)) then
        tmp = x * y
    else if ((x * y) <= (-1.35d-97)) then
        tmp = c * i
    else if ((x * y) <= (-2d-310)) then
        tmp = z * t
    else if ((x * y) <= 1.65d-137) then
        tmp = a * b
    else if ((x * y) <= 3.6d-72) then
        tmp = c * i
    else if ((x * y) <= 3.4d+78) then
        tmp = z * t
    else
        tmp = x * y
    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 ((x * y) <= -8.2e+106) {
		tmp = x * y;
	} else if ((x * y) <= -1.35e-97) {
		tmp = c * i;
	} else if ((x * y) <= -2e-310) {
		tmp = z * t;
	} else if ((x * y) <= 1.65e-137) {
		tmp = a * b;
	} else if ((x * y) <= 3.6e-72) {
		tmp = c * i;
	} else if ((x * y) <= 3.4e+78) {
		tmp = z * t;
	} else {
		tmp = x * y;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (x * y) <= -8.2e+106:
		tmp = x * y
	elif (x * y) <= -1.35e-97:
		tmp = c * i
	elif (x * y) <= -2e-310:
		tmp = z * t
	elif (x * y) <= 1.65e-137:
		tmp = a * b
	elif (x * y) <= 3.6e-72:
		tmp = c * i
	elif (x * y) <= 3.4e+78:
		tmp = 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) <= -8.2e+106)
		tmp = Float64(x * y);
	elseif (Float64(x * y) <= -1.35e-97)
		tmp = Float64(c * i);
	elseif (Float64(x * y) <= -2e-310)
		tmp = Float64(z * t);
	elseif (Float64(x * y) <= 1.65e-137)
		tmp = Float64(a * b);
	elseif (Float64(x * y) <= 3.6e-72)
		tmp = Float64(c * i);
	elseif (Float64(x * y) <= 3.4e+78)
		tmp = Float64(z * t);
	else
		tmp = Float64(x * y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if ((x * y) <= -8.2e+106)
		tmp = x * y;
	elseif ((x * y) <= -1.35e-97)
		tmp = c * i;
	elseif ((x * y) <= -2e-310)
		tmp = z * t;
	elseif ((x * y) <= 1.65e-137)
		tmp = a * b;
	elseif ((x * y) <= 3.6e-72)
		tmp = c * i;
	elseif ((x * y) <= 3.4e+78)
		tmp = z * t;
	else
		tmp = x * y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -8.2e+106], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -1.35e-97], N[(c * i), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -2e-310], N[(z * t), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.65e-137], N[(a * b), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 3.6e-72], N[(c * i), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 3.4e+78], N[(z * t), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -8.2 \cdot 10^{+106}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;x \cdot y \leq -1.35 \cdot 10^{-97}:\\
\;\;\;\;c \cdot i\\

\mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{-310}:\\
\;\;\;\;z \cdot t\\

\mathbf{elif}\;x \cdot y \leq 1.65 \cdot 10^{-137}:\\
\;\;\;\;a \cdot b\\

\mathbf{elif}\;x \cdot y \leq 3.6 \cdot 10^{-72}:\\
\;\;\;\;c \cdot i\\

\mathbf{elif}\;x \cdot y \leq 3.4 \cdot 10^{+78}:\\
\;\;\;\;z \cdot t\\

\mathbf{else}:\\
\;\;\;\;x \cdot y\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 x y) < -8.2000000000000005e106 or 3.40000000000000007e78 < (*.f64 x y)

    1. Initial program 92.6%

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

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

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

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

    if -8.2000000000000005e106 < (*.f64 x y) < -1.34999999999999993e-97 or 1.6500000000000001e-137 < (*.f64 x y) < 3.6e-72

    1. Initial program 98.2%

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

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

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

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

    if -1.34999999999999993e-97 < (*.f64 x y) < -1.999999999999994e-310 or 3.6e-72 < (*.f64 x y) < 3.40000000000000007e78

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

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

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

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

    if -1.999999999999994e-310 < (*.f64 x y) < 1.6500000000000001e-137

    1. Initial program 98.3%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -8.2 \cdot 10^{+106}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -1.35 \cdot 10^{-97}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{-310}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 1.65 \cdot 10^{-137}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;x \cdot y \leq 3.6 \cdot 10^{-72}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 3.4 \cdot 10^{+78}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 75.2% accurate, 0.4× 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 -5 \cdot 10^{+185}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq -2 \cdot 10^{+87}:\\ \;\;\;\;\mathsf{fma}\left(y, x, c \cdot i\right)\\ \mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+50}:\\ \;\;\;\;\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 -5e+185)
     t_1
     (if (<= t_2 -2e+87)
       (fma y x (* c i))
       (if (<= t_2 4e+50) (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 <= -5e+185) {
		tmp = t_1;
	} else if (t_2 <= -2e+87) {
		tmp = fma(y, x, (c * i));
	} else if (t_2 <= 4e+50) {
		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 <= -5e+185)
		tmp = t_1;
	elseif (t_2 <= -2e+87)
		tmp = fma(y, x, Float64(c * i));
	elseif (t_2 <= 4e+50)
		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, -5e+185], t$95$1, If[LessEqual[t$95$2, -2e+87], N[(y * x + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e+50], 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 -5 \cdot 10^{+185}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{+87}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c \cdot i\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 (*.f64 x y) (*.f64 z t)) < -4.9999999999999999e185 or 4.0000000000000003e50 < (+.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 92.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-*.f6488.8

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

      \[\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, \color{blue}{t \cdot z}\right) \]
    7. Step-by-step derivation
      1. lower-*.f6482.5

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

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

    if -4.9999999999999999e185 < (+.f64 (*.f64 x y) (*.f64 z t)) < -1.9999999999999999e87

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{x \cdot y} + c \cdot i \]
    4. Step-by-step derivation
      1. lower-*.f6481.2

        \[\leadsto \color{blue}{x \cdot y} + c \cdot i \]
    5. Applied rewrites81.2%

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

        \[\leadsto \color{blue}{y \cdot x} + c \cdot i \]
      2. lift-*.f64N/A

        \[\leadsto y \cdot x + \color{blue}{c \cdot i} \]
      3. lower-fma.f6481.2

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

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

    if -1.9999999999999999e87 < (+.f64 (*.f64 x y) (*.f64 z t)) < 4.0000000000000003e50

    1. Initial program 100.0%

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

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

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

      \[\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. lift-*.f64N/A

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

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

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

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

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

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

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

Alternative 4: 60.6% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(a, b, z \cdot t\right)\\ \mathbf{if}\;x \cdot y \leq -6.8 \cdot 10^{+78}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq 3.3 \cdot 10^{-137}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 3 \cdot 10^{-72}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 3.5 \cdot 10^{+79}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (fma a b (* z t))))
   (if (<= (* x y) -6.8e+78)
     (* x y)
     (if (<= (* x y) 3.3e-137)
       t_1
       (if (<= (* x y) 3e-72)
         (* c i)
         (if (<= (* x y) 3.5e+79) t_1 (* x y)))))))
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 tmp;
	if ((x * y) <= -6.8e+78) {
		tmp = x * y;
	} else if ((x * y) <= 3.3e-137) {
		tmp = t_1;
	} else if ((x * y) <= 3e-72) {
		tmp = c * i;
	} else if ((x * y) <= 3.5e+79) {
		tmp = t_1;
	} else {
		tmp = x * y;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i)
	t_1 = fma(a, b, Float64(z * t))
	tmp = 0.0
	if (Float64(x * y) <= -6.8e+78)
		tmp = Float64(x * y);
	elseif (Float64(x * y) <= 3.3e-137)
		tmp = t_1;
	elseif (Float64(x * y) <= 3e-72)
		tmp = Float64(c * i);
	elseif (Float64(x * y) <= 3.5e+79)
		tmp = t_1;
	else
		tmp = Float64(x * y);
	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]}, If[LessEqual[N[(x * y), $MachinePrecision], -6.8e+78], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 3.3e-137], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 3e-72], N[(c * i), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 3.5e+79], t$95$1, N[(x * y), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \cdot y \leq 3.3 \cdot 10^{-137}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \cdot y \leq 3 \cdot 10^{-72}:\\
\;\;\;\;c \cdot i\\

\mathbf{elif}\;x \cdot y \leq 3.5 \cdot 10^{+79}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;x \cdot y\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -6.80000000000000014e78 or 3.4999999999999998e79 < (*.f64 x y)

    1. Initial program 92.2%

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

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

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

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

    if -6.80000000000000014e78 < (*.f64 x y) < 3.3000000000000002e-137 or 3e-72 < (*.f64 x y) < 3.4999999999999998e79

    1. Initial program 98.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-*.f6474.4

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

      \[\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 \color{blue}{a \cdot b + t \cdot z} \]
    7. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

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

    if 3.3000000000000002e-137 < (*.f64 x y) < 3e-72

    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-*.f6479.0

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

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

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

Alternative 5: 75.0% 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 -5 \cdot 10^{+104}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+50}:\\ \;\;\;\;\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 -5e+104) t_1 (if (<= t_2 4e+50) (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 <= -5e+104) {
		tmp = t_1;
	} else if (t_2 <= 4e+50) {
		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 <= -5e+104)
		tmp = t_1;
	elseif (t_2 <= 4e+50)
		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, -5e+104], t$95$1, If[LessEqual[t$95$2, 4e+50], 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 -5 \cdot 10^{+104}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+50}:\\
\;\;\;\;\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.9999999999999997e104 or 4.0000000000000003e50 < (+.f64 (*.f64 x y) (*.f64 z t))

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

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

      \[\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, \color{blue}{t \cdot z}\right) \]
    7. Step-by-step derivation
      1. lower-*.f6479.0

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

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

    if -4.9999999999999997e104 < (+.f64 (*.f64 x y) (*.f64 z t)) < 4.0000000000000003e50

    1. Initial program 100.0%

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

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

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

      \[\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. lift-*.f64N/A

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

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

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

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

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

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

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

Alternative 6: 87.5% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+185}:\\
\;\;\;\;\mathsf{fma}\left(c, i, \mathsf{fma}\left(t, z, x \cdot y\right)\right)\\

\mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{+129}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, x \cdot y\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c, i, z \cdot t\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z t) < -4.9999999999999999e185

    1. Initial program 94.1%

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

      \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
    4. Step-by-step derivation
      1. 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-*.f6497.1

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

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

    if -4.9999999999999999e185 < (*.f64 z t) < 4e129

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

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

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

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

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

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

    if 4e129 < (*.f64 z t)

    1. Initial program 82.1%

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

      \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
    4. Step-by-step derivation
      1. 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-*.f6489.7

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

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

      \[\leadsto \color{blue}{c \cdot i + t \cdot z} \]
    7. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

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

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

Alternative 7: 86.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+185}:\\
\;\;\;\;\mathsf{fma}\left(x, y, z \cdot t\right)\\

\mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{+129}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, x \cdot y\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c, i, z \cdot t\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z t) < -4.9999999999999999e185

    1. Initial program 94.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. 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-*.f6494.1

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

      \[\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, \color{blue}{t \cdot z}\right) \]
    7. Step-by-step derivation
      1. lower-*.f6494.1

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

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

    if -4.9999999999999999e185 < (*.f64 z t) < 4e129

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

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

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

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

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

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

    if 4e129 < (*.f64 z t)

    1. Initial program 82.1%

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

      \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
    4. Step-by-step derivation
      1. 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-*.f6489.7

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

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

      \[\leadsto \color{blue}{c \cdot i + t \cdot z} \]
    7. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

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

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

Alternative 8: 66.8% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(c, i, z \cdot t\right)\\
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+127}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -1.99999999999999991e127 or 2e86 < (*.f64 z t)

    1. Initial program 89.2%

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

      \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
    4. Step-by-step derivation
      1. 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-*.f6491.7

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

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

      \[\leadsto \color{blue}{c \cdot i + t \cdot z} \]
    7. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

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

    if -1.99999999999999991e127 < (*.f64 z t) < 2e86

    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 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-*.f6475.9

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

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

      \[\leadsto \color{blue}{a \cdot b + x \cdot y} \]
    7. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

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

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

Alternative 9: 64.2% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+269}:\\
\;\;\;\;z \cdot t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z t) < -2.0000000000000001e269

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

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

        \[\leadsto \color{blue}{t \cdot z} \]
    5. Applied rewrites98.8%

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

    if -2.0000000000000001e269 < (*.f64 z t) < 2e86

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

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

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

      \[\leadsto \color{blue}{a \cdot b + x \cdot y} \]
    7. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

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

    if 2e86 < (*.f64 z t)

    1. Initial program 83.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. 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-*.f6475.1

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

      \[\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 \color{blue}{a \cdot b + t \cdot z} \]
    7. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

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

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

Alternative 10: 43.6% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+175}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+66}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;z \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= (* z t) -2e+175) (* z t) (if (<= (* z t) 2e+66) (* 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) <= -2e+175) {
		tmp = z * t;
	} else if ((z * t) <= 2e+66) {
		tmp = a * b;
	} else {
		tmp = z * t;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: tmp
    if ((z * t) <= (-2d+175)) then
        tmp = z * t
    else if ((z * t) <= 2d+66) then
        tmp = a * b
    else
        tmp = z * t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((z * t) <= -2e+175) {
		tmp = z * t;
	} else if ((z * t) <= 2e+66) {
		tmp = a * b;
	} else {
		tmp = z * t;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (z * t) <= -2e+175:
		tmp = z * t
	elif (z * t) <= 2e+66:
		tmp = 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) <= -2e+175)
		tmp = Float64(z * t);
	elseif (Float64(z * t) <= 2e+66)
		tmp = Float64(a * b);
	else
		tmp = Float64(z * t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if ((z * t) <= -2e+175)
		tmp = z * t;
	elseif ((z * t) <= 2e+66)
		tmp = a * b;
	else
		tmp = z * t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -2e+175], N[(z * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+66], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+175}:\\
\;\;\;\;z \cdot t\\

\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+66}:\\
\;\;\;\;a \cdot b\\

\mathbf{else}:\\
\;\;\;\;z \cdot t\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -1.9999999999999999e175 or 1.99999999999999989e66 < (*.f64 z t)

    1. Initial program 88.9%

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

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

        \[\leadsto \color{blue}{t \cdot z} \]
    5. Applied rewrites68.6%

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

    if -1.9999999999999999e175 < (*.f64 z t) < 1.99999999999999989e66

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

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

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

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

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

Alternative 11: 43.7% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -8.1 \cdot 10^{+40}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq 1.6 \cdot 10^{+122}:\\ \;\;\;\;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) -8.1e+40) (* a b) (if (<= (* a b) 1.6e+122) (* 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) <= -8.1e+40) {
		tmp = a * b;
	} else if ((a * b) <= 1.6e+122) {
		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) <= (-8.1d+40)) then
        tmp = a * b
    else if ((a * b) <= 1.6d+122) 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) <= -8.1e+40) {
		tmp = a * b;
	} else if ((a * b) <= 1.6e+122) {
		tmp = c * i;
	} else {
		tmp = a * b;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (a * b) <= -8.1e+40:
		tmp = a * b
	elif (a * b) <= 1.6e+122:
		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) <= -8.1e+40)
		tmp = Float64(a * b);
	elseif (Float64(a * b) <= 1.6e+122)
		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) <= -8.1e+40)
		tmp = a * b;
	elseif ((a * b) <= 1.6e+122)
		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], -8.1e+40], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.6e+122], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -8.1 \cdot 10^{+40}:\\
\;\;\;\;a \cdot b\\

\mathbf{elif}\;a \cdot b \leq 1.6 \cdot 10^{+122}:\\
\;\;\;\;c \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -8.0999999999999998e40 or 1.60000000000000006e122 < (*.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. lower-*.f6459.5

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

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

    if -8.0999999999999998e40 < (*.f64 a b) < 1.60000000000000006e122

    1. Initial program 98.8%

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

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

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

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

Alternative 12: 28.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 96.1%

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

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

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

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

Reproduce

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