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

Percentage Accurate: 95.8% → 97.7%
Time: 10.0s
Alternatives: 20
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 20 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} \mathbf{if}\;a \cdot b + \left(z \cdot t + x \cdot y\right) \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(c, i, z \cdot t + \left(a \cdot b + x \cdot y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, a, c \cdot i\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= (+ (* a b) (+ (* z t) (* x y))) INFINITY)
   (fma c i (+ (* z t) (+ (* a b) (* x y))))
   (fma b a (* c i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (((a * b) + ((z * t) + (x * y))) <= ((double) INFINITY)) {
		tmp = fma(c, i, ((z * t) + ((a * b) + (x * y))));
	} else {
		tmp = fma(b, a, (c * i));
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (Float64(Float64(a * b) + Float64(Float64(z * t) + Float64(x * y))) <= Inf)
		tmp = fma(c, i, Float64(Float64(z * t) + Float64(Float64(a * b) + Float64(x * y))));
	else
		tmp = fma(b, a, Float64(c * i));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(N[(a * b), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(c * i + N[(N[(z * t), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b * a + N[(c * i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 98.8%

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

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

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

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

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

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

      \[\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. Step-by-step derivation
      1. fma-udef99.6%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b} + c \cdot i \]
    3. Step-by-step derivation
      1. *-commutative62.6%

        \[\leadsto \color{blue}{b \cdot a} + c \cdot i \]
      2. fma-def75.1%

        \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i\right)} \]
    4. Applied egg-rr75.1%

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

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

Alternative 2: 98.0% 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 95.7%

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

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

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

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

      \[\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: 98.1% 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 95.7%

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

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

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

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

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

      \[\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.4%

    \[\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.4%

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, a, c \cdot i\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. 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-def100.0%

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

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

        \[\leadsto \mathsf{fma}\left(c, i, \color{blue}{\mathsf{fma}\left(x, y, z \cdot t + a \cdot b\right)}\right) \]
      5. fma-def100.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. Simplified100.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. Step-by-step derivation
      1. fma-udef100.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b} + c \cdot i \]
    3. Step-by-step derivation
      1. *-commutative45.5%

        \[\leadsto \color{blue}{b \cdot a} + c \cdot i \]
      2. fma-def63.7%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i\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:\\ \;\;\;\;z \cdot t + \left(\mathsf{fma}\left(a, b, c \cdot i\right) + x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, a, c \cdot i\right)\\ \end{array} \]

Alternative 5: 97.8% 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(a, b, 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 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 = fma(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 = fma(a, b, Float64(z * t));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(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[(a * b + 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(a, b, 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 36.4%

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, b, t \cdot z\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}:\\ \;\;\;\;\mathsf{fma}\left(a, b, z \cdot t\right)\\ \end{array} \]

Alternative 6: 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, c \cdot i\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 (* c i)))))
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, (c * i));
	}
	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(c * i));
	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[(c * i), $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, c \cdot i\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 a around inf 45.5%

      \[\leadsto \color{blue}{a \cdot b} + c \cdot i \]
    3. Step-by-step derivation
      1. *-commutative45.5%

        \[\leadsto \color{blue}{b \cdot a} + c \cdot i \]
      2. fma-def63.7%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, c \cdot i\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}:\\ \;\;\;\;\mathsf{fma}\left(b, a, c \cdot i\right)\\ \end{array} \]

Alternative 7: 97.0% 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\\ \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))))
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;
	}
	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;
	}
	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
	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(a * b);
	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;
	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[(a * b), $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\\


\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. 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-def18.2%

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

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

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

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

      \[\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. Step-by-step derivation
      1. fma-udef45.5%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b} + z \cdot t \]
    7. Step-by-step derivation
      1. *-commutative54.5%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, z \cdot t\right)} \]
    9. Taylor expanded in b around inf 54.8%

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

    \[\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\\ \end{array} \]

Alternative 8: 43.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.2 \cdot 10^{+99}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -0.00095:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq -3.6 \cdot 10^{-214}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 4.6 \cdot 10^{-306}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 25:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 3.9 \cdot 10^{+136}:\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= (* a b) -1.2e+99)
   (* a b)
   (if (<= (* a b) -0.00095)
     (* x y)
     (if (<= (* a b) -3.6e-214)
       (* c i)
       (if (<= (* a b) 4.6e-306)
         (* x y)
         (if (<= (* a b) 25.0)
           (* z t)
           (if (<= (* a b) 3.9e+136) (* c i) (* a b))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((a * b) <= -1.2e+99) {
		tmp = a * b;
	} else if ((a * b) <= -0.00095) {
		tmp = x * y;
	} else if ((a * b) <= -3.6e-214) {
		tmp = c * i;
	} else if ((a * b) <= 4.6e-306) {
		tmp = x * y;
	} else if ((a * b) <= 25.0) {
		tmp = z * t;
	} else if ((a * b) <= 3.9e+136) {
		tmp = c * i;
	} else {
		tmp = a * b;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: tmp
    if ((a * b) <= (-1.2d+99)) then
        tmp = a * b
    else if ((a * b) <= (-0.00095d0)) then
        tmp = x * y
    else if ((a * b) <= (-3.6d-214)) then
        tmp = c * i
    else if ((a * b) <= 4.6d-306) then
        tmp = x * y
    else if ((a * b) <= 25.0d0) then
        tmp = z * t
    else if ((a * b) <= 3.9d+136) then
        tmp = c * i
    else
        tmp = a * b
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((a * b) <= -1.2e+99) {
		tmp = a * b;
	} else if ((a * b) <= -0.00095) {
		tmp = x * y;
	} else if ((a * b) <= -3.6e-214) {
		tmp = c * i;
	} else if ((a * b) <= 4.6e-306) {
		tmp = x * y;
	} else if ((a * b) <= 25.0) {
		tmp = z * t;
	} else if ((a * b) <= 3.9e+136) {
		tmp = c * i;
	} else {
		tmp = a * b;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (a * b) <= -1.2e+99:
		tmp = a * b
	elif (a * b) <= -0.00095:
		tmp = x * y
	elif (a * b) <= -3.6e-214:
		tmp = c * i
	elif (a * b) <= 4.6e-306:
		tmp = x * y
	elif (a * b) <= 25.0:
		tmp = z * t
	elif (a * b) <= 3.9e+136:
		tmp = c * i
	else:
		tmp = a * b
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (Float64(a * b) <= -1.2e+99)
		tmp = Float64(a * b);
	elseif (Float64(a * b) <= -0.00095)
		tmp = Float64(x * y);
	elseif (Float64(a * b) <= -3.6e-214)
		tmp = Float64(c * i);
	elseif (Float64(a * b) <= 4.6e-306)
		tmp = Float64(x * y);
	elseif (Float64(a * b) <= 25.0)
		tmp = Float64(z * t);
	elseif (Float64(a * b) <= 3.9e+136)
		tmp = Float64(c * i);
	else
		tmp = Float64(a * b);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if ((a * b) <= -1.2e+99)
		tmp = a * b;
	elseif ((a * b) <= -0.00095)
		tmp = x * y;
	elseif ((a * b) <= -3.6e-214)
		tmp = c * i;
	elseif ((a * b) <= 4.6e-306)
		tmp = x * y;
	elseif ((a * b) <= 25.0)
		tmp = z * t;
	elseif ((a * b) <= 3.9e+136)
		tmp = c * i;
	else
		tmp = a * b;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -1.2e+99], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -0.00095], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -3.6e-214], N[(c * i), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 4.6e-306], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 25.0], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 3.9e+136], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;a \cdot b \leq -0.00095:\\
\;\;\;\;x \cdot y\\

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

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

\mathbf{elif}\;a \cdot b \leq 25:\\
\;\;\;\;z \cdot t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 a b) < -1.2000000000000001e99 or 3.90000000000000019e136 < (*.f64 a b)

    1. Initial program 91.4%

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

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

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

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

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

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

      \[\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. Step-by-step derivation
      1. fma-udef96.2%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b} + z \cdot t \]
    7. Step-by-step derivation
      1. *-commutative80.3%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, z \cdot t\right)} \]
    9. Taylor expanded in b around inf 70.1%

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

    if -1.2000000000000001e99 < (*.f64 a b) < -9.49999999999999998e-4 or -3.6e-214 < (*.f64 a b) < 4.59999999999999978e-306

    1. Initial program 98.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+98.2%

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

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

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

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

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

      \[\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 92.8%

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

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

    if -9.49999999999999998e-4 < (*.f64 a b) < -3.6e-214 or 25 < (*.f64 a b) < 3.90000000000000019e136

    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 c around inf 45.0%

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

    if 4.59999999999999978e-306 < (*.f64 a b) < 25

    1. Initial program 97.3%

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

        \[\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.3%

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

        \[\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. Simplified97.3%

      \[\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. Step-by-step derivation
      1. fma-udef97.3%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.2 \cdot 10^{+99}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -0.00095:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq -3.6 \cdot 10^{-214}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 4.6 \cdot 10^{-306}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 25:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 3.9 \cdot 10^{+136}:\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]

Alternative 9: 59.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot b + z \cdot t\\ t_2 := c \cdot i + a \cdot b\\ t_3 := a \cdot b + x \cdot y\\ \mathbf{if}\;i \leq -2.2 \cdot 10^{-81}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;i \leq -2.4 \cdot 10^{-168}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \leq 1.3 \cdot 10^{-252}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;i \leq 1.35 \cdot 10^{-188}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \leq 10^{-101}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;i \leq 1.25 \cdot 10^{+94}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \leq 1.45 \cdot 10^{+184}:\\ \;\;\;\;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) (* z t)))
        (t_2 (+ (* c i) (* a b)))
        (t_3 (+ (* a b) (* x y))))
   (if (<= i -2.2e-81)
     t_2
     (if (<= i -2.4e-168)
       t_1
       (if (<= i 1.3e-252)
         t_3
         (if (<= i 1.35e-188)
           t_1
           (if (<= i 1e-101)
             t_3
             (if (<= i 1.25e+94) t_1 (if (<= i 1.45e+184) 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) + (z * t);
	double t_2 = (c * i) + (a * b);
	double t_3 = (a * b) + (x * y);
	double tmp;
	if (i <= -2.2e-81) {
		tmp = t_2;
	} else if (i <= -2.4e-168) {
		tmp = t_1;
	} else if (i <= 1.3e-252) {
		tmp = t_3;
	} else if (i <= 1.35e-188) {
		tmp = t_1;
	} else if (i <= 1e-101) {
		tmp = t_3;
	} else if (i <= 1.25e+94) {
		tmp = t_1;
	} else if (i <= 1.45e+184) {
		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) + (z * t)
    t_2 = (c * i) + (a * b)
    t_3 = (a * b) + (x * y)
    if (i <= (-2.2d-81)) then
        tmp = t_2
    else if (i <= (-2.4d-168)) then
        tmp = t_1
    else if (i <= 1.3d-252) then
        tmp = t_3
    else if (i <= 1.35d-188) then
        tmp = t_1
    else if (i <= 1d-101) then
        tmp = t_3
    else if (i <= 1.25d+94) then
        tmp = t_1
    else if (i <= 1.45d+184) 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) + (z * t);
	double t_2 = (c * i) + (a * b);
	double t_3 = (a * b) + (x * y);
	double tmp;
	if (i <= -2.2e-81) {
		tmp = t_2;
	} else if (i <= -2.4e-168) {
		tmp = t_1;
	} else if (i <= 1.3e-252) {
		tmp = t_3;
	} else if (i <= 1.35e-188) {
		tmp = t_1;
	} else if (i <= 1e-101) {
		tmp = t_3;
	} else if (i <= 1.25e+94) {
		tmp = t_1;
	} else if (i <= 1.45e+184) {
		tmp = t_3;
	} 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) + (a * b)
	t_3 = (a * b) + (x * y)
	tmp = 0
	if i <= -2.2e-81:
		tmp = t_2
	elif i <= -2.4e-168:
		tmp = t_1
	elif i <= 1.3e-252:
		tmp = t_3
	elif i <= 1.35e-188:
		tmp = t_1
	elif i <= 1e-101:
		tmp = t_3
	elif i <= 1.25e+94:
		tmp = t_1
	elif i <= 1.45e+184:
		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(z * t))
	t_2 = Float64(Float64(c * i) + Float64(a * b))
	t_3 = Float64(Float64(a * b) + Float64(x * y))
	tmp = 0.0
	if (i <= -2.2e-81)
		tmp = t_2;
	elseif (i <= -2.4e-168)
		tmp = t_1;
	elseif (i <= 1.3e-252)
		tmp = t_3;
	elseif (i <= 1.35e-188)
		tmp = t_1;
	elseif (i <= 1e-101)
		tmp = t_3;
	elseif (i <= 1.25e+94)
		tmp = t_1;
	elseif (i <= 1.45e+184)
		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) + (z * t);
	t_2 = (c * i) + (a * b);
	t_3 = (a * b) + (x * y);
	tmp = 0.0;
	if (i <= -2.2e-81)
		tmp = t_2;
	elseif (i <= -2.4e-168)
		tmp = t_1;
	elseif (i <= 1.3e-252)
		tmp = t_3;
	elseif (i <= 1.35e-188)
		tmp = t_1;
	elseif (i <= 1e-101)
		tmp = t_3;
	elseif (i <= 1.25e+94)
		tmp = t_1;
	elseif (i <= 1.45e+184)
		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[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c * i), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -2.2e-81], t$95$2, If[LessEqual[i, -2.4e-168], t$95$1, If[LessEqual[i, 1.3e-252], t$95$3, If[LessEqual[i, 1.35e-188], t$95$1, If[LessEqual[i, 1e-101], t$95$3, If[LessEqual[i, 1.25e+94], t$95$1, If[LessEqual[i, 1.45e+184], t$95$3, t$95$2]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;i \leq -2.4 \cdot 10^{-168}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;i \leq 1.3 \cdot 10^{-252}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;i \leq 1.35 \cdot 10^{-188}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;i \leq 10^{-101}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;i \leq 1.25 \cdot 10^{+94}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;i \leq 1.45 \cdot 10^{+184}:\\
\;\;\;\;t_3\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if i < -2.1999999999999999e-81 or 1.4499999999999999e184 < i

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

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

    if -2.1999999999999999e-81 < i < -2.3999999999999999e-168 or 1.3e-252 < i < 1.35e-188 or 1.00000000000000005e-101 < i < 1.25000000000000003e94

    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-def100.0%

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

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

        \[\leadsto \mathsf{fma}\left(c, i, \color{blue}{\mathsf{fma}\left(x, y, z \cdot t + a \cdot b\right)}\right) \]
      5. fma-def100.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. Simplified100.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. Step-by-step derivation
      1. fma-udef100.0%

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

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

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

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

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

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

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

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

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

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

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

    if -2.3999999999999999e-168 < i < 1.3e-252 or 1.35e-188 < i < 1.00000000000000005e-101 or 1.25000000000000003e94 < i < 1.4499999999999999e184

    1. Initial program 96.5%

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

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

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

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

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

        \[\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.8%

      \[\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. Step-by-step derivation
      1. fma-udef97.6%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -2.2 \cdot 10^{-81}:\\ \;\;\;\;c \cdot i + a \cdot b\\ \mathbf{elif}\;i \leq -2.4 \cdot 10^{-168}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;i \leq 1.3 \cdot 10^{-252}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;i \leq 1.35 \cdot 10^{-188}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;i \leq 10^{-101}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;i \leq 1.25 \cdot 10^{+94}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;i \leq 1.45 \cdot 10^{+184}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c \cdot i + a \cdot b\\ \end{array} \]

Alternative 10: 43.2% accurate, 0.8× speedup?

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

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

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

\mathbf{elif}\;a \cdot b \leq 0.000315:\\
\;\;\;\;z \cdot t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -2.5e19 or 8.20000000000000008e133 < (*.f64 a b)

    1. Initial program 92.3%

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

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

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

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

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

        \[\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.3%

      \[\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. Step-by-step derivation
      1. fma-udef96.5%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b} + z \cdot t \]
    7. Step-by-step derivation
      1. *-commutative77.3%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, z \cdot t\right)} \]
    9. Taylor expanded in b around inf 65.6%

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

    if -2.5e19 < (*.f64 a b) < -1.11999999999999993e-185 or 3.15000000000000013e-4 < (*.f64 a b) < 8.20000000000000008e133

    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 c around inf 45.6%

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

    if -1.11999999999999993e-185 < (*.f64 a b) < 3.15000000000000013e-4

    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-def97.5%

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

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

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

        \[\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. Simplified97.5%

      \[\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. Step-by-step derivation
      1. fma-udef97.5%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -2.5 \cdot 10^{+19}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -1.12 \cdot 10^{-185}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 0.000315:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 8.2 \cdot 10^{+133}:\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]

Alternative 11: 75.7% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot t + x \cdot y\\ t_2 := c \cdot i + \left(a \cdot b + z \cdot t\right)\\ t_3 := a \cdot b + x \cdot y\\ \mathbf{if}\;y \leq -9.2 \cdot 10^{-57}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;y \leq 7.2 \cdot 10^{+149}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{+173}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 6.2 \cdot 10^{+212}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 6.2 \cdot 10^{+237}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* z t) (* x y)))
        (t_2 (+ (* c i) (+ (* a b) (* z t))))
        (t_3 (+ (* a b) (* x y))))
   (if (<= y -9.2e-57)
     t_3
     (if (<= y 7.2e+149)
       t_2
       (if (<= y 1.15e+173)
         t_1
         (if (<= y 6.2e+212) t_2 (if (<= y 6.2e+237) t_1 t_3)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (z * t) + (x * y);
	double t_2 = (c * i) + ((a * b) + (z * t));
	double t_3 = (a * b) + (x * y);
	double tmp;
	if (y <= -9.2e-57) {
		tmp = t_3;
	} else if (y <= 7.2e+149) {
		tmp = t_2;
	} else if (y <= 1.15e+173) {
		tmp = t_1;
	} else if (y <= 6.2e+212) {
		tmp = t_2;
	} else if (y <= 6.2e+237) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	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 = (z * t) + (x * y)
    t_2 = (c * i) + ((a * b) + (z * t))
    t_3 = (a * b) + (x * y)
    if (y <= (-9.2d-57)) then
        tmp = t_3
    else if (y <= 7.2d+149) then
        tmp = t_2
    else if (y <= 1.15d+173) then
        tmp = t_1
    else if (y <= 6.2d+212) then
        tmp = t_2
    else if (y <= 6.2d+237) then
        tmp = t_1
    else
        tmp = t_3
    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 = (z * t) + (x * y);
	double t_2 = (c * i) + ((a * b) + (z * t));
	double t_3 = (a * b) + (x * y);
	double tmp;
	if (y <= -9.2e-57) {
		tmp = t_3;
	} else if (y <= 7.2e+149) {
		tmp = t_2;
	} else if (y <= 1.15e+173) {
		tmp = t_1;
	} else if (y <= 6.2e+212) {
		tmp = t_2;
	} else if (y <= 6.2e+237) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (z * t) + (x * y)
	t_2 = (c * i) + ((a * b) + (z * t))
	t_3 = (a * b) + (x * y)
	tmp = 0
	if y <= -9.2e-57:
		tmp = t_3
	elif y <= 7.2e+149:
		tmp = t_2
	elif y <= 1.15e+173:
		tmp = t_1
	elif y <= 6.2e+212:
		tmp = t_2
	elif y <= 6.2e+237:
		tmp = t_1
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(z * t) + Float64(x * y))
	t_2 = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(z * t)))
	t_3 = Float64(Float64(a * b) + Float64(x * y))
	tmp = 0.0
	if (y <= -9.2e-57)
		tmp = t_3;
	elseif (y <= 7.2e+149)
		tmp = t_2;
	elseif (y <= 1.15e+173)
		tmp = t_1;
	elseif (y <= 6.2e+212)
		tmp = t_2;
	elseif (y <= 6.2e+237)
		tmp = t_1;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (z * t) + (x * y);
	t_2 = (c * i) + ((a * b) + (z * t));
	t_3 = (a * b) + (x * y);
	tmp = 0.0;
	if (y <= -9.2e-57)
		tmp = t_3;
	elseif (y <= 7.2e+149)
		tmp = t_2;
	elseif (y <= 1.15e+173)
		tmp = t_1;
	elseif (y <= 6.2e+212)
		tmp = t_2;
	elseif (y <= 6.2e+237)
		tmp = t_1;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.2e-57], t$95$3, If[LessEqual[y, 7.2e+149], t$95$2, If[LessEqual[y, 1.15e+173], t$95$1, If[LessEqual[y, 6.2e+212], t$95$2, If[LessEqual[y, 6.2e+237], t$95$1, t$95$3]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := z \cdot t + x \cdot y\\
t_2 := c \cdot i + \left(a \cdot b + z \cdot t\right)\\
t_3 := a \cdot b + x \cdot y\\
\mathbf{if}\;y \leq -9.2 \cdot 10^{-57}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;y \leq 7.2 \cdot 10^{+149}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;y \leq 1.15 \cdot 10^{+173}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 6.2 \cdot 10^{+212}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;y \leq 6.2 \cdot 10^{+237}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -9.2000000000000001e-57 or 6.19999999999999981e237 < y

    1. Initial program 92.5%

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

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

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

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

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

        \[\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. Simplified96.8%

      \[\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. Step-by-step derivation
      1. fma-udef96.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.2000000000000001e-57 < y < 7.1999999999999999e149 or 1.14999999999999997e173 < y < 6.19999999999999996e212

    1. Initial program 97.4%

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

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

    if 7.1999999999999999e149 < y < 1.14999999999999997e173 or 6.19999999999999996e212 < y < 6.19999999999999981e237

    1. Initial program 99.8%

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

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

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

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

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

        \[\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. Simplified99.8%

      \[\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. Step-by-step derivation
      1. fma-udef99.8%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9.2 \cdot 10^{-57}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;y \leq 7.2 \cdot 10^{+149}:\\ \;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{+173}:\\ \;\;\;\;z \cdot t + x \cdot y\\ \mathbf{elif}\;y \leq 6.2 \cdot 10^{+212}:\\ \;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\ \mathbf{elif}\;y \leq 6.2 \cdot 10^{+237}:\\ \;\;\;\;z \cdot t + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \end{array} \]

Alternative 12: 66.4% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5.2 \cdot 10^{+31}:\\
\;\;\;\;a \cdot b + x \cdot y\\

\mathbf{elif}\;a \cdot b \leq 1.5 \cdot 10^{-305}:\\
\;\;\;\;c \cdot i + x \cdot y\\

\mathbf{elif}\;a \cdot b \leq 2.8 \cdot 10^{+127}:\\
\;\;\;\;c \cdot i + z \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 a b) < -5.2e31

    1. Initial program 93.4%

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

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

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

        \[\leadsto \mathsf{fma}\left(c, i, \color{blue}{x \cdot y + \left(z \cdot t + a \cdot b\right)}\right) \]
      4. fma-def98.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.6%

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

      \[\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. Step-by-step derivation
      1. fma-udef97.3%

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.2e31 < (*.f64 a b) < 1.5000000000000001e-305

    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 inf 70.3%

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

    if 1.5000000000000001e-305 < (*.f64 a b) < 2.8000000000000002e127

    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 68.9%

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

    if 2.8000000000000002e127 < (*.f64 a b)

    1. Initial program 89.7%

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

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

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

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

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

        \[\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. Simplified97.4%

      \[\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. Step-by-step derivation
      1. fma-udef94.8%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -5.2 \cdot 10^{+31}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 1.5 \cdot 10^{-305}:\\ \;\;\;\;c \cdot i + x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 2.8 \cdot 10^{+127}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \end{array} \]

Alternative 13: 87.8% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+46} \lor \neg \left(z \cdot t \leq 10^{+177}\right):\\ \;\;\;\;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 (or (<= (* z t) -2e+46) (not (<= (* z t) 1e+177)))
   (+ (* 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 (((z * t) <= -2e+46) || !((z * t) <= 1e+177)) {
		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 (((z * t) <= (-2d+46)) .or. (.not. ((z * t) <= 1d+177))) 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 (((z * t) <= -2e+46) || !((z * t) <= 1e+177)) {
		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 ((z * t) <= -2e+46) or not ((z * t) <= 1e+177):
		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 ((Float64(z * t) <= -2e+46) || !(Float64(z * t) <= 1e+177))
		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 (((z * t) <= -2e+46) || ~(((z * t) <= 1e+177)))
		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[Or[LessEqual[N[(z * t), $MachinePrecision], -2e+46], N[Not[LessEqual[N[(z * t), $MachinePrecision], 1e+177]], $MachinePrecision]], 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}\;z \cdot t \leq -2 \cdot 10^{+46} \lor \neg \left(z \cdot t \leq 10^{+177}\right):\\
\;\;\;\;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 2 regimes
  2. if (*.f64 z t) < -2e46 or 1e177 < (*.f64 z t)

    1. Initial program 90.7%

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

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

    if -2e46 < (*.f64 z t) < 1e177

    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 0 89.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+46} \lor \neg \left(z \cdot t \leq 10^{+177}\right):\\ \;\;\;\;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 14: 88.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot b + x \cdot y\\ \mathbf{if}\;c \cdot i \leq -4.2 \cdot 10^{+35}:\\ \;\;\;\;c \cdot i + t_1\\ \mathbf{elif}\;c \cdot i \leq 1.25 \cdot 10^{+78}:\\ \;\;\;\;z \cdot t + t_1\\ \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
 (let* ((t_1 (+ (* a b) (* x y))))
   (if (<= (* c i) -4.2e+35)
     (+ (* c i) t_1)
     (if (<= (* c i) 1.25e+78)
       (+ (* z t) t_1)
       (+ (* 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 t_1 = (a * b) + (x * y);
	double tmp;
	if ((c * i) <= -4.2e+35) {
		tmp = (c * i) + t_1;
	} else if ((c * i) <= 1.25e+78) {
		tmp = (z * t) + t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_1 = (a * b) + (x * y)
    if ((c * i) <= (-4.2d+35)) then
        tmp = (c * i) + t_1
    else if ((c * i) <= 1.25d+78) then
        tmp = (z * t) + t_1
    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 t_1 = (a * b) + (x * y);
	double tmp;
	if ((c * i) <= -4.2e+35) {
		tmp = (c * i) + t_1;
	} else if ((c * i) <= 1.25e+78) {
		tmp = (z * t) + t_1;
	} else {
		tmp = (c * i) + ((a * b) + (z * t));
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (a * b) + (x * y)
	tmp = 0
	if (c * i) <= -4.2e+35:
		tmp = (c * i) + t_1
	elif (c * i) <= 1.25e+78:
		tmp = (z * t) + t_1
	else:
		tmp = (c * i) + ((a * b) + (z * t))
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(a * b) + Float64(x * y))
	tmp = 0.0
	if (Float64(c * i) <= -4.2e+35)
		tmp = Float64(Float64(c * i) + t_1);
	elseif (Float64(c * i) <= 1.25e+78)
		tmp = Float64(Float64(z * t) + t_1);
	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)
	t_1 = (a * b) + (x * y);
	tmp = 0.0;
	if ((c * i) <= -4.2e+35)
		tmp = (c * i) + t_1;
	elseif ((c * i) <= 1.25e+78)
		tmp = (z * t) + t_1;
	else
		tmp = (c * i) + ((a * b) + (z * t));
	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]}, If[LessEqual[N[(c * i), $MachinePrecision], -4.2e+35], N[(N[(c * i), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 1.25e+78], N[(N[(z * t), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := a \cdot b + x \cdot y\\
\mathbf{if}\;c \cdot i \leq -4.2 \cdot 10^{+35}:\\
\;\;\;\;c \cdot i + t_1\\

\mathbf{elif}\;c \cdot i \leq 1.25 \cdot 10^{+78}:\\
\;\;\;\;z \cdot t + t_1\\

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


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

    1. Initial program 94.4%

      \[\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 \]

    if -4.1999999999999998e35 < (*.f64 c i) < 1.24999999999999996e78

    1. Initial program 98.7%

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

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

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

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

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

        \[\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. Simplified99.3%

      \[\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. Step-by-step derivation
      1. fma-udef99.3%

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

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

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

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

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

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

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

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

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

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

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

    if 1.24999999999999996e78 < (*.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. Taylor expanded in x around 0 85.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -4.2 \cdot 10^{+35}:\\ \;\;\;\;c \cdot i + \left(a \cdot b + x \cdot y\right)\\ \mathbf{elif}\;c \cdot i \leq 1.25 \cdot 10^{+78}:\\ \;\;\;\;z \cdot t + \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: 88.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.25 \cdot 10^{+36}:\\ \;\;\;\;z \cdot t + \left(a \cdot b + x \cdot y\right)\\ \mathbf{elif}\;a \cdot b \leq 4.5 \cdot 10^{+95}:\\ \;\;\;\;c \cdot i + \left(z \cdot t + 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 (<= (* a b) -1.25e+36)
   (+ (* z t) (+ (* a b) (* x y)))
   (if (<= (* a b) 4.5e+95)
     (+ (* c i) (+ (* z t) (* 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 ((a * b) <= -1.25e+36) {
		tmp = (z * t) + ((a * b) + (x * y));
	} else if ((a * b) <= 4.5e+95) {
		tmp = (c * i) + ((z * t) + (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 ((a * b) <= (-1.25d+36)) then
        tmp = (z * t) + ((a * b) + (x * y))
    else if ((a * b) <= 4.5d+95) then
        tmp = (c * i) + ((z * t) + (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 ((a * b) <= -1.25e+36) {
		tmp = (z * t) + ((a * b) + (x * y));
	} else if ((a * b) <= 4.5e+95) {
		tmp = (c * i) + ((z * t) + (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 (a * b) <= -1.25e+36:
		tmp = (z * t) + ((a * b) + (x * y))
	elif (a * b) <= 4.5e+95:
		tmp = (c * i) + ((z * t) + (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 (Float64(a * b) <= -1.25e+36)
		tmp = Float64(Float64(z * t) + Float64(Float64(a * b) + Float64(x * y)));
	elseif (Float64(a * b) <= 4.5e+95)
		tmp = Float64(Float64(c * i) + Float64(Float64(z * t) + 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 ((a * b) <= -1.25e+36)
		tmp = (z * t) + ((a * b) + (x * y));
	elseif ((a * b) <= 4.5e+95)
		tmp = (c * i) + ((z * t) + (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[LessEqual[N[(a * b), $MachinePrecision], -1.25e+36], N[(N[(z * t), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 4.5e+95], N[(N[(c * i), $MachinePrecision] + N[(N[(z * t), $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}\;a \cdot b \leq -1.25 \cdot 10^{+36}:\\
\;\;\;\;z \cdot t + \left(a \cdot b + x \cdot y\right)\\

\mathbf{elif}\;a \cdot b \leq 4.5 \cdot 10^{+95}:\\
\;\;\;\;c \cdot i + \left(z \cdot t + 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 3 regimes
  2. if (*.f64 a b) < -1.24999999999999994e36

    1. Initial program 93.4%

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

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

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

        \[\leadsto \mathsf{fma}\left(c, i, \color{blue}{x \cdot y + \left(z \cdot t + a \cdot b\right)}\right) \]
      4. fma-def98.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.6%

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

      \[\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. Step-by-step derivation
      1. fma-udef97.3%

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

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

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

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

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

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

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

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

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

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

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

    if -1.24999999999999994e36 < (*.f64 a b) < 4.50000000000000017e95

    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 a around 0 96.0%

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

    if 4.50000000000000017e95 < (*.f64 a b)

    1. Initial program 90.7%

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

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

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

Alternative 16: 54.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -600000000:\\
\;\;\;\;z \cdot t\\

\mathbf{elif}\;t \leq 3.15 \cdot 10^{+103} \lor \neg \left(t \leq 3.1 \cdot 10^{+133}\right) \land t \leq 5.2 \cdot 10^{+169}:\\
\;\;\;\;c \cdot i + a \cdot b\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -6e8 or 3.14999999999999985e103 < t < 3.1e133 or 5.19999999999999999e169 < t

    1. Initial program 92.7%

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

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

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

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

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

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

      \[\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. Step-by-step derivation
      1. fma-udef95.4%

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

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

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

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

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

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

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

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

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

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

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

    if -6e8 < t < 3.14999999999999985e103 or 3.1e133 < t < 5.19999999999999999e169

    1. Initial program 97.9%

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

      \[\leadsto \color{blue}{a \cdot b} + c \cdot i \]
  3. Recombined 2 regimes into one program.
  4. Final simplification59.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -600000000:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;t \leq 3.15 \cdot 10^{+103} \lor \neg \left(t \leq 3.1 \cdot 10^{+133}\right) \land t \leq 5.2 \cdot 10^{+169}:\\ \;\;\;\;c \cdot i + a \cdot b\\ \mathbf{else}:\\ \;\;\;\;z \cdot t\\ \end{array} \]

Alternative 17: 66.3% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -0.0009:\\
\;\;\;\;a \cdot b + x \cdot y\\

\mathbf{elif}\;a \cdot b \leq 2.8 \cdot 10^{+127}:\\
\;\;\;\;c \cdot i + z \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -8.9999999999999998e-4

    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-def95.0%

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

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

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

        \[\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.7%

      \[\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. Step-by-step derivation
      1. fma-udef97.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.9999999999999998e-4 < (*.f64 a b) < 2.8000000000000002e127

    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 inf 67.2%

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

    if 2.8000000000000002e127 < (*.f64 a b)

    1. Initial program 89.7%

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

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

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

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

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

        \[\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. Simplified97.4%

      \[\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. Step-by-step derivation
      1. fma-udef94.8%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -0.0009:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 2.8 \cdot 10^{+127}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \end{array} \]

Alternative 18: 59.1% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;i \leq -2.15 \cdot 10^{-66} \lor \neg \left(i \leq 3.8 \cdot 10^{+184}\right):\\
\;\;\;\;c \cdot i + a \cdot b\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < -2.15000000000000007e-66 or 3.8000000000000001e184 < i

    1. Initial program 91.3%

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

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

    if -2.15000000000000007e-66 < i < 3.8000000000000001e184

    1. Initial program 98.1%

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

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

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

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

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

        \[\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. Simplified99.4%

      \[\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. Step-by-step derivation
      1. fma-udef98.8%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -2.15 \cdot 10^{-66} \lor \neg \left(i \leq 3.8 \cdot 10^{+184}\right):\\ \;\;\;\;c \cdot i + a \cdot b\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \end{array} \]

Alternative 19: 43.6% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -5.99999999999999994e26 or 1.1500000000000001e132 < (*.f64 a b)

    1. Initial program 92.3%

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

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

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

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

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

        \[\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.3%

      \[\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. Step-by-step derivation
      1. fma-udef96.5%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b} + z \cdot t \]
    7. Step-by-step derivation
      1. *-commutative77.3%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, z \cdot t\right)} \]
    9. Taylor expanded in b around inf 65.6%

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

    if -5.99999999999999994e26 < (*.f64 a b) < 1.1500000000000001e132

    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 c around inf 35.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -6 \cdot 10^{+26}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq 1.15 \cdot 10^{+132}:\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]

Alternative 20: 27.3% accurate, 5.0× speedup?

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

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

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

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

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

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

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

      \[\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.4%

    \[\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. Step-by-step derivation
    1. fma-udef97.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, z \cdot t\right)} \]
  9. Taylor expanded in b around inf 32.8%

    \[\leadsto \color{blue}{a \cdot b} \]
  10. Final simplification32.8%

    \[\leadsto a \cdot b \]

Reproduce

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