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

Percentage Accurate: 95.3% → 97.7%
Time: 9.1s
Alternatives: 12
Speedup: 0.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 95.3% accurate, 1.0× speedup?

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

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

Alternative 1: 97.7% accurate, 0.0× speedup?

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

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

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

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

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

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

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

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

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

Alternative 2: 98.3% accurate, 0.4× 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}:\\ \;\;\;\;z \cdot \left(t + \left(x \cdot \frac{y}{z} + a \cdot \frac{b}{z}\right)\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 (* z (+ t (+ (* x (/ y z)) (* a (/ b z))))))))
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 = z * (t + ((x * (y / z)) + (a * (b / z))));
	}
	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 = z * (t + ((x * (y / z)) + (a * (b / z))));
	}
	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 = z * (t + ((x * (y / z)) + (a * (b / z))))
	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(z * Float64(t + Float64(Float64(x * Float64(y / z)) + Float64(a * Float64(b / z)))));
	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 = z * (t + ((x * (y / z)) + (a * (b / z))));
	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[(z * N[(t + N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] + N[(a * N[(b / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}:\\
\;\;\;\;z \cdot \left(t + \left(x \cdot \frac{y}{z} + a \cdot \frac{b}{z}\right)\right)\\


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

    1. Initial program 100.0%

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{z \cdot \left(t + \left(\frac{a \cdot b}{z} + \frac{x \cdot y}{z}\right)\right)} \]
    7. Step-by-step derivation
      1. +-commutative37.5%

        \[\leadsto z \cdot \left(t + \color{blue}{\left(\frac{x \cdot y}{z} + \frac{a \cdot b}{z}\right)}\right) \]
      2. associate-/l*56.3%

        \[\leadsto z \cdot \left(t + \left(\color{blue}{x \cdot \frac{y}{z}} + \frac{a \cdot b}{z}\right)\right) \]
      3. associate-/l*75.0%

        \[\leadsto z \cdot \left(t + \left(x \cdot \frac{y}{z} + \color{blue}{a \cdot \frac{b}{z}}\right)\right) \]
    8. Simplified75.0%

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

    \[\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}:\\ \;\;\;\;z \cdot \left(t + \left(x \cdot \frac{y}{z} + a \cdot \frac{b}{z}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 42.6% accurate, 0.5× speedup?

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 z t) < -7.99999999999999993e132 or 7e67 < (*.f64 z t)

    1. Initial program 90.4%

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

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

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

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

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

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

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

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

      \[\leadsto a \cdot b + \color{blue}{t \cdot z} \]
    7. Taylor expanded in a around 0 72.3%

      \[\leadsto \color{blue}{t \cdot z} \]
    8. Step-by-step derivation
      1. *-commutative72.3%

        \[\leadsto \color{blue}{z \cdot t} \]
    9. Simplified72.3%

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

    if -7.99999999999999993e132 < (*.f64 z t) < -1.0000000000000001e-133

    1. Initial program 94.9%

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

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

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

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

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

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

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

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

    if -1.0000000000000001e-133 < (*.f64 z t) < 1.5000000000000001e-119

    1. Initial program 95.8%

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

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

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

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

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

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

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

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

      \[\leadsto a \cdot b + \color{blue}{x \cdot y} \]
    7. Taylor expanded in a around 0 49.1%

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

    if 1.5000000000000001e-119 < (*.f64 z t) < 7e67

    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. +-commutative100.0%

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

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

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

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

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

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

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

Alternative 4: 87.8% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.18 \cdot 10^{+114} \lor \neg \left(c \cdot i \leq 2.3 \cdot 10^{+67}\right):\\
\;\;\;\;a \cdot b + \left(z \cdot t + c \cdot i\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c i) < -1.18000000000000005e114 or 2.2999999999999999e67 < (*.f64 c i)

    1. Initial program 87.4%

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

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

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

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

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

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

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

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

    if -1.18000000000000005e114 < (*.f64 c i) < 2.2999999999999999e67

    1. Initial program 97.5%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1.18 \cdot 10^{+114} \lor \neg \left(c \cdot i \leq 2.3 \cdot 10^{+67}\right):\\ \;\;\;\;a \cdot b + \left(z \cdot t + c \cdot i\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + \left(z \cdot t + x \cdot y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 84.9% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2.9 \cdot 10^{+114} \lor \neg \left(x \cdot y \leq 4.5 \cdot 10^{+156}\right):\\
\;\;\;\;z \cdot t + x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -2.9e114 or 4.50000000000000031e156 < (*.f64 x y)

    1. Initial program 90.9%

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

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

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

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

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

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

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

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

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

    if -2.9e114 < (*.f64 x y) < 4.50000000000000031e156

    1. Initial program 94.7%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2.9 \cdot 10^{+114} \lor \neg \left(x \cdot y \leq 4.5 \cdot 10^{+156}\right):\\ \;\;\;\;z \cdot t + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + \left(z \cdot t + c \cdot i\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 43.8% accurate, 0.6× speedup?

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

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

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

\mathbf{elif}\;c \cdot i \leq 5 \cdot 10^{+70}:\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 c i) < -1.4e115 or 5.0000000000000002e70 < (*.f64 c i)

    1. Initial program 87.4%

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

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

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

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

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

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

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

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

    if -1.4e115 < (*.f64 c i) < -1.74999999999999992e-7

    1. Initial program 96.3%

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

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

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

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

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

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

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

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

    if -1.74999999999999992e-7 < (*.f64 c i) < 5.0000000000000002e70

    1. Initial program 97.7%

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

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

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

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

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

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

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

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

      \[\leadsto a \cdot b + \color{blue}{x \cdot y} \]
    7. Taylor expanded in a around 0 34.4%

      \[\leadsto \color{blue}{x \cdot y} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 7: 64.7% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+40}:\\
\;\;\;\;z \cdot t + c \cdot i\\

\mathbf{elif}\;z \cdot t \leq 10^{+52}:\\
\;\;\;\;x \cdot y + a \cdot b\\

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


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

    1. Initial program 93.0%

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

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

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

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

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

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

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

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

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

    if -5.00000000000000003e40 < (*.f64 z t) < 9.9999999999999999e51

    1. Initial program 95.3%

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

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

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

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

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

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

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

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

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

    if 9.9999999999999999e51 < (*.f64 z t)

    1. Initial program 91.2%

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

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

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

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

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

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

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

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

      \[\leadsto a \cdot b + \color{blue}{t \cdot z} \]
    7. Taylor expanded in z around inf 77.9%

      \[\leadsto \color{blue}{z \cdot \left(t + \frac{a \cdot b}{z}\right)} \]
    8. Step-by-step derivation
      1. +-commutative77.9%

        \[\leadsto z \cdot \color{blue}{\left(\frac{a \cdot b}{z} + t\right)} \]
      2. associate-/l*83.3%

        \[\leadsto z \cdot \left(\color{blue}{a \cdot \frac{b}{z}} + t\right) \]
    9. Simplified83.3%

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

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

Alternative 8: 64.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+40} \lor \neg \left(z \cdot t \leq 5 \cdot 10^{+52}\right):\\
\;\;\;\;z \cdot t + c \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -5.00000000000000003e40 or 5e52 < (*.f64 z t)

    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. +-commutative92.2%

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

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

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

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

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

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

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

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

    if -5.00000000000000003e40 < (*.f64 z t) < 5e52

    1. Initial program 95.3%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+40} \lor \neg \left(z \cdot t \leq 5 \cdot 10^{+52}\right):\\ \;\;\;\;z \cdot t + c \cdot i\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 65.0% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+115} \lor \neg \left(z \cdot t \leq 10^{+52}\right):\\
\;\;\;\;z \cdot t + a \cdot b\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -1e115 or 9.9999999999999999e51 < (*.f64 z t)

    1. Initial program 91.1%

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

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

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

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

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

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

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

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

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

    if -1e115 < (*.f64 z t) < 9.9999999999999999e51

    1. Initial program 95.8%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+115} \lor \neg \left(z \cdot t \leq 10^{+52}\right):\\ \;\;\;\;z \cdot t + a \cdot b\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 61.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1.35 \cdot 10^{+248} \lor \neg \left(c \cdot i \leq 4.8 \cdot 10^{+228}\right):\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;z \cdot t + a \cdot b\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (or (<= (* c i) -1.35e+248) (not (<= (* c i) 4.8e+228)))
   (* c i)
   (+ (* z t) (* a b))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (((c * i) <= -1.35e+248) || !((c * i) <= 4.8e+228)) {
		tmp = c * i;
	} else {
		tmp = (z * t) + (a * b);
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: tmp
    if (((c * i) <= (-1.35d+248)) .or. (.not. ((c * i) <= 4.8d+228))) then
        tmp = c * i
    else
        tmp = (z * t) + (a * b)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (((c * i) <= -1.35e+248) || !((c * i) <= 4.8e+228)) {
		tmp = c * i;
	} else {
		tmp = (z * t) + (a * b);
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if ((c * i) <= -1.35e+248) or not ((c * i) <= 4.8e+228):
		tmp = c * i
	else:
		tmp = (z * t) + (a * b)
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if ((Float64(c * i) <= -1.35e+248) || !(Float64(c * i) <= 4.8e+228))
		tmp = Float64(c * i);
	else
		tmp = Float64(Float64(z * t) + Float64(a * b));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if (((c * i) <= -1.35e+248) || ~(((c * i) <= 4.8e+228)))
		tmp = c * i;
	else
		tmp = (z * t) + (a * b);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(c * i), $MachinePrecision], -1.35e+248], N[Not[LessEqual[N[(c * i), $MachinePrecision], 4.8e+228]], $MachinePrecision]], N[(c * i), $MachinePrecision], N[(N[(z * t), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.35 \cdot 10^{+248} \lor \neg \left(c \cdot i \leq 4.8 \cdot 10^{+228}\right):\\
\;\;\;\;c \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c i) < -1.34999999999999994e248 or 4.79999999999999977e228 < (*.f64 c i)

    1. Initial program 79.2%

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

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

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

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

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

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

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

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

    if -1.34999999999999994e248 < (*.f64 c i) < 4.79999999999999977e228

    1. Initial program 97.5%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1.35 \cdot 10^{+248} \lor \neg \left(c \cdot i \leq 4.8 \cdot 10^{+228}\right):\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;z \cdot t + a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 43.1% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -2.5 \cdot 10^{+115} \lor \neg \left(c \cdot i \leq 1.3 \cdot 10^{+62}\right):\\
\;\;\;\;c \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c i) < -2.50000000000000004e115 or 1.29999999999999992e62 < (*.f64 c i)

    1. Initial program 87.5%

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

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

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

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

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

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

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

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

    if -2.50000000000000004e115 < (*.f64 c i) < 1.29999999999999992e62

    1. Initial program 97.5%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -2.5 \cdot 10^{+115} \lor \neg \left(c \cdot i \leq 1.3 \cdot 10^{+62}\right):\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 26.9% accurate, 5.0× speedup?

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

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

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

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

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

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

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

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

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

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

Reproduce

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