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

Percentage Accurate: 96.1% → 97.8%
Time: 10.8s
Alternatives: 17
Speedup: 0.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 17 alternatives:

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

Initial Program: 96.1% 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.8% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \cdot i + \left(a \cdot b + \left(x \cdot y + z \cdot t\right)\right) \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(x, y, z \cdot t\right) + \left(a \cdot b + c \cdot i\right)\\ \mathbf{else}:\\ \;\;\;\;c \cdot \left(i + \frac{a \cdot b}{c}\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= (+ (* c i) (+ (* a b) (+ (* x y) (* z t)))) INFINITY)
   (+ (fma x y (* z t)) (+ (* a b) (* c i)))
   (* c (+ i (/ (* a b) c)))))
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) + ((x * y) + (z * t)))) <= ((double) INFINITY)) {
		tmp = fma(x, y, (z * t)) + ((a * b) + (c * i));
	} else {
		tmp = c * (i + ((a * b) / c));
	}
	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(x * y) + Float64(z * t)))) <= Inf)
		tmp = Float64(fma(x, y, Float64(z * t)) + Float64(Float64(a * b) + Float64(c * i)));
	else
		tmp = Float64(c * Float64(i + Float64(Float64(a * b) / c)));
	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[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * N[(i + N[(N[(a * b), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;c \cdot \left(i + \frac{a \cdot b}{c}\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 99.9%

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b + c \cdot i} \]
    7. Taylor expanded in c around inf 55.5%

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

Alternative 2: 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-define96.4%

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

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

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

Alternative 3: 97.9% accurate, 0.0× speedup?

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

\\
\mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\right)
\end{array}
Derivation
  1. Initial program 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-define96.4%

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

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

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

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

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

Alternative 4: 66.1% accurate, 0.4× speedup?

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

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

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

\mathbf{elif}\;a \cdot b \leq -5 \cdot 10^{-209}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;a \cdot b \leq 10^{-6}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if (*.f64 a b) < -5.00000000000000036e69

    1. Initial program 95.1%

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

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

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

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

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

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

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

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

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

    if -5.00000000000000036e69 < (*.f64 a b) < -1.00000000000000002e-91

    1. Initial program 97.0%

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

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

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

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

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

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

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

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

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

    if -1.00000000000000002e-91 < (*.f64 a b) < -5.0000000000000005e-209 or 9.9999999999999991e-309 < (*.f64 a b) < 9.99999999999999955e-7

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if -5.0000000000000005e-209 < (*.f64 a b) < 9.9999999999999991e-309

    1. Initial program 94.1%

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

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

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

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

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

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

    if 9.99999999999999955e-7 < (*.f64 a b)

    1. Initial program 93.1%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+69}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq -1 \cdot 10^{-91}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq -5 \cdot 10^{-209}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 10^{-308}:\\ \;\;\;\;x \cdot y + c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 10^{-6}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 43.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.78 \cdot 10^{+68}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -4 \cdot 10^{-227}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 3.5 \cdot 10^{-308}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 1.7 \cdot 10^{-20}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.55 \cdot 10^{+116}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= (* a b) -1.78e+68)
   (* a b)
   (if (<= (* a b) -4e-227)
     (* z t)
     (if (<= (* a b) 3.5e-308)
       (* x y)
       (if (<= (* a b) 1.7e-20)
         (* z t)
         (if (<= (* a b) 1.55e+116) (* x y) (* a b)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((a * b) <= -1.78e+68) {
		tmp = a * b;
	} else if ((a * b) <= -4e-227) {
		tmp = z * t;
	} else if ((a * b) <= 3.5e-308) {
		tmp = x * y;
	} else if ((a * b) <= 1.7e-20) {
		tmp = z * t;
	} else if ((a * b) <= 1.55e+116) {
		tmp = x * y;
	} 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.78d+68)) then
        tmp = a * b
    else if ((a * b) <= (-4d-227)) then
        tmp = z * t
    else if ((a * b) <= 3.5d-308) then
        tmp = x * y
    else if ((a * b) <= 1.7d-20) then
        tmp = z * t
    else if ((a * b) <= 1.55d+116) then
        tmp = x * y
    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.78e+68) {
		tmp = a * b;
	} else if ((a * b) <= -4e-227) {
		tmp = z * t;
	} else if ((a * b) <= 3.5e-308) {
		tmp = x * y;
	} else if ((a * b) <= 1.7e-20) {
		tmp = z * t;
	} else if ((a * b) <= 1.55e+116) {
		tmp = x * y;
	} else {
		tmp = a * b;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (a * b) <= -1.78e+68:
		tmp = a * b
	elif (a * b) <= -4e-227:
		tmp = z * t
	elif (a * b) <= 3.5e-308:
		tmp = x * y
	elif (a * b) <= 1.7e-20:
		tmp = z * t
	elif (a * b) <= 1.55e+116:
		tmp = x * y
	else:
		tmp = a * b
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (Float64(a * b) <= -1.78e+68)
		tmp = Float64(a * b);
	elseif (Float64(a * b) <= -4e-227)
		tmp = Float64(z * t);
	elseif (Float64(a * b) <= 3.5e-308)
		tmp = Float64(x * y);
	elseif (Float64(a * b) <= 1.7e-20)
		tmp = Float64(z * t);
	elseif (Float64(a * b) <= 1.55e+116)
		tmp = Float64(x * y);
	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.78e+68)
		tmp = a * b;
	elseif ((a * b) <= -4e-227)
		tmp = z * t;
	elseif ((a * b) <= 3.5e-308)
		tmp = x * y;
	elseif ((a * b) <= 1.7e-20)
		tmp = z * t;
	elseif ((a * b) <= 1.55e+116)
		tmp = x * y;
	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.78e+68], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -4e-227], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 3.5e-308], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.7e-20], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.55e+116], N[(x * y), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]]
\begin{array}{l}

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

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

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

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

\mathbf{elif}\;a \cdot b \leq 1.55 \cdot 10^{+116}:\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -1.77999999999999997e68 or 1.54999999999999998e116 < (*.f64 a b)

    1. Initial program 93.5%

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

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

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

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

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

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

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

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

    if -1.77999999999999997e68 < (*.f64 a b) < -3.99999999999999978e-227 or 3.5e-308 < (*.f64 a b) < 1.6999999999999999e-20

    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-define99.9%

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

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

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

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

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

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

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

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

    if -3.99999999999999978e-227 < (*.f64 a b) < 3.5e-308 or 1.6999999999999999e-20 < (*.f64 a b) < 1.54999999999999998e116

    1. Initial program 94.5%

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

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

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

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

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

      \[\leadsto \color{blue}{c \cdot i + x \cdot y} \]
    7. Taylor expanded in c around 0 48.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.78 \cdot 10^{+68}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -4 \cdot 10^{-227}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 3.5 \cdot 10^{-308}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 1.7 \cdot 10^{-20}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.55 \cdot 10^{+116}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 66.5% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;a \cdot b \leq -1.9 \cdot 10^{-210}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;a \cdot b \leq 3.8 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\

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


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

    1. Initial program 95.1%

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

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

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

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

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

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

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

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

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

    if -3.49999999999999977e68 < (*.f64 a b) < -1.90000000000000002e-210 or 1.1999999999999998e-308 < (*.f64 a b) < 3.8e-6

    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-define99.9%

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

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

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

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

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

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

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

    if -1.90000000000000002e-210 < (*.f64 a b) < 1.1999999999999998e-308

    1. Initial program 94.1%

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

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

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

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

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

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

    if 3.8e-6 < (*.f64 a b)

    1. Initial program 93.1%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -3.5 \cdot 10^{+68}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq -1.9 \cdot 10^{-210}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.2 \cdot 10^{-308}:\\ \;\;\;\;x \cdot y + c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 3.8 \cdot 10^{-6}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 97.8% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := c \cdot i + \left(a \cdot b + \left(x \cdot y + z \cdot t\right)\right)\\ \mathbf{if}\;t\_1 \leq \infty:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;c \cdot \left(i + \frac{a \cdot b}{c}\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* c i) (+ (* a b) (+ (* x y) (* z t))))))
   (if (<= t_1 INFINITY) t_1 (* c (+ i (/ (* a b) c))))))
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) + ((x * y) + (z * t)));
	double tmp;
	if (t_1 <= ((double) INFINITY)) {
		tmp = t_1;
	} else {
		tmp = c * (i + ((a * b) / c));
	}
	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) + ((x * y) + (z * t)));
	double tmp;
	if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else {
		tmp = c * (i + ((a * b) / c));
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (c * i) + ((a * b) + ((x * y) + (z * t)))
	tmp = 0
	if t_1 <= math.inf:
		tmp = t_1
	else:
		tmp = c * (i + ((a * b) / c))
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))))
	tmp = 0.0
	if (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = Float64(c * Float64(i + Float64(Float64(a * b) / c)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (c * i) + ((a * b) + ((x * y) + (z * t)));
	tmp = 0.0;
	if (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = c * (i + ((a * b) / c));
	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[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(c * N[(i + N[(N[(a * b), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;c \cdot \left(i + \frac{a \cdot b}{c}\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 99.9%

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

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

    1. Initial program 0.0%

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b + c \cdot i} \]
    7. Taylor expanded in c around inf 55.5%

      \[\leadsto \color{blue}{c \cdot \left(i + \frac{a \cdot b}{c}\right)} \]
  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(x \cdot y + z \cdot t\right)\right) \leq \infty:\\ \;\;\;\;c \cdot i + \left(a \cdot b + \left(x \cdot y + z \cdot t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;c \cdot \left(i + \frac{a \cdot b}{c}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 88.0% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+69} \lor \neg \left(a \cdot b \leq 5 \cdot 10^{+51}\right):\\
\;\;\;\;b \cdot \left(a + \left(\frac{z \cdot t}{b} + \frac{x \cdot y}{b}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -5.00000000000000036e69 or 5e51 < (*.f64 a b)

    1. Initial program 93.1%

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

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

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

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

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

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

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

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

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

    if -5.00000000000000036e69 < (*.f64 a b) < 5e51

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

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

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

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

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

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

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

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

Alternative 9: 66.7% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_1 := a \cdot b + c \cdot i\\
\mathbf{if}\;c \cdot i \leq -4.6 \cdot 10^{+91}:\\
\;\;\;\;t\_1\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 c i) < -4.59999999999999982e91 or 2.4999999999999998e111 < (*.f64 c i)

    1. Initial program 90.8%

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

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

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

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

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

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

    if -4.59999999999999982e91 < (*.f64 c i) < 9.9999999999999991e-309

    1. Initial program 97.1%

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

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

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

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

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

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

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

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

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

    if 9.9999999999999991e-309 < (*.f64 c i) < 2.4999999999999998e111

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -4.6 \cdot 10^{+91}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;c \cdot i \leq 10^{-308}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;c \cdot i \leq 2.5 \cdot 10^{+111}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 87.9% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+69} \lor \neg \left(a \cdot b \leq 10^{-6}\right):\\
\;\;\;\;a \cdot b + t\_1\\

\mathbf{else}:\\
\;\;\;\;c \cdot i + t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -5.00000000000000036e69 or 9.99999999999999955e-7 < (*.f64 a b)

    1. Initial program 93.8%

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

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

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

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

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

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

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

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

    if -5.00000000000000036e69 < (*.f64 a b) < 9.99999999999999955e-7

    1. Initial program 97.1%

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

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

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

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

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

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

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

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

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

Alternative 11: 85.7% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -2 \cdot 10^{+140} \lor \neg \left(c \cdot i \leq 5 \cdot 10^{+100}\right):\\
\;\;\;\;c \cdot \left(i + \frac{a \cdot b}{c}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c i) < -2.00000000000000012e140 or 4.9999999999999999e100 < (*.f64 c i)

    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. associate-+l+89.7%

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b + c \cdot i} \]
    7. Taylor expanded in c around inf 76.8%

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

    if -2.00000000000000012e140 < (*.f64 c i) < 4.9999999999999999e100

    1. Initial program 98.3%

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

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

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

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

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

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

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

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

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

Alternative 12: 66.9% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -7.5 \cdot 10^{+94} \lor \neg \left(c \cdot i \leq 7.6 \cdot 10^{+99}\right):\\
\;\;\;\;a \cdot b + c \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c i) < -7.49999999999999978e94 or 7.6e99 < (*.f64 c i)

    1. Initial program 90.9%

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

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

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

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

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

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

    if -7.49999999999999978e94 < (*.f64 c i) < 7.6e99

    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-define98.2%

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

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

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

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

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

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

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

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

Alternative 13: 62.9% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.35 \cdot 10^{+131} \lor \neg \left(x \cdot y \leq 2.3 \cdot 10^{+119}\right):\\
\;\;\;\;x \cdot y\\

\mathbf{else}:\\
\;\;\;\;a \cdot b + c \cdot i\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -1.35000000000000002e131 or 2.3000000000000001e119 < (*.f64 x y)

    1. Initial program 89.9%

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

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

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

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

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

      \[\leadsto \color{blue}{c \cdot i + x \cdot y} \]
    7. Taylor expanded in c around 0 67.5%

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

    if -1.35000000000000002e131 < (*.f64 x y) < 2.3000000000000001e119

    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. fma-define98.2%

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

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

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

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

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

Alternative 14: 66.3% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2.3 \cdot 10^{+69}:\\
\;\;\;\;a \cdot b + z \cdot t\\

\mathbf{elif}\;a \cdot b \leq 0.00044:\\
\;\;\;\;c \cdot i + z \cdot t\\

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


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

    1. Initial program 95.1%

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

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

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

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

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

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

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

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

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

    if -2.30000000000000017e69 < (*.f64 a b) < 4.40000000000000016e-4

    1. Initial program 97.1%

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

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

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

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

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

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

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

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

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

    if 4.40000000000000016e-4 < (*.f64 a b)

    1. Initial program 93.1%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -2.3 \cdot 10^{+69}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 0.00044:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 42.7% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.45 \cdot 10^{+67} \lor \neg \left(a \cdot b \leq 2.4 \cdot 10^{+83}\right):\\
\;\;\;\;a \cdot b\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -1.45000000000000012e67 or 2.39999999999999991e83 < (*.f64 a b)

    1. Initial program 92.8%

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

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

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

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

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

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

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

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

    if -1.45000000000000012e67 < (*.f64 a b) < 2.39999999999999991e83

    1. Initial program 97.4%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.45 \cdot 10^{+67} \lor \neg \left(a \cdot b \leq 2.4 \cdot 10^{+83}\right):\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;z \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 43.2% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+38} \lor \neg \left(a \cdot b \leq 4.6 \cdot 10^{+83}\right):\\
\;\;\;\;a \cdot b\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -4.9999999999999997e38 or 4.5999999999999999e83 < (*.f64 a b)

    1. Initial program 93.1%

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

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

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

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

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

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

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

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

    if -4.9999999999999997e38 < (*.f64 a b) < 4.5999999999999999e83

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

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

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

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

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

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

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

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

Alternative 17: 26.7% 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-define96.4%

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

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

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

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

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

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

Reproduce

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