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

Percentage Accurate: 95.8% → 97.7%
Time: 17.9s
Alternatives: 18
Speedup: 0.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 18 alternatives:

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

Initial Program: 95.8% accurate, 1.0× speedup?

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

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

Alternative 1: 97.7% accurate, 0.1× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

    1. Initial program 0.0%

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

      \[\leadsto \color{blue}{\left(a \cdot b + t \cdot z\right)} + c \cdot i \]
    3. Taylor expanded in t around 0 40.1%

      \[\leadsto \color{blue}{c \cdot i + a \cdot b} \]
    4. Step-by-step derivation
      1. fma-def70.1%

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

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

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

Alternative 2: 97.9% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, \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 x y (fma z t (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(x, y, fma(z, t, fma(a, b, (c * i))));
}
function code(x, y, z, t, a, b, c, i)
	return fma(x, y, fma(z, t, fma(a, b, Float64(c * i))))
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(x * y + N[(z * t + N[(a * b + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
  2. Step-by-step derivation
    1. associate-+l+96.1%

      \[\leadsto \color{blue}{\left(x \cdot y + z \cdot t\right) + \left(a \cdot b + c \cdot i\right)} \]
    2. associate-+l+96.1%

      \[\leadsto \color{blue}{x \cdot y + \left(z \cdot t + \left(a \cdot b + c \cdot i\right)\right)} \]
    3. fma-def96.9%

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

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

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

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

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

Alternative 3: 97.9% accurate, 0.0× speedup?

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

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

    \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
  2. Step-by-step derivation
    1. +-commutative96.1%

      \[\leadsto \color{blue}{c \cdot i + \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right)} \]
    2. fma-def97.3%

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

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

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

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

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

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

Alternative 4: 97.6% accurate, 0.1× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

    1. Initial program 0.0%

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

      \[\leadsto \color{blue}{\left(a \cdot b + t \cdot z\right)} + c \cdot i \]
    3. Taylor expanded in c around 0 41.6%

      \[\leadsto \color{blue}{a \cdot b + t \cdot z} \]
    4. Step-by-step derivation
      1. *-commutative41.6%

        \[\leadsto \color{blue}{b \cdot a} + t \cdot z \]
      2. fma-def51.6%

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

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

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

Alternative 5: 43.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \cdot i \leq -2.3 \cdot 10^{+140}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -2.4 \cdot 10^{+100}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \cdot i \leq -1.5:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \cdot i \leq -4 \cdot 10^{-68}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq -6.6 \cdot 10^{-180}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \cdot i \leq -2.6 \cdot 10^{-227}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \cdot i \leq 3.2 \cdot 10^{-195}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \cdot i \leq 2.2 \cdot 10^{-20}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq 9.5 \cdot 10^{+100}:\\ \;\;\;\;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) -2.3e+140)
   (* c i)
   (if (<= (* c i) -2.4e+100)
     (* z t)
     (if (<= (* c i) -1.5)
       (* x y)
       (if (<= (* c i) -4e-68)
         (* a b)
         (if (<= (* c i) -6.6e-180)
           (* z t)
           (if (<= (* c i) -2.6e-227)
             (* x y)
             (if (<= (* c i) 3.2e-195)
               (* z t)
               (if (<= (* c i) 2.2e-20)
                 (* a b)
                 (if (<= (* c i) 9.5e+100) (* 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) <= -2.3e+140) {
		tmp = c * i;
	} else if ((c * i) <= -2.4e+100) {
		tmp = z * t;
	} else if ((c * i) <= -1.5) {
		tmp = x * y;
	} else if ((c * i) <= -4e-68) {
		tmp = a * b;
	} else if ((c * i) <= -6.6e-180) {
		tmp = z * t;
	} else if ((c * i) <= -2.6e-227) {
		tmp = x * y;
	} else if ((c * i) <= 3.2e-195) {
		tmp = z * t;
	} else if ((c * i) <= 2.2e-20) {
		tmp = a * b;
	} else if ((c * i) <= 9.5e+100) {
		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) <= (-2.3d+140)) then
        tmp = c * i
    else if ((c * i) <= (-2.4d+100)) then
        tmp = z * t
    else if ((c * i) <= (-1.5d0)) then
        tmp = x * y
    else if ((c * i) <= (-4d-68)) then
        tmp = a * b
    else if ((c * i) <= (-6.6d-180)) then
        tmp = z * t
    else if ((c * i) <= (-2.6d-227)) then
        tmp = x * y
    else if ((c * i) <= 3.2d-195) then
        tmp = z * t
    else if ((c * i) <= 2.2d-20) then
        tmp = a * b
    else if ((c * i) <= 9.5d+100) 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) <= -2.3e+140) {
		tmp = c * i;
	} else if ((c * i) <= -2.4e+100) {
		tmp = z * t;
	} else if ((c * i) <= -1.5) {
		tmp = x * y;
	} else if ((c * i) <= -4e-68) {
		tmp = a * b;
	} else if ((c * i) <= -6.6e-180) {
		tmp = z * t;
	} else if ((c * i) <= -2.6e-227) {
		tmp = x * y;
	} else if ((c * i) <= 3.2e-195) {
		tmp = z * t;
	} else if ((c * i) <= 2.2e-20) {
		tmp = a * b;
	} else if ((c * i) <= 9.5e+100) {
		tmp = z * t;
	} else {
		tmp = c * i;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (c * i) <= -2.3e+140:
		tmp = c * i
	elif (c * i) <= -2.4e+100:
		tmp = z * t
	elif (c * i) <= -1.5:
		tmp = x * y
	elif (c * i) <= -4e-68:
		tmp = a * b
	elif (c * i) <= -6.6e-180:
		tmp = z * t
	elif (c * i) <= -2.6e-227:
		tmp = x * y
	elif (c * i) <= 3.2e-195:
		tmp = z * t
	elif (c * i) <= 2.2e-20:
		tmp = a * b
	elif (c * i) <= 9.5e+100:
		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) <= -2.3e+140)
		tmp = Float64(c * i);
	elseif (Float64(c * i) <= -2.4e+100)
		tmp = Float64(z * t);
	elseif (Float64(c * i) <= -1.5)
		tmp = Float64(x * y);
	elseif (Float64(c * i) <= -4e-68)
		tmp = Float64(a * b);
	elseif (Float64(c * i) <= -6.6e-180)
		tmp = Float64(z * t);
	elseif (Float64(c * i) <= -2.6e-227)
		tmp = Float64(x * y);
	elseif (Float64(c * i) <= 3.2e-195)
		tmp = Float64(z * t);
	elseif (Float64(c * i) <= 2.2e-20)
		tmp = Float64(a * b);
	elseif (Float64(c * i) <= 9.5e+100)
		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) <= -2.3e+140)
		tmp = c * i;
	elseif ((c * i) <= -2.4e+100)
		tmp = z * t;
	elseif ((c * i) <= -1.5)
		tmp = x * y;
	elseif ((c * i) <= -4e-68)
		tmp = a * b;
	elseif ((c * i) <= -6.6e-180)
		tmp = z * t;
	elseif ((c * i) <= -2.6e-227)
		tmp = x * y;
	elseif ((c * i) <= 3.2e-195)
		tmp = z * t;
	elseif ((c * i) <= 2.2e-20)
		tmp = a * b;
	elseif ((c * i) <= 9.5e+100)
		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], -2.3e+140], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -2.4e+100], N[(z * t), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -1.5], N[(x * y), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -4e-68], N[(a * b), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -6.6e-180], N[(z * t), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -2.6e-227], N[(x * y), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 3.2e-195], N[(z * t), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 2.2e-20], N[(a * b), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 9.5e+100], N[(z * t), $MachinePrecision], N[(c * i), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;c \cdot i \leq -2.4 \cdot 10^{+100}:\\
\;\;\;\;z \cdot t\\

\mathbf{elif}\;c \cdot i \leq -1.5:\\
\;\;\;\;x \cdot y\\

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

\mathbf{elif}\;c \cdot i \leq -6.6 \cdot 10^{-180}:\\
\;\;\;\;z \cdot t\\

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

\mathbf{elif}\;c \cdot i \leq 3.2 \cdot 10^{-195}:\\
\;\;\;\;z \cdot t\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 c i) < -2.2999999999999999e140 or 9.4999999999999995e100 < (*.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. Taylor expanded in c around inf 71.0%

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

    if -2.2999999999999999e140 < (*.f64 c i) < -2.40000000000000012e100 or -4.00000000000000027e-68 < (*.f64 c i) < -6.59999999999999996e-180 or -2.60000000000000011e-227 < (*.f64 c i) < 3.2000000000000001e-195 or 2.19999999999999991e-20 < (*.f64 c i) < 9.4999999999999995e100

    1. Initial program 98.2%

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

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

    if -2.40000000000000012e100 < (*.f64 c i) < -1.5 or -6.59999999999999996e-180 < (*.f64 c i) < -2.60000000000000011e-227

    1. Initial program 100.0%

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

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

    if -1.5 < (*.f64 c i) < -4.00000000000000027e-68 or 3.2000000000000001e-195 < (*.f64 c i) < 2.19999999999999991e-20

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -2.3 \cdot 10^{+140}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -2.4 \cdot 10^{+100}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \cdot i \leq -1.5:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \cdot i \leq -4 \cdot 10^{-68}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq -6.6 \cdot 10^{-180}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \cdot i \leq -2.6 \cdot 10^{-227}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \cdot i \leq 3.2 \cdot 10^{-195}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \cdot i \leq 2.2 \cdot 10^{-20}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq 9.5 \cdot 10^{+100}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]

Alternative 6: 62.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot b + z \cdot t\\ t_2 := a \cdot b + x \cdot y\\ \mathbf{if}\;c \cdot i \leq -3.9 \cdot 10^{+141}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -4.4 \cdot 10^{+102}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \cdot i \leq -3.2 \cdot 10^{-59}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq -6.3 \cdot 10^{-180}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq -6.4 \cdot 10^{-230}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq 4.6 \cdot 10^{-159}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq 2.95 \cdot 10^{-8}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq 8 \cdot 10^{+137}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* a b) (* z t))) (t_2 (+ (* a b) (* x y))))
   (if (<= (* c i) -3.9e+141)
     (* c i)
     (if (<= (* c i) -4.4e+102)
       (* z t)
       (if (<= (* c i) -3.2e-59)
         t_2
         (if (<= (* c i) -6.3e-180)
           t_1
           (if (<= (* c i) -6.4e-230)
             t_2
             (if (<= (* c i) 4.6e-159)
               t_1
               (if (<= (* c i) 2.95e-8)
                 t_2
                 (if (<= (* c i) 8e+137) t_1 (* c i)))))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (a * b) + (z * t);
	double t_2 = (a * b) + (x * y);
	double tmp;
	if ((c * i) <= -3.9e+141) {
		tmp = c * i;
	} else if ((c * i) <= -4.4e+102) {
		tmp = z * t;
	} else if ((c * i) <= -3.2e-59) {
		tmp = t_2;
	} else if ((c * i) <= -6.3e-180) {
		tmp = t_1;
	} else if ((c * i) <= -6.4e-230) {
		tmp = t_2;
	} else if ((c * i) <= 4.6e-159) {
		tmp = t_1;
	} else if ((c * i) <= 2.95e-8) {
		tmp = t_2;
	} else if ((c * i) <= 8e+137) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (a * b) + (z * t)
    t_2 = (a * b) + (x * y)
    if ((c * i) <= (-3.9d+141)) then
        tmp = c * i
    else if ((c * i) <= (-4.4d+102)) then
        tmp = z * t
    else if ((c * i) <= (-3.2d-59)) then
        tmp = t_2
    else if ((c * i) <= (-6.3d-180)) then
        tmp = t_1
    else if ((c * i) <= (-6.4d-230)) then
        tmp = t_2
    else if ((c * i) <= 4.6d-159) then
        tmp = t_1
    else if ((c * i) <= 2.95d-8) then
        tmp = t_2
    else if ((c * i) <= 8d+137) then
        tmp = t_1
    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 t_1 = (a * b) + (z * t);
	double t_2 = (a * b) + (x * y);
	double tmp;
	if ((c * i) <= -3.9e+141) {
		tmp = c * i;
	} else if ((c * i) <= -4.4e+102) {
		tmp = z * t;
	} else if ((c * i) <= -3.2e-59) {
		tmp = t_2;
	} else if ((c * i) <= -6.3e-180) {
		tmp = t_1;
	} else if ((c * i) <= -6.4e-230) {
		tmp = t_2;
	} else if ((c * i) <= 4.6e-159) {
		tmp = t_1;
	} else if ((c * i) <= 2.95e-8) {
		tmp = t_2;
	} else if ((c * i) <= 8e+137) {
		tmp = t_1;
	} else {
		tmp = c * i;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (a * b) + (z * t)
	t_2 = (a * b) + (x * y)
	tmp = 0
	if (c * i) <= -3.9e+141:
		tmp = c * i
	elif (c * i) <= -4.4e+102:
		tmp = z * t
	elif (c * i) <= -3.2e-59:
		tmp = t_2
	elif (c * i) <= -6.3e-180:
		tmp = t_1
	elif (c * i) <= -6.4e-230:
		tmp = t_2
	elif (c * i) <= 4.6e-159:
		tmp = t_1
	elif (c * i) <= 2.95e-8:
		tmp = t_2
	elif (c * i) <= 8e+137:
		tmp = t_1
	else:
		tmp = c * i
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(a * b) + Float64(z * t))
	t_2 = Float64(Float64(a * b) + Float64(x * y))
	tmp = 0.0
	if (Float64(c * i) <= -3.9e+141)
		tmp = Float64(c * i);
	elseif (Float64(c * i) <= -4.4e+102)
		tmp = Float64(z * t);
	elseif (Float64(c * i) <= -3.2e-59)
		tmp = t_2;
	elseif (Float64(c * i) <= -6.3e-180)
		tmp = t_1;
	elseif (Float64(c * i) <= -6.4e-230)
		tmp = t_2;
	elseif (Float64(c * i) <= 4.6e-159)
		tmp = t_1;
	elseif (Float64(c * i) <= 2.95e-8)
		tmp = t_2;
	elseif (Float64(c * i) <= 8e+137)
		tmp = t_1;
	else
		tmp = Float64(c * i);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (a * b) + (z * t);
	t_2 = (a * b) + (x * y);
	tmp = 0.0;
	if ((c * i) <= -3.9e+141)
		tmp = c * i;
	elseif ((c * i) <= -4.4e+102)
		tmp = z * t;
	elseif ((c * i) <= -3.2e-59)
		tmp = t_2;
	elseif ((c * i) <= -6.3e-180)
		tmp = t_1;
	elseif ((c * i) <= -6.4e-230)
		tmp = t_2;
	elseif ((c * i) <= 4.6e-159)
		tmp = t_1;
	elseif ((c * i) <= 2.95e-8)
		tmp = t_2;
	elseif ((c * i) <= 8e+137)
		tmp = t_1;
	else
		tmp = c * i;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -3.9e+141], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -4.4e+102], N[(z * t), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -3.2e-59], t$95$2, If[LessEqual[N[(c * i), $MachinePrecision], -6.3e-180], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], -6.4e-230], t$95$2, If[LessEqual[N[(c * i), $MachinePrecision], 4.6e-159], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], 2.95e-8], t$95$2, If[LessEqual[N[(c * i), $MachinePrecision], 8e+137], t$95$1, N[(c * i), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
t_2 := a \cdot b + x \cdot y\\
\mathbf{if}\;c \cdot i \leq -3.9 \cdot 10^{+141}:\\
\;\;\;\;c \cdot i\\

\mathbf{elif}\;c \cdot i \leq -4.4 \cdot 10^{+102}:\\
\;\;\;\;z \cdot t\\

\mathbf{elif}\;c \cdot i \leq -3.2 \cdot 10^{-59}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;c \cdot i \leq -6.3 \cdot 10^{-180}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;c \cdot i \leq -6.4 \cdot 10^{-230}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;c \cdot i \leq 4.6 \cdot 10^{-159}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;c \cdot i \leq 2.95 \cdot 10^{-8}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;c \cdot i \leq 8 \cdot 10^{+137}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 c i) < -3.89999999999999991e141 or 8.0000000000000003e137 < (*.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. Taylor expanded in c around inf 72.7%

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

    if -3.89999999999999991e141 < (*.f64 c i) < -4.40000000000000015e102

    1. Initial program 100.0%

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

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

    if -4.40000000000000015e102 < (*.f64 c i) < -3.1999999999999999e-59 or -6.2999999999999996e-180 < (*.f64 c i) < -6.3999999999999999e-230 or 4.59999999999999957e-159 < (*.f64 c i) < 2.9499999999999999e-8

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\left(a \cdot b + y \cdot x\right)} + c \cdot i \]
    3. Taylor expanded in c around 0 75.2%

      \[\leadsto \color{blue}{a \cdot b + y \cdot x} \]

    if -3.1999999999999999e-59 < (*.f64 c i) < -6.2999999999999996e-180 or -6.3999999999999999e-230 < (*.f64 c i) < 4.59999999999999957e-159 or 2.9499999999999999e-8 < (*.f64 c i) < 8.0000000000000003e137

    1. Initial program 98.2%

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

      \[\leadsto \color{blue}{\left(a \cdot b + t \cdot z\right)} + c \cdot i \]
    3. Taylor expanded in c around 0 73.6%

      \[\leadsto \color{blue}{a \cdot b + t \cdot z} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification74.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -3.9 \cdot 10^{+141}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -4.4 \cdot 10^{+102}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \cdot i \leq -3.2 \cdot 10^{-59}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;c \cdot i \leq -6.3 \cdot 10^{-180}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;c \cdot i \leq -6.4 \cdot 10^{-230}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;c \cdot i \leq 4.6 \cdot 10^{-159}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;c \cdot i \leq 2.95 \cdot 10^{-8}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;c \cdot i \leq 8 \cdot 10^{+137}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]

Alternative 7: 66.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot b + x \cdot y\\ t_2 := c \cdot i + z \cdot t\\ t_3 := a \cdot b + z \cdot t\\ \mathbf{if}\;c \cdot i \leq -1.2 \cdot 10^{+81}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq -2.6 \cdot 10^{-61}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq -1.38 \cdot 10^{-179}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;c \cdot i \leq -9 \cdot 10^{-230}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq 9.6 \cdot 10^{-158}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{-6}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq 6.5 \cdot 10^{+46}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* a b) (* x y)))
        (t_2 (+ (* c i) (* z t)))
        (t_3 (+ (* a b) (* z t))))
   (if (<= (* c i) -1.2e+81)
     t_2
     (if (<= (* c i) -2.6e-61)
       t_1
       (if (<= (* c i) -1.38e-179)
         t_3
         (if (<= (* c i) -9e-230)
           t_1
           (if (<= (* c i) 9.6e-158)
             t_3
             (if (<= (* c i) 2e-6)
               t_1
               (if (<= (* c i) 6.5e+46) t_3 t_2)))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (a * b) + (x * y);
	double t_2 = (c * i) + (z * t);
	double t_3 = (a * b) + (z * t);
	double tmp;
	if ((c * i) <= -1.2e+81) {
		tmp = t_2;
	} else if ((c * i) <= -2.6e-61) {
		tmp = t_1;
	} else if ((c * i) <= -1.38e-179) {
		tmp = t_3;
	} else if ((c * i) <= -9e-230) {
		tmp = t_1;
	} else if ((c * i) <= 9.6e-158) {
		tmp = t_3;
	} else if ((c * i) <= 2e-6) {
		tmp = t_1;
	} else if ((c * i) <= 6.5e+46) {
		tmp = t_3;
	} else {
		tmp = t_2;
	}
	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) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = (a * b) + (x * y)
    t_2 = (c * i) + (z * t)
    t_3 = (a * b) + (z * t)
    if ((c * i) <= (-1.2d+81)) then
        tmp = t_2
    else if ((c * i) <= (-2.6d-61)) then
        tmp = t_1
    else if ((c * i) <= (-1.38d-179)) then
        tmp = t_3
    else if ((c * i) <= (-9d-230)) then
        tmp = t_1
    else if ((c * i) <= 9.6d-158) then
        tmp = t_3
    else if ((c * i) <= 2d-6) then
        tmp = t_1
    else if ((c * i) <= 6.5d+46) then
        tmp = t_3
    else
        tmp = t_2
    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 t_1 = (a * b) + (x * y);
	double t_2 = (c * i) + (z * t);
	double t_3 = (a * b) + (z * t);
	double tmp;
	if ((c * i) <= -1.2e+81) {
		tmp = t_2;
	} else if ((c * i) <= -2.6e-61) {
		tmp = t_1;
	} else if ((c * i) <= -1.38e-179) {
		tmp = t_3;
	} else if ((c * i) <= -9e-230) {
		tmp = t_1;
	} else if ((c * i) <= 9.6e-158) {
		tmp = t_3;
	} else if ((c * i) <= 2e-6) {
		tmp = t_1;
	} else if ((c * i) <= 6.5e+46) {
		tmp = t_3;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (a * b) + (x * y)
	t_2 = (c * i) + (z * t)
	t_3 = (a * b) + (z * t)
	tmp = 0
	if (c * i) <= -1.2e+81:
		tmp = t_2
	elif (c * i) <= -2.6e-61:
		tmp = t_1
	elif (c * i) <= -1.38e-179:
		tmp = t_3
	elif (c * i) <= -9e-230:
		tmp = t_1
	elif (c * i) <= 9.6e-158:
		tmp = t_3
	elif (c * i) <= 2e-6:
		tmp = t_1
	elif (c * i) <= 6.5e+46:
		tmp = t_3
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(a * b) + Float64(x * y))
	t_2 = Float64(Float64(c * i) + Float64(z * t))
	t_3 = Float64(Float64(a * b) + Float64(z * t))
	tmp = 0.0
	if (Float64(c * i) <= -1.2e+81)
		tmp = t_2;
	elseif (Float64(c * i) <= -2.6e-61)
		tmp = t_1;
	elseif (Float64(c * i) <= -1.38e-179)
		tmp = t_3;
	elseif (Float64(c * i) <= -9e-230)
		tmp = t_1;
	elseif (Float64(c * i) <= 9.6e-158)
		tmp = t_3;
	elseif (Float64(c * i) <= 2e-6)
		tmp = t_1;
	elseif (Float64(c * i) <= 6.5e+46)
		tmp = t_3;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (a * b) + (x * y);
	t_2 = (c * i) + (z * t);
	t_3 = (a * b) + (z * t);
	tmp = 0.0;
	if ((c * i) <= -1.2e+81)
		tmp = t_2;
	elseif ((c * i) <= -2.6e-61)
		tmp = t_1;
	elseif ((c * i) <= -1.38e-179)
		tmp = t_3;
	elseif ((c * i) <= -9e-230)
		tmp = t_1;
	elseif ((c * i) <= 9.6e-158)
		tmp = t_3;
	elseif ((c * i) <= 2e-6)
		tmp = t_1;
	elseif ((c * i) <= 6.5e+46)
		tmp = t_3;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -1.2e+81], t$95$2, If[LessEqual[N[(c * i), $MachinePrecision], -2.6e-61], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], -1.38e-179], t$95$3, If[LessEqual[N[(c * i), $MachinePrecision], -9e-230], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], 9.6e-158], t$95$3, If[LessEqual[N[(c * i), $MachinePrecision], 2e-6], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], 6.5e+46], t$95$3, t$95$2]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := a \cdot b + x \cdot y\\
t_2 := c \cdot i + z \cdot t\\
t_3 := a \cdot b + z \cdot t\\
\mathbf{if}\;c \cdot i \leq -1.2 \cdot 10^{+81}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;c \cdot i \leq -2.6 \cdot 10^{-61}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;c \cdot i \leq -1.38 \cdot 10^{-179}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;c \cdot i \leq -9 \cdot 10^{-230}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;c \cdot i \leq 9.6 \cdot 10^{-158}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{-6}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;c \cdot i \leq 6.5 \cdot 10^{+46}:\\
\;\;\;\;t_3\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 c i) < -1.19999999999999995e81 or 6.50000000000000008e46 < (*.f64 c i)

    1. Initial program 91.9%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Step-by-step derivation
      1. associate-+l+91.9%

        \[\leadsto \color{blue}{\left(x \cdot y + z \cdot t\right) + \left(a \cdot b + c \cdot i\right)} \]
      2. associate-+l+91.9%

        \[\leadsto \color{blue}{x \cdot y + \left(z \cdot t + \left(a \cdot b + c \cdot i\right)\right)} \]
      3. fma-def93.0%

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

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

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

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

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

      \[\leadsto \color{blue}{c \cdot i + t \cdot z} \]

    if -1.19999999999999995e81 < (*.f64 c i) < -2.6000000000000001e-61 or -1.3800000000000001e-179 < (*.f64 c i) < -9.00000000000000007e-230 or 9.6000000000000003e-158 < (*.f64 c i) < 1.99999999999999991e-6

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\left(a \cdot b + y \cdot x\right)} + c \cdot i \]
    3. Taylor expanded in c around 0 78.2%

      \[\leadsto \color{blue}{a \cdot b + y \cdot x} \]

    if -2.6000000000000001e-61 < (*.f64 c i) < -1.3800000000000001e-179 or -9.00000000000000007e-230 < (*.f64 c i) < 9.6000000000000003e-158 or 1.99999999999999991e-6 < (*.f64 c i) < 6.50000000000000008e46

    1. Initial program 98.0%

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

      \[\leadsto \color{blue}{\left(a \cdot b + t \cdot z\right)} + c \cdot i \]
    3. Taylor expanded in c around 0 75.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1.2 \cdot 10^{+81}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;c \cdot i \leq -2.6 \cdot 10^{-61}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;c \cdot i \leq -1.38 \cdot 10^{-179}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;c \cdot i \leq -9 \cdot 10^{-230}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;c \cdot i \leq 9.6 \cdot 10^{-158}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{-6}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;c \cdot i \leq 6.5 \cdot 10^{+46}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \end{array} \]

Alternative 8: 42.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \cdot i \leq -3.5 \cdot 10^{+148}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -4.8 \cdot 10^{+98}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \cdot i \leq -1.1 \cdot 10^{+79}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -7.5 \cdot 10^{-65}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq 5.4 \cdot 10^{-195}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \cdot i \leq 2.65 \cdot 10^{-20}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq 2.3 \cdot 10^{+105}:\\ \;\;\;\;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) -3.5e+148)
   (* c i)
   (if (<= (* c i) -4.8e+98)
     (* z t)
     (if (<= (* c i) -1.1e+79)
       (* c i)
       (if (<= (* c i) -7.5e-65)
         (* a b)
         (if (<= (* c i) 5.4e-195)
           (* z t)
           (if (<= (* c i) 2.65e-20)
             (* a b)
             (if (<= (* c i) 2.3e+105) (* 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) <= -3.5e+148) {
		tmp = c * i;
	} else if ((c * i) <= -4.8e+98) {
		tmp = z * t;
	} else if ((c * i) <= -1.1e+79) {
		tmp = c * i;
	} else if ((c * i) <= -7.5e-65) {
		tmp = a * b;
	} else if ((c * i) <= 5.4e-195) {
		tmp = z * t;
	} else if ((c * i) <= 2.65e-20) {
		tmp = a * b;
	} else if ((c * i) <= 2.3e+105) {
		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) <= (-3.5d+148)) then
        tmp = c * i
    else if ((c * i) <= (-4.8d+98)) then
        tmp = z * t
    else if ((c * i) <= (-1.1d+79)) then
        tmp = c * i
    else if ((c * i) <= (-7.5d-65)) then
        tmp = a * b
    else if ((c * i) <= 5.4d-195) then
        tmp = z * t
    else if ((c * i) <= 2.65d-20) then
        tmp = a * b
    else if ((c * i) <= 2.3d+105) 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) <= -3.5e+148) {
		tmp = c * i;
	} else if ((c * i) <= -4.8e+98) {
		tmp = z * t;
	} else if ((c * i) <= -1.1e+79) {
		tmp = c * i;
	} else if ((c * i) <= -7.5e-65) {
		tmp = a * b;
	} else if ((c * i) <= 5.4e-195) {
		tmp = z * t;
	} else if ((c * i) <= 2.65e-20) {
		tmp = a * b;
	} else if ((c * i) <= 2.3e+105) {
		tmp = z * t;
	} else {
		tmp = c * i;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (c * i) <= -3.5e+148:
		tmp = c * i
	elif (c * i) <= -4.8e+98:
		tmp = z * t
	elif (c * i) <= -1.1e+79:
		tmp = c * i
	elif (c * i) <= -7.5e-65:
		tmp = a * b
	elif (c * i) <= 5.4e-195:
		tmp = z * t
	elif (c * i) <= 2.65e-20:
		tmp = a * b
	elif (c * i) <= 2.3e+105:
		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) <= -3.5e+148)
		tmp = Float64(c * i);
	elseif (Float64(c * i) <= -4.8e+98)
		tmp = Float64(z * t);
	elseif (Float64(c * i) <= -1.1e+79)
		tmp = Float64(c * i);
	elseif (Float64(c * i) <= -7.5e-65)
		tmp = Float64(a * b);
	elseif (Float64(c * i) <= 5.4e-195)
		tmp = Float64(z * t);
	elseif (Float64(c * i) <= 2.65e-20)
		tmp = Float64(a * b);
	elseif (Float64(c * i) <= 2.3e+105)
		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) <= -3.5e+148)
		tmp = c * i;
	elseif ((c * i) <= -4.8e+98)
		tmp = z * t;
	elseif ((c * i) <= -1.1e+79)
		tmp = c * i;
	elseif ((c * i) <= -7.5e-65)
		tmp = a * b;
	elseif ((c * i) <= 5.4e-195)
		tmp = z * t;
	elseif ((c * i) <= 2.65e-20)
		tmp = a * b;
	elseif ((c * i) <= 2.3e+105)
		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], -3.5e+148], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -4.8e+98], N[(z * t), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -1.1e+79], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -7.5e-65], N[(a * b), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 5.4e-195], N[(z * t), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 2.65e-20], N[(a * b), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 2.3e+105], N[(z * t), $MachinePrecision], N[(c * i), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;c \cdot i \leq -4.8 \cdot 10^{+98}:\\
\;\;\;\;z \cdot t\\

\mathbf{elif}\;c \cdot i \leq -1.1 \cdot 10^{+79}:\\
\;\;\;\;c \cdot i\\

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

\mathbf{elif}\;c \cdot i \leq 5.4 \cdot 10^{-195}:\\
\;\;\;\;z \cdot t\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 c i) < -3.4999999999999999e148 or -4.7999999999999997e98 < (*.f64 c i) < -1.0999999999999999e79 or 2.2999999999999998e105 < (*.f64 c i)

    1. Initial program 90.2%

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

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

    if -3.4999999999999999e148 < (*.f64 c i) < -4.7999999999999997e98 or -7.5000000000000002e-65 < (*.f64 c i) < 5.4e-195 or 2.6500000000000001e-20 < (*.f64 c i) < 2.2999999999999998e105

    1. Initial program 98.3%

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

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

    if -1.0999999999999999e79 < (*.f64 c i) < -7.5000000000000002e-65 or 5.4e-195 < (*.f64 c i) < 2.6500000000000001e-20

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -3.5 \cdot 10^{+148}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -4.8 \cdot 10^{+98}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \cdot i \leq -1.1 \cdot 10^{+79}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -7.5 \cdot 10^{-65}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq 5.4 \cdot 10^{-195}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \cdot i \leq 2.65 \cdot 10^{-20}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq 2.3 \cdot 10^{+105}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]

Alternative 9: 97.1% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\


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

    1. Initial program 100.0%

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

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

    1. Initial program 0.0%

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

      \[\leadsto \color{blue}{\left(a \cdot b + t \cdot z\right)} + c \cdot i \]
    3. Taylor expanded in c around 0 41.6%

      \[\leadsto \color{blue}{a \cdot b + t \cdot z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification97.7%

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

Alternative 10: 62.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot b + z \cdot t\\ \mathbf{if}\;c \cdot i \leq -3.2 \cdot 10^{+148}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -6.3 \cdot 10^{-180}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq -2.6 \cdot 10^{-227}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \cdot i \leq 2.4 \cdot 10^{+137}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* a b) (* z t))))
   (if (<= (* c i) -3.2e+148)
     (* c i)
     (if (<= (* c i) -6.3e-180)
       t_1
       (if (<= (* c i) -2.6e-227)
         (* x y)
         (if (<= (* c i) 2.4e+137) t_1 (* c i)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (a * b) + (z * t);
	double tmp;
	if ((c * i) <= -3.2e+148) {
		tmp = c * i;
	} else if ((c * i) <= -6.3e-180) {
		tmp = t_1;
	} else if ((c * i) <= -2.6e-227) {
		tmp = x * y;
	} else if ((c * i) <= 2.4e+137) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_1 = (a * b) + (z * t)
    if ((c * i) <= (-3.2d+148)) then
        tmp = c * i
    else if ((c * i) <= (-6.3d-180)) then
        tmp = t_1
    else if ((c * i) <= (-2.6d-227)) then
        tmp = x * y
    else if ((c * i) <= 2.4d+137) then
        tmp = t_1
    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 t_1 = (a * b) + (z * t);
	double tmp;
	if ((c * i) <= -3.2e+148) {
		tmp = c * i;
	} else if ((c * i) <= -6.3e-180) {
		tmp = t_1;
	} else if ((c * i) <= -2.6e-227) {
		tmp = x * y;
	} else if ((c * i) <= 2.4e+137) {
		tmp = t_1;
	} else {
		tmp = c * i;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (a * b) + (z * t)
	tmp = 0
	if (c * i) <= -3.2e+148:
		tmp = c * i
	elif (c * i) <= -6.3e-180:
		tmp = t_1
	elif (c * i) <= -2.6e-227:
		tmp = x * y
	elif (c * i) <= 2.4e+137:
		tmp = t_1
	else:
		tmp = c * i
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(a * b) + Float64(z * t))
	tmp = 0.0
	if (Float64(c * i) <= -3.2e+148)
		tmp = Float64(c * i);
	elseif (Float64(c * i) <= -6.3e-180)
		tmp = t_1;
	elseif (Float64(c * i) <= -2.6e-227)
		tmp = Float64(x * y);
	elseif (Float64(c * i) <= 2.4e+137)
		tmp = t_1;
	else
		tmp = Float64(c * i);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (a * b) + (z * t);
	tmp = 0.0;
	if ((c * i) <= -3.2e+148)
		tmp = c * i;
	elseif ((c * i) <= -6.3e-180)
		tmp = t_1;
	elseif ((c * i) <= -2.6e-227)
		tmp = x * y;
	elseif ((c * i) <= 2.4e+137)
		tmp = t_1;
	else
		tmp = c * i;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -3.2e+148], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -6.3e-180], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], -2.6e-227], N[(x * y), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 2.4e+137], t$95$1, N[(c * i), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
\mathbf{if}\;c \cdot i \leq -3.2 \cdot 10^{+148}:\\
\;\;\;\;c \cdot i\\

\mathbf{elif}\;c \cdot i \leq -6.3 \cdot 10^{-180}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;c \cdot i \leq 2.4 \cdot 10^{+137}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 c i) < -3.1999999999999999e148 or 2.39999999999999983e137 < (*.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. Taylor expanded in c around inf 72.7%

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

    if -3.1999999999999999e148 < (*.f64 c i) < -6.2999999999999996e-180 or -2.60000000000000011e-227 < (*.f64 c i) < 2.39999999999999983e137

    1. Initial program 98.8%

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

      \[\leadsto \color{blue}{\left(a \cdot b + t \cdot z\right)} + c \cdot i \]
    3. Taylor expanded in c around 0 67.0%

      \[\leadsto \color{blue}{a \cdot b + t \cdot z} \]

    if -6.2999999999999996e-180 < (*.f64 c i) < -2.60000000000000011e-227

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -3.2 \cdot 10^{+148}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -6.3 \cdot 10^{-180}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;c \cdot i \leq -2.6 \cdot 10^{-227}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \cdot i \leq 2.4 \cdot 10^{+137}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]

Alternative 11: 60.0% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot b + z \cdot t\\ t_2 := c \cdot i + x \cdot y\\ t_3 := a \cdot b + x \cdot y\\ \mathbf{if}\;c \leq -6.8 \cdot 10^{+72}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \leq -1.75 \cdot 10^{-140}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -1.65 \cdot 10^{-186}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;c \leq -9 \cdot 10^{-246}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -8 \cdot 10^{-303}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;c \leq 6.1 \cdot 10^{-114}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* a b) (* z t)))
        (t_2 (+ (* c i) (* x y)))
        (t_3 (+ (* a b) (* x y))))
   (if (<= c -6.8e+72)
     t_2
     (if (<= c -1.75e-140)
       t_1
       (if (<= c -1.65e-186)
         t_3
         (if (<= c -9e-246)
           t_1
           (if (<= c -8e-303) t_3 (if (<= c 6.1e-114) t_1 t_2))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (a * b) + (z * t);
	double t_2 = (c * i) + (x * y);
	double t_3 = (a * b) + (x * y);
	double tmp;
	if (c <= -6.8e+72) {
		tmp = t_2;
	} else if (c <= -1.75e-140) {
		tmp = t_1;
	} else if (c <= -1.65e-186) {
		tmp = t_3;
	} else if (c <= -9e-246) {
		tmp = t_1;
	} else if (c <= -8e-303) {
		tmp = t_3;
	} else if (c <= 6.1e-114) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	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) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = (a * b) + (z * t)
    t_2 = (c * i) + (x * y)
    t_3 = (a * b) + (x * y)
    if (c <= (-6.8d+72)) then
        tmp = t_2
    else if (c <= (-1.75d-140)) then
        tmp = t_1
    else if (c <= (-1.65d-186)) then
        tmp = t_3
    else if (c <= (-9d-246)) then
        tmp = t_1
    else if (c <= (-8d-303)) then
        tmp = t_3
    else if (c <= 6.1d-114) then
        tmp = t_1
    else
        tmp = t_2
    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 t_1 = (a * b) + (z * t);
	double t_2 = (c * i) + (x * y);
	double t_3 = (a * b) + (x * y);
	double tmp;
	if (c <= -6.8e+72) {
		tmp = t_2;
	} else if (c <= -1.75e-140) {
		tmp = t_1;
	} else if (c <= -1.65e-186) {
		tmp = t_3;
	} else if (c <= -9e-246) {
		tmp = t_1;
	} else if (c <= -8e-303) {
		tmp = t_3;
	} else if (c <= 6.1e-114) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (a * b) + (z * t)
	t_2 = (c * i) + (x * y)
	t_3 = (a * b) + (x * y)
	tmp = 0
	if c <= -6.8e+72:
		tmp = t_2
	elif c <= -1.75e-140:
		tmp = t_1
	elif c <= -1.65e-186:
		tmp = t_3
	elif c <= -9e-246:
		tmp = t_1
	elif c <= -8e-303:
		tmp = t_3
	elif c <= 6.1e-114:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(a * b) + Float64(z * t))
	t_2 = Float64(Float64(c * i) + Float64(x * y))
	t_3 = Float64(Float64(a * b) + Float64(x * y))
	tmp = 0.0
	if (c <= -6.8e+72)
		tmp = t_2;
	elseif (c <= -1.75e-140)
		tmp = t_1;
	elseif (c <= -1.65e-186)
		tmp = t_3;
	elseif (c <= -9e-246)
		tmp = t_1;
	elseif (c <= -8e-303)
		tmp = t_3;
	elseif (c <= 6.1e-114)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (a * b) + (z * t);
	t_2 = (c * i) + (x * y);
	t_3 = (a * b) + (x * y);
	tmp = 0.0;
	if (c <= -6.8e+72)
		tmp = t_2;
	elseif (c <= -1.75e-140)
		tmp = t_1;
	elseif (c <= -1.65e-186)
		tmp = t_3;
	elseif (c <= -9e-246)
		tmp = t_1;
	elseif (c <= -8e-303)
		tmp = t_3;
	elseif (c <= 6.1e-114)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c * i), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -6.8e+72], t$95$2, If[LessEqual[c, -1.75e-140], t$95$1, If[LessEqual[c, -1.65e-186], t$95$3, If[LessEqual[c, -9e-246], t$95$1, If[LessEqual[c, -8e-303], t$95$3, If[LessEqual[c, 6.1e-114], t$95$1, t$95$2]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
t_2 := c \cdot i + x \cdot y\\
t_3 := a \cdot b + x \cdot y\\
\mathbf{if}\;c \leq -6.8 \cdot 10^{+72}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;c \leq -1.75 \cdot 10^{-140}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;c \leq -1.65 \cdot 10^{-186}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;c \leq -9 \cdot 10^{-246}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;c \leq -8 \cdot 10^{-303}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;c \leq 6.1 \cdot 10^{-114}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -6.7999999999999997e72 or 6.09999999999999977e-114 < c

    1. Initial program 93.9%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Step-by-step derivation
      1. associate-+l+93.9%

        \[\leadsto \color{blue}{\left(x \cdot y + z \cdot t\right) + \left(a \cdot b + c \cdot i\right)} \]
      2. associate-+l+93.9%

        \[\leadsto \color{blue}{x \cdot y + \left(z \cdot t + \left(a \cdot b + c \cdot i\right)\right)} \]
      3. fma-def94.7%

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

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

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

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

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

      \[\leadsto \color{blue}{c \cdot i + y \cdot x} \]

    if -6.7999999999999997e72 < c < -1.7499999999999999e-140 or -1.65e-186 < c < -8.99999999999999998e-246 or -7.99999999999999944e-303 < c < 6.09999999999999977e-114

    1. Initial program 99.0%

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

      \[\leadsto \color{blue}{\left(a \cdot b + t \cdot z\right)} + c \cdot i \]
    3. Taylor expanded in c around 0 66.4%

      \[\leadsto \color{blue}{a \cdot b + t \cdot z} \]

    if -1.7499999999999999e-140 < c < -1.65e-186 or -8.99999999999999998e-246 < c < -7.99999999999999944e-303

    1. Initial program 95.0%

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

      \[\leadsto \color{blue}{\left(a \cdot b + y \cdot x\right)} + c \cdot i \]
    3. Taylor expanded in c around 0 70.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -6.8 \cdot 10^{+72}:\\ \;\;\;\;c \cdot i + x \cdot y\\ \mathbf{elif}\;c \leq -1.75 \cdot 10^{-140}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;c \leq -1.65 \cdot 10^{-186}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;c \leq -9 \cdot 10^{-246}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;c \leq -8 \cdot 10^{-303}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;c \leq 6.1 \cdot 10^{-114}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;c \cdot i + x \cdot y\\ \end{array} \]

Alternative 12: 60.2% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot b + z \cdot t\\ t_2 := c \cdot i + x \cdot y\\ \mathbf{if}\;c \leq -6.5 \cdot 10^{+72}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \leq -1.8 \cdot 10^{-140}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -2.5 \cdot 10^{-186}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;c \leq -7.6 \cdot 10^{-227}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -6 \cdot 10^{-304}:\\ \;\;\;\;z \cdot t + x \cdot y\\ \mathbf{elif}\;c \leq 6.1 \cdot 10^{-114}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* a b) (* z t))) (t_2 (+ (* c i) (* x y))))
   (if (<= c -6.5e+72)
     t_2
     (if (<= c -1.8e-140)
       t_1
       (if (<= c -2.5e-186)
         (+ (* a b) (* x y))
         (if (<= c -7.6e-227)
           t_1
           (if (<= c -6e-304)
             (+ (* z t) (* x y))
             (if (<= c 6.1e-114) t_1 t_2))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (a * b) + (z * t);
	double t_2 = (c * i) + (x * y);
	double tmp;
	if (c <= -6.5e+72) {
		tmp = t_2;
	} else if (c <= -1.8e-140) {
		tmp = t_1;
	} else if (c <= -2.5e-186) {
		tmp = (a * b) + (x * y);
	} else if (c <= -7.6e-227) {
		tmp = t_1;
	} else if (c <= -6e-304) {
		tmp = (z * t) + (x * y);
	} else if (c <= 6.1e-114) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (a * b) + (z * t)
    t_2 = (c * i) + (x * y)
    if (c <= (-6.5d+72)) then
        tmp = t_2
    else if (c <= (-1.8d-140)) then
        tmp = t_1
    else if (c <= (-2.5d-186)) then
        tmp = (a * b) + (x * y)
    else if (c <= (-7.6d-227)) then
        tmp = t_1
    else if (c <= (-6d-304)) then
        tmp = (z * t) + (x * y)
    else if (c <= 6.1d-114) then
        tmp = t_1
    else
        tmp = t_2
    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 t_1 = (a * b) + (z * t);
	double t_2 = (c * i) + (x * y);
	double tmp;
	if (c <= -6.5e+72) {
		tmp = t_2;
	} else if (c <= -1.8e-140) {
		tmp = t_1;
	} else if (c <= -2.5e-186) {
		tmp = (a * b) + (x * y);
	} else if (c <= -7.6e-227) {
		tmp = t_1;
	} else if (c <= -6e-304) {
		tmp = (z * t) + (x * y);
	} else if (c <= 6.1e-114) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (a * b) + (z * t)
	t_2 = (c * i) + (x * y)
	tmp = 0
	if c <= -6.5e+72:
		tmp = t_2
	elif c <= -1.8e-140:
		tmp = t_1
	elif c <= -2.5e-186:
		tmp = (a * b) + (x * y)
	elif c <= -7.6e-227:
		tmp = t_1
	elif c <= -6e-304:
		tmp = (z * t) + (x * y)
	elif c <= 6.1e-114:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(a * b) + Float64(z * t))
	t_2 = Float64(Float64(c * i) + Float64(x * y))
	tmp = 0.0
	if (c <= -6.5e+72)
		tmp = t_2;
	elseif (c <= -1.8e-140)
		tmp = t_1;
	elseif (c <= -2.5e-186)
		tmp = Float64(Float64(a * b) + Float64(x * y));
	elseif (c <= -7.6e-227)
		tmp = t_1;
	elseif (c <= -6e-304)
		tmp = Float64(Float64(z * t) + Float64(x * y));
	elseif (c <= 6.1e-114)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (a * b) + (z * t);
	t_2 = (c * i) + (x * y);
	tmp = 0.0;
	if (c <= -6.5e+72)
		tmp = t_2;
	elseif (c <= -1.8e-140)
		tmp = t_1;
	elseif (c <= -2.5e-186)
		tmp = (a * b) + (x * y);
	elseif (c <= -7.6e-227)
		tmp = t_1;
	elseif (c <= -6e-304)
		tmp = (z * t) + (x * y);
	elseif (c <= 6.1e-114)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c * i), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -6.5e+72], t$95$2, If[LessEqual[c, -1.8e-140], t$95$1, If[LessEqual[c, -2.5e-186], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -7.6e-227], t$95$1, If[LessEqual[c, -6e-304], N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 6.1e-114], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
t_2 := c \cdot i + x \cdot y\\
\mathbf{if}\;c \leq -6.5 \cdot 10^{+72}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;c \leq -1.8 \cdot 10^{-140}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;c \leq -2.5 \cdot 10^{-186}:\\
\;\;\;\;a \cdot b + x \cdot y\\

\mathbf{elif}\;c \leq -7.6 \cdot 10^{-227}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;c \leq -6 \cdot 10^{-304}:\\
\;\;\;\;z \cdot t + x \cdot y\\

\mathbf{elif}\;c \leq 6.1 \cdot 10^{-114}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if c < -6.5000000000000001e72 or 6.09999999999999977e-114 < c

    1. Initial program 93.9%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Step-by-step derivation
      1. associate-+l+93.9%

        \[\leadsto \color{blue}{\left(x \cdot y + z \cdot t\right) + \left(a \cdot b + c \cdot i\right)} \]
      2. associate-+l+93.9%

        \[\leadsto \color{blue}{x \cdot y + \left(z \cdot t + \left(a \cdot b + c \cdot i\right)\right)} \]
      3. fma-def94.7%

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

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

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

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

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

      \[\leadsto \color{blue}{c \cdot i + y \cdot x} \]

    if -6.5000000000000001e72 < c < -1.8e-140 or -2.5e-186 < c < -7.60000000000000019e-227 or -6.0000000000000002e-304 < c < 6.09999999999999977e-114

    1. Initial program 99.0%

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

      \[\leadsto \color{blue}{\left(a \cdot b + t \cdot z\right)} + c \cdot i \]
    3. Taylor expanded in c around 0 65.4%

      \[\leadsto \color{blue}{a \cdot b + t \cdot z} \]

    if -1.8e-140 < c < -2.5e-186

    1. Initial program 91.7%

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

      \[\leadsto \color{blue}{\left(a \cdot b + y \cdot x\right)} + c \cdot i \]
    3. Taylor expanded in c around 0 67.6%

      \[\leadsto \color{blue}{a \cdot b + y \cdot x} \]

    if -7.60000000000000019e-227 < c < -6.0000000000000002e-304

    1. Initial program 100.0%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Step-by-step derivation
      1. associate-+l+100.0%

        \[\leadsto \color{blue}{\left(x \cdot y + z \cdot t\right) + \left(a \cdot b + c \cdot i\right)} \]
      2. associate-+l+100.0%

        \[\leadsto \color{blue}{x \cdot y + \left(z \cdot t + \left(a \cdot b + c \cdot i\right)\right)} \]
      3. fma-def100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot x + t \cdot z} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification65.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -6.5 \cdot 10^{+72}:\\ \;\;\;\;c \cdot i + x \cdot y\\ \mathbf{elif}\;c \leq -1.8 \cdot 10^{-140}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;c \leq -2.5 \cdot 10^{-186}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;c \leq -7.6 \cdot 10^{-227}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;c \leq -6 \cdot 10^{-304}:\\ \;\;\;\;z \cdot t + x \cdot y\\ \mathbf{elif}\;c \leq 6.1 \cdot 10^{-114}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;c \cdot i + x \cdot y\\ \end{array} \]

Alternative 13: 77.6% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{+231}:\\
\;\;\;\;z \cdot t + x \cdot y\\

\mathbf{elif}\;x \leq -2 \cdot 10^{+169}:\\
\;\;\;\;c \cdot i + x \cdot y\\

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

\mathbf{else}:\\
\;\;\;\;a \cdot b + x \cdot y\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -2.29999999999999999e231

    1. Initial program 99.9%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Step-by-step derivation
      1. associate-+l+99.9%

        \[\leadsto \color{blue}{\left(x \cdot y + z \cdot t\right) + \left(a \cdot b + c \cdot i\right)} \]
      2. associate-+l+99.9%

        \[\leadsto \color{blue}{x \cdot y + \left(z \cdot t + \left(a \cdot b + c \cdot i\right)\right)} \]
      3. fma-def100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot x + t \cdot z} \]

    if -2.29999999999999999e231 < x < -1.99999999999999987e169

    1. Initial program 92.2%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Step-by-step derivation
      1. associate-+l+92.2%

        \[\leadsto \color{blue}{\left(x \cdot y + z \cdot t\right) + \left(a \cdot b + c \cdot i\right)} \]
      2. associate-+l+92.2%

        \[\leadsto \color{blue}{x \cdot y + \left(z \cdot t + \left(a \cdot b + c \cdot i\right)\right)} \]
      3. fma-def92.2%

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

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

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

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

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

      \[\leadsto \color{blue}{c \cdot i + y \cdot x} \]

    if -1.99999999999999987e169 < x < 3.9999999999999998e33

    1. Initial program 95.1%

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

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

    if 3.9999999999999998e33 < x

    1. Initial program 98.5%

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

      \[\leadsto \color{blue}{\left(a \cdot b + y \cdot x\right)} + c \cdot i \]
    3. Taylor expanded in c around 0 60.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.3 \cdot 10^{+231}:\\ \;\;\;\;z \cdot t + x \cdot y\\ \mathbf{elif}\;x \leq -2 \cdot 10^{+169}:\\ \;\;\;\;c \cdot i + x \cdot y\\ \mathbf{elif}\;x \leq 4 \cdot 10^{+33}:\\ \;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \end{array} \]

Alternative 14: 81.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -7.5 \cdot 10^{+119} \lor \neg \left(x \leq 9 \cdot 10^{-115}\right):\\ \;\;\;\;c \cdot i + \left(a \cdot b + x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (or (<= x -7.5e+119) (not (<= x 9e-115)))
   (+ (* c i) (+ (* a b) (* x y)))
   (+ (* c i) (+ (* a b) (* z t)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((x <= -7.5e+119) || !(x <= 9e-115)) {
		tmp = (c * i) + ((a * b) + (x * y));
	} else {
		tmp = (c * i) + ((a * b) + (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 ((x <= (-7.5d+119)) .or. (.not. (x <= 9d-115))) then
        tmp = (c * i) + ((a * b) + (x * y))
    else
        tmp = (c * i) + ((a * b) + (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 ((x <= -7.5e+119) || !(x <= 9e-115)) {
		tmp = (c * i) + ((a * b) + (x * y));
	} else {
		tmp = (c * i) + ((a * b) + (z * t));
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (x <= -7.5e+119) or not (x <= 9e-115):
		tmp = (c * i) + ((a * b) + (x * y))
	else:
		tmp = (c * i) + ((a * b) + (z * t))
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if ((x <= -7.5e+119) || !(x <= 9e-115))
		tmp = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(x * y)));
	else
		tmp = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(z * t)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if ((x <= -7.5e+119) || ~((x <= 9e-115)))
		tmp = (c * i) + ((a * b) + (x * y));
	else
		tmp = (c * i) + ((a * b) + (z * t));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -7.5e+119], N[Not[LessEqual[x, 9e-115]], $MachinePrecision]], N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{+119} \lor \neg \left(x \leq 9 \cdot 10^{-115}\right):\\
\;\;\;\;c \cdot i + \left(a \cdot b + x \cdot y\right)\\

\mathbf{else}:\\
\;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.500000000000001e119 or 9.00000000000000046e-115 < x

    1. Initial program 96.2%

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

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

    if -7.500000000000001e119 < x < 9.00000000000000046e-115

    1. Initial program 95.9%

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

      \[\leadsto \color{blue}{\left(a \cdot b + t \cdot z\right)} + c \cdot i \]
  3. Recombined 2 regimes into one program.
  4. Final simplification83.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7.5 \cdot 10^{+119} \lor \neg \left(x \leq 9 \cdot 10^{-115}\right):\\ \;\;\;\;c \cdot i + \left(a \cdot b + x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\ \end{array} \]

Alternative 15: 82.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{+104}:\\
\;\;\;\;c \cdot i + \left(z \cdot t + x \cdot y\right)\\

\mathbf{elif}\;x \leq 1.25 \cdot 10^{-114}:\\
\;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.5000000000000002e104

    1. Initial program 94.7%

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

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

    if -3.5000000000000002e104 < x < 1.24999999999999997e-114

    1. Initial program 95.7%

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

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

    if 1.24999999999999997e-114 < x

    1. Initial program 97.0%

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

      \[\leadsto \color{blue}{\left(a \cdot b + y \cdot x\right)} + c \cdot i \]
  3. Recombined 3 regimes into one program.
  4. Final simplification86.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.5 \cdot 10^{+104}:\\ \;\;\;\;c \cdot i + \left(z \cdot t + x \cdot y\right)\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{-114}:\\ \;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;c \cdot i + \left(a \cdot b + x \cdot y\right)\\ \end{array} \]

Alternative 16: 61.3% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
\mathbf{if}\;z \leq -2.15 \cdot 10^{+29}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 5.8 \cdot 10^{-196}:\\
\;\;\;\;c \cdot i + a \cdot b\\

\mathbf{elif}\;z \leq 1.5 \cdot 10^{-19}:\\
\;\;\;\;a \cdot b + x \cdot y\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.1500000000000001e29 or 1.49999999999999996e-19 < z

    1. Initial program 93.2%

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

      \[\leadsto \color{blue}{\left(a \cdot b + t \cdot z\right)} + c \cdot i \]
    3. Taylor expanded in c around 0 63.3%

      \[\leadsto \color{blue}{a \cdot b + t \cdot z} \]

    if -2.1500000000000001e29 < z < 5.79999999999999974e-196

    1. Initial program 98.8%

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

      \[\leadsto \color{blue}{\left(a \cdot b + t \cdot z\right)} + c \cdot i \]
    3. Taylor expanded in t around 0 63.4%

      \[\leadsto \color{blue}{c \cdot i + a \cdot b} \]

    if 5.79999999999999974e-196 < z < 1.49999999999999996e-19

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{\left(a \cdot b + y \cdot x\right)} + c \cdot i \]
    3. Taylor expanded in c around 0 66.8%

      \[\leadsto \color{blue}{a \cdot b + y \cdot x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification63.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.15 \cdot 10^{+29}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{-196}:\\ \;\;\;\;c \cdot i + a \cdot b\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{-19}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \end{array} \]

Alternative 17: 42.9% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c i) < -2.4e86 or 8.0000000000000007e44 < (*.f64 c i)

    1. Initial program 91.9%

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

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

    if -2.4e86 < (*.f64 c i) < 8.0000000000000007e44

    1. Initial program 98.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -2.4 \cdot 10^{+86}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq 8 \cdot 10^{+44}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]

Alternative 18: 27.5% accurate, 5.0× speedup?

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

\\
a \cdot b
\end{array}
Derivation
  1. Initial program 96.1%

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

    \[\leadsto \color{blue}{a \cdot b} \]
  3. Final simplification24.4%

    \[\leadsto a \cdot b \]

Reproduce

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