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

Percentage Accurate: 96.0% → 98.0%
Time: 10.2s
Alternatives: 14
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 14 alternatives:

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

Initial Program: 96.0% 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, 1.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 62.9% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;z \cdot t \leq -1 \cdot 10^{+130}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;z \cdot t \leq -0.01:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-235}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if (*.f64 z t) < -9.99999999999999981e149 or 2.00000000000000004e95 < (*.f64 z t)

    1. Initial program 94.2%

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

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

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

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

    if -9.99999999999999981e149 < (*.f64 z t) < -1.0000000000000001e130

    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} \]
    4. Step-by-step derivation
      1. lower-*.f64100.0

        \[\leadsto \color{blue}{x \cdot y} \]
    5. Applied rewrites100.0%

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

    if -1.0000000000000001e130 < (*.f64 z t) < -0.0100000000000000002 or -9.99999999999999943e-253 < (*.f64 z t) < 1.9999999999999999e-235

    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-*.f6477.5

        \[\leadsto \color{blue}{a \cdot b} + c \cdot i \]
    5. Applied rewrites77.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.f6477.5

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

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

    if -0.0100000000000000002 < (*.f64 z t) < -9.99999999999999943e-253

    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. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.9999999999999999e-235 < (*.f64 z t) < 2.00000000000000004e95

    1. Initial program 97.4%

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

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

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

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

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

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

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

Alternative 3: 62.7% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;z \cdot t \leq -1 \cdot 10^{+130}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;z \cdot t \leq -0.01:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;z \cdot t \leq -1 \cdot 10^{-252}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \cdot t \leq 10^{-246}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+95}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 z t) < -9.99999999999999981e149 or 2.00000000000000004e95 < (*.f64 z t)

    1. Initial program 94.2%

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

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

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

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

    if -9.99999999999999981e149 < (*.f64 z t) < -1.0000000000000001e130

    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} \]
    4. Step-by-step derivation
      1. lower-*.f64100.0

        \[\leadsto \color{blue}{x \cdot y} \]
    5. Applied rewrites100.0%

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

    if -1.0000000000000001e130 < (*.f64 z t) < -0.0100000000000000002 or -9.99999999999999943e-253 < (*.f64 z t) < 9.99999999999999956e-247

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

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

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

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

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

    if -0.0100000000000000002 < (*.f64 z t) < -9.99999999999999943e-253 or 9.99999999999999956e-247 < (*.f64 z t) < 2.00000000000000004e95

    1. Initial program 97.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z, t, \mathsf{fma}\left(x, y, \color{blue}{a \cdot b}\right)\right) \]
    6. Step-by-step derivation
      1. lower-*.f6481.0

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

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

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

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

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

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

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

Alternative 4: 43.0% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;z \cdot t \leq -1 \cdot 10^{+103}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;z \cdot t \leq -0.01:\\
\;\;\;\;c \cdot i\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 z t) < -9.99999999999999981e149 or 2.00000000000000004e95 < (*.f64 z t)

    1. Initial program 94.2%

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

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

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

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

    if -9.99999999999999981e149 < (*.f64 z t) < -1e103 or 1.9999999999999999e-235 < (*.f64 z t) < 2.00000000000000004e95

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

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

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

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

    if -1e103 < (*.f64 z t) < -0.0100000000000000002

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

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

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

    if -0.0100000000000000002 < (*.f64 z t) < 1.9999999999999999e-235

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+150}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;z \cdot t \leq -1 \cdot 10^{+103}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;z \cdot t \leq -0.01:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-235}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+95}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;z \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 72.6% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, t, x \cdot y\right)\\
t_2 := x \cdot y + z \cdot t\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+95}:\\
\;\;\;\;\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)) < -inf.0 or 2.00000000000000004e95 < (+.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 95.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 \left(\left(\color{blue}{x \cdot y} + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
      2. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z, t, \color{blue}{x \cdot y}\right) \]
    6. Step-by-step derivation
      1. lower-*.f6484.1

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

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

    if -inf.0 < (+.f64 (*.f64 x y) (*.f64 z t)) < 2.00000000000000004e95

    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} + c \cdot i \]
    4. Step-by-step derivation
      1. lower-*.f6470.6

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

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

        \[\leadsto \color{blue}{a \cdot b} + c \cdot i \]
      2. 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.f6471.3

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

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

Alternative 6: 89.2% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1 \cdot 10^{+60}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, x \cdot y\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, c \cdot i\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 c i) < -9.9999999999999995e59

    1. Initial program 91.8%

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

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

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

    if -9.9999999999999995e59 < (*.f64 c i) < 9.9999999999999993e167

    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. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z, t, \mathsf{fma}\left(x, y, \color{blue}{a \cdot b}\right)\right) \]
    6. Step-by-step derivation
      1. lower-*.f6493.3

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

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

    if 9.9999999999999993e167 < (*.f64 c i)

    1. Initial program 94.9%

      \[\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 \left(\left(\color{blue}{x \cdot y} + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
      2. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b + \left(c \cdot i + x \cdot y\right)} \]
    6. 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. +-commutativeN/A

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

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

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

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

Alternative 7: 89.1% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1 \cdot 10^{+60}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, x \cdot y\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, c \cdot i\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 c i) < -9.9999999999999995e59

    1. Initial program 91.8%

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

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

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

    if -9.9999999999999995e59 < (*.f64 c i) < 9.9999999999999993e167

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

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

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

    if 9.9999999999999993e167 < (*.f64 c i)

    1. Initial program 94.9%

      \[\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 \left(\left(\color{blue}{x \cdot y} + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
      2. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b + \left(c \cdot i + x \cdot y\right)} \]
    6. 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. +-commutativeN/A

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

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

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

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

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

Alternative 8: 89.0% accurate, 0.7× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -9.99999999999999981e149 or 5.0000000000000004e68 < (*.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 x around 0

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

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

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

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

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

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

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

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

    if -9.99999999999999981e149 < (*.f64 z t) < 5.0000000000000004e68

    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. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b + \left(c \cdot i + x \cdot y\right)} \]
    6. 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. +-commutativeN/A

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

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

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

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

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

Alternative 9: 84.6% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 95.0%

      \[\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 \left(\left(\color{blue}{x \cdot y} + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
      2. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z, t, \color{blue}{c \cdot i}\right) \]
    6. Step-by-step derivation
      1. lower-*.f6485.5

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

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

    if -9.99999999999999981e149 < (*.f64 z t) < 1.99999999999999995e38

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

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

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

    if 1.99999999999999995e38 < (*.f64 z t)

    1. Initial program 92.8%

      \[\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 \left(\left(\color{blue}{x \cdot y} + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
      2. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z, t, \color{blue}{x \cdot y}\right) \]
    6. Step-by-step derivation
      1. lower-*.f6475.4

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

      \[\leadsto \mathsf{fma}\left(z, t, \color{blue}{x \cdot y}\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 10: 42.6% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.05 \cdot 10^{+138}:\\
\;\;\;\;c \cdot i\\

\mathbf{elif}\;c \cdot i \leq -2.2 \cdot 10^{-82}:\\
\;\;\;\;a \cdot b\\

\mathbf{elif}\;c \cdot i \leq 7.2 \cdot 10^{+168}:\\
\;\;\;\;z \cdot t\\

\mathbf{else}:\\
\;\;\;\;c \cdot i\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 c i) < -1.05000000000000003e138 or 7.1999999999999999e168 < (*.f64 c i)

    1. Initial program 92.4%

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

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

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

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

    if -1.05000000000000003e138 < (*.f64 c i) < -2.19999999999999986e-82

    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} \]
    4. Step-by-step derivation
      1. lower-*.f6436.2

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

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

    if -2.19999999999999986e-82 < (*.f64 c i) < 7.1999999999999999e168

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

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

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

      \[\leadsto \color{blue}{t \cdot z} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification48.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1.05 \cdot 10^{+138}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -2.2 \cdot 10^{-82}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq 7.2 \cdot 10^{+168}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 66.7% accurate, 0.9× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c i) < -9.9999999999999995e59 or 1.99999999999999987e146 < (*.f64 c i)

    1. Initial program 93.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 inf

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

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

      \[\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.f6482.6

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

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

    if -9.9999999999999995e59 < (*.f64 c i) < 1.99999999999999987e146

    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. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z, t, \color{blue}{a \cdot b}\right) \]
    6. Step-by-step derivation
      1. lower-*.f6469.0

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

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

Alternative 12: 62.3% accurate, 0.9× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -9.99999999999999981e149 or 2.00000000000000004e95 < (*.f64 z t)

    1. Initial program 94.2%

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

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

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

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

    if -9.99999999999999981e149 < (*.f64 z t) < 2.00000000000000004e95

    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. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z, t, \mathsf{fma}\left(x, y, \color{blue}{a \cdot b}\right)\right) \]
    6. Step-by-step derivation
      1. lower-*.f6471.0

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

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

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

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

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

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

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

Alternative 13: 42.9% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.05 \cdot 10^{+138}:\\
\;\;\;\;c \cdot i\\

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

\mathbf{else}:\\
\;\;\;\;c \cdot i\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c i) < -1.05000000000000003e138 or 3.99999999999999973e146 < (*.f64 c i)

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

        \[\leadsto \color{blue}{c \cdot i} \]
    5. Applied rewrites72.9%

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

    if -1.05000000000000003e138 < (*.f64 c i) < 3.99999999999999973e146

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

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

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

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

Alternative 14: 27.3% accurate, 5.0× speedup?

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

\\
a \cdot b
\end{array}
Derivation
  1. Initial program 97.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-*.f6426.4

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

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

Reproduce

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