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

Percentage Accurate: 96.3% → 98.2%
Time: 8.7s
Alternatives: 12
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 12 alternatives:

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

Initial Program: 96.3% 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.2% accurate, 1.3× speedup?

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

\\
\mathsf{fma}\left(z, t, \mathsf{fma}\left(y, x, \mathsf{fma}\left(i, c, a \cdot b\right)\right)\right)
\end{array}
Derivation
  1. Initial program 94.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 72.9% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+304}:\\
\;\;\;\;\mathsf{fma}\left(b, a, t \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 (*.f64 x y) (*.f64 z t)) < -1.5e199 or 4.9999999999999997e304 < (+.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 88.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, t, \mathsf{fma}\left(y, x, \mathsf{fma}\left(i, c, b \cdot a\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. *-commutativeN/A

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

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

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

    if -1.5e199 < (+.f64 (*.f64 x y) (*.f64 z t)) < 6.50000000000000018e44

    1. Initial program 97.3%

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

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

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

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

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

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

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

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

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

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

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

    if 6.50000000000000018e44 < (+.f64 (*.f64 x y) (*.f64 z t)) < 4.9999999999999997e304

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

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

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

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

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

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

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

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

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

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

    Alternative 3: 43.6% accurate, 0.6× speedup?

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

      1. Initial program 89.5%

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

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

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

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

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

      if -1.00000000000000003e83 < (*.f64 c i) < -1.9999999999999988e-309 or 9.9999999999999993e-130 < (*.f64 c i) < 2.00000000000000009e93

      1. Initial program 96.0%

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

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

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

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

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

      if -1.9999999999999988e-309 < (*.f64 c i) < 9.9999999999999993e-130

      1. Initial program 98.3%

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

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

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

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

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

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

    Alternative 4: 64.3% accurate, 0.7× speedup?

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

      1. Initial program 89.3%

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

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

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

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

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

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

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

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

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

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

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

      if -9.99999999999999944e71 < (*.f64 c i) < -4.9999999999999999e-13

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

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

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

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

      if -4.9999999999999999e-13 < (*.f64 c i) < 4.99999999999999976e67

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 5: 89.7% accurate, 0.7× speedup?

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

        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 0

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

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

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

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

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

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

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

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

        if -1.00000000000000003e83 < (*.f64 c i) < 4e10

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

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

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

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

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

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

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

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

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

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

        if 4e10 < (*.f64 c i)

        1. Initial program 80.6%

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

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

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

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

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

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

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

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

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

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

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

      Alternative 6: 90.1% accurate, 0.7× speedup?

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

        1. Initial program 89.5%

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

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

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

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

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

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

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

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

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

        if -1.00000000000000003e83 < (*.f64 c i) < 2.00000000000000009e93

        1. Initial program 96.9%

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

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

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

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

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

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

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

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

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

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

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

      Alternative 7: 85.7% accurate, 0.7× speedup?

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

        1. Initial program 86.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if -1.00000000000000007e246 < (*.f64 x y) < 5.0000000000000003e139

        1. Initial program 95.7%

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

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

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

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

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

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

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

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

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

        if 5.0000000000000003e139 < (*.f64 x y)

        1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(z, t, \mathsf{fma}\left(y, x, \mathsf{fma}\left(i, c, b \cdot a\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. *-commutativeN/A

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

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

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

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

      Alternative 8: 42.6% accurate, 0.8× speedup?

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

        1. Initial program 89.1%

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

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

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

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

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

        if -1.00000000000000003e83 < (*.f64 c i) < -3.9999999999999998e-144

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

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

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

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

        if -3.9999999999999998e-144 < (*.f64 c i) < 4.99999999999999976e67

        1. Initial program 96.7%

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1 \cdot 10^{+83}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -4 \cdot 10^{-144}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \cdot i \leq 5 \cdot 10^{+67}:\\ \;\;\;\;t \cdot z\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]
      5. Add Preprocessing

      Alternative 9: 65.3% accurate, 0.9× speedup?

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

        1. Initial program 90.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if -4.9999999999999999e-13 < (*.f64 c i) < 4.99999999999999976e67

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 10: 62.0% accurate, 0.9× speedup?

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

          1. Initial program 87.6%

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

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

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

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

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

          if -2.0000000000000001e142 < (*.f64 c i) < 4.99999999999999976e73

          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. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

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

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

          Alternative 11: 42.3% accurate, 1.1× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1 \cdot 10^{+22}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq 4 \cdot 10^{+42}:\\ \;\;\;\;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) -1e+22) (* c i) (if (<= (* c i) 4e+42) (* 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) <= -1e+22) {
          		tmp = c * i;
          	} else if ((c * i) <= 4e+42) {
          		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) <= (-1d+22)) then
                  tmp = c * i
              else if ((c * i) <= 4d+42) 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) <= -1e+22) {
          		tmp = c * i;
          	} else if ((c * i) <= 4e+42) {
          		tmp = a * b;
          	} else {
          		tmp = c * i;
          	}
          	return tmp;
          }
          
          def code(x, y, z, t, a, b, c, i):
          	tmp = 0
          	if (c * i) <= -1e+22:
          		tmp = c * i
          	elif (c * i) <= 4e+42:
          		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) <= -1e+22)
          		tmp = Float64(c * i);
          	elseif (Float64(c * i) <= 4e+42)
          		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) <= -1e+22)
          		tmp = c * i;
          	elseif ((c * i) <= 4e+42)
          		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], -1e+22], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 4e+42], N[(a * b), $MachinePrecision], N[(c * i), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;c \cdot i \leq -1 \cdot 10^{+22}:\\
          \;\;\;\;c \cdot i\\
          
          \mathbf{elif}\;c \cdot i \leq 4 \cdot 10^{+42}:\\
          \;\;\;\;a \cdot b\\
          
          \mathbf{else}:\\
          \;\;\;\;c \cdot i\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (*.f64 c i) < -1e22 or 4.00000000000000018e42 < (*.f64 c i)

            1. Initial program 89.3%

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

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

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

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

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

            if -1e22 < (*.f64 c i) < 4.00000000000000018e42

            1. Initial program 97.9%

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

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

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

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

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

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

          Alternative 12: 26.9% 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 94.1%

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

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

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

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

            \[\leadsto \color{blue}{b \cdot a} \]
          6. Final simplification26.4%

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

          Reproduce

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