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

Percentage Accurate: 95.5% → 97.0%
Time: 9.4s
Alternatives: 14
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 14 alternatives:

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

Initial Program: 95.5% 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.0% accurate, 0.4× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

    1. Initial program 0.0%

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

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

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

Alternative 2: 97.6% 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 94.9%

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

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

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

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

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

Alternative 3: 65.6% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;x \cdot y \leq -1.8 \cdot 10^{-209}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x \cdot y \leq 2.55 \cdot 10^{+66}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -5.79999999999999957e37 or 2.55000000000000004e66 < (*.f64 x y)

    1. Initial program 92.9%

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

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

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

    if -5.79999999999999957e37 < (*.f64 x y) < -1.80000000000000008e-209 or 1.7e28 < (*.f64 x y) < 2.55000000000000004e66

    1. Initial program 94.7%

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

      \[\leadsto \color{blue}{b \cdot \left(a + \left(\frac{t \cdot z}{b} + \frac{x \cdot y}{b}\right)\right)} + c \cdot i \]
    4. Taylor expanded in t around inf 73.2%

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

    if -1.80000000000000008e-209 < (*.f64 x y) < 1.7e28

    1. Initial program 97.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -5.8 \cdot 10^{+37}:\\ \;\;\;\;x \cdot y + a \cdot b\\ \mathbf{elif}\;x \cdot y \leq -1.8 \cdot 10^{-209}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 1.7 \cdot 10^{+28}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 2.55 \cdot 10^{+66}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 59.9% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
\mathbf{if}\;x \cdot y \leq -7.4 \cdot 10^{+65}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{-32}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x \cdot y \leq 1.8 \cdot 10^{+96}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;x \cdot y\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -7.39999999999999989e65 or 1.80000000000000007e96 < (*.f64 x y)

    1. Initial program 92.3%

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

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

    if -7.39999999999999989e65 < (*.f64 x y) < -2.00000000000000011e-32 or -1.05e-129 < (*.f64 x y) < 1.80000000000000007e96

    1. Initial program 97.7%

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

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

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

    if -2.00000000000000011e-32 < (*.f64 x y) < -1.05e-129

    1. Initial program 90.9%

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

      \[\leadsto \color{blue}{b \cdot \left(a + \left(\frac{t \cdot z}{b} + \frac{x \cdot y}{b}\right)\right)} + c \cdot i \]
    4. Taylor expanded in b around inf 74.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -7.4 \cdot 10^{+65}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{-32}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq -1.05 \cdot 10^{-129}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 1.8 \cdot 10^{+96}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 41.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2.2 \cdot 10^{-13}:\\
\;\;\;\;x \cdot y\\

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

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

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

\mathbf{else}:\\
\;\;\;\;x \cdot y\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 x y) < -2.19999999999999997e-13 or 5.89999999999999967e88 < (*.f64 x y)

    1. Initial program 93.3%

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

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

    if -2.19999999999999997e-13 < (*.f64 x y) < -2.0000000000000001e-127

    1. Initial program 92.6%

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

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

    if -2.0000000000000001e-127 < (*.f64 x y) < 3.7999999999999998e-230

    1. Initial program 97.9%

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

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

    if 3.7999999999999998e-230 < (*.f64 x y) < 5.89999999999999967e88

    1. Initial program 96.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2.2 \cdot 10^{-13}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{-127}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 3.8 \cdot 10^{-230}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 5.9 \cdot 10^{+88}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 65.4% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;x \cdot y \leq -2.1 \cdot 10^{-209}:\\
\;\;\;\;c \cdot i + z \cdot t\\

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

\mathbf{else}:\\
\;\;\;\;x \cdot y + c \cdot i\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 x y) < -2.8000000000000001e36

    1. Initial program 96.3%

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

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

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

    if -2.8000000000000001e36 < (*.f64 x y) < -2.09999999999999996e-209

    1. Initial program 95.6%

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

      \[\leadsto \color{blue}{b \cdot \left(a + \left(\frac{t \cdot z}{b} + \frac{x \cdot y}{b}\right)\right)} + c \cdot i \]
    4. Taylor expanded in t around inf 72.7%

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

    if -2.09999999999999996e-209 < (*.f64 x y) < 8.6e30

    1. Initial program 96.6%

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

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

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

    if 8.6e30 < (*.f64 x y)

    1. Initial program 91.3%

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

      \[\leadsto \color{blue}{b \cdot \left(a + \left(\frac{t \cdot z}{b} + \frac{x \cdot y}{b}\right)\right)} + c \cdot i \]
    4. Taylor expanded in x around inf 80.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2.8 \cdot 10^{+36}:\\ \;\;\;\;x \cdot y + a \cdot b\\ \mathbf{elif}\;x \cdot y \leq -2.1 \cdot 10^{-209}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;x \cdot y \leq 8.6 \cdot 10^{+30}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 63.4% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot y + a \cdot b\\ \mathbf{if}\;x \cdot y \leq -8.4 \cdot 10^{-13}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq -2.8 \cdot 10^{-127}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;x \cdot y \leq 250000:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* x y) (* a b))))
   (if (<= (* x y) -8.4e-13)
     t_1
     (if (<= (* x y) -2.8e-127)
       (+ (* a b) (* c i))
       (if (<= (* x y) 250000.0) (+ (* a b) (* z t)) 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) + (a * b);
	double tmp;
	if ((x * y) <= -8.4e-13) {
		tmp = t_1;
	} else if ((x * y) <= -2.8e-127) {
		tmp = (a * b) + (c * i);
	} else if ((x * y) <= 250000.0) {
		tmp = (a * b) + (z * t);
	} 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 = (x * y) + (a * b)
    if ((x * y) <= (-8.4d-13)) then
        tmp = t_1
    else if ((x * y) <= (-2.8d-127)) then
        tmp = (a * b) + (c * i)
    else if ((x * y) <= 250000.0d0) then
        tmp = (a * b) + (z * t)
    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 = (x * y) + (a * b);
	double tmp;
	if ((x * y) <= -8.4e-13) {
		tmp = t_1;
	} else if ((x * y) <= -2.8e-127) {
		tmp = (a * b) + (c * i);
	} else if ((x * y) <= 250000.0) {
		tmp = (a * b) + (z * t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (x * y) + (a * b)
	tmp = 0
	if (x * y) <= -8.4e-13:
		tmp = t_1
	elif (x * y) <= -2.8e-127:
		tmp = (a * b) + (c * i)
	elif (x * y) <= 250000.0:
		tmp = (a * b) + (z * t)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(x * y) + Float64(a * b))
	tmp = 0.0
	if (Float64(x * y) <= -8.4e-13)
		tmp = t_1;
	elseif (Float64(x * y) <= -2.8e-127)
		tmp = Float64(Float64(a * b) + Float64(c * i));
	elseif (Float64(x * y) <= 250000.0)
		tmp = Float64(Float64(a * b) + Float64(z * t));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (x * y) + (a * b);
	tmp = 0.0;
	if ((x * y) <= -8.4e-13)
		tmp = t_1;
	elseif ((x * y) <= -2.8e-127)
		tmp = (a * b) + (c * i);
	elseif ((x * y) <= 250000.0)
		tmp = (a * b) + (z * t);
	else
		tmp = 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[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -8.4e-13], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -2.8e-127], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 250000.0], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot y + a \cdot b\\
\mathbf{if}\;x \cdot y \leq -8.4 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -8.39999999999999955e-13 or 2.5e5 < (*.f64 x y)

    1. Initial program 92.9%

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

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

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

    if -8.39999999999999955e-13 < (*.f64 x y) < -2.8e-127

    1. Initial program 92.6%

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

      \[\leadsto \color{blue}{b \cdot \left(a + \left(\frac{t \cdot z}{b} + \frac{x \cdot y}{b}\right)\right)} + c \cdot i \]
    4. Taylor expanded in b around inf 71.3%

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

    if -2.8e-127 < (*.f64 x y) < 2.5e5

    1. Initial program 98.9%

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

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

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

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

Alternative 8: 87.9% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+34} \lor \neg \left(x \cdot y \leq 1.65 \cdot 10^{+24}\right):\\
\;\;\;\;c \cdot i + \left(x \cdot y + z \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -3.99999999999999978e34 or 1.6499999999999999e24 < (*.f64 x y)

    1. Initial program 92.1%

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

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

    if -3.99999999999999978e34 < (*.f64 x y) < 1.6499999999999999e24

    1. Initial program 97.7%

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

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

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

Alternative 9: 87.8% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+88}:\\
\;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\

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

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


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

    1. Initial program 94.1%

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

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

    if -4.99999999999999997e88 < (*.f64 a b) < 5.0000000000000001e29

    1. Initial program 97.7%

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

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

    if 5.0000000000000001e29 < (*.f64 a b)

    1. Initial program 86.3%

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

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

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

Alternative 10: 83.2% accurate, 0.6× speedup?

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

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

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

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


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

    1. Initial program 94.1%

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

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

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

    if -4.99999999999999997e88 < (*.f64 a b) < 2.00000000000000008e36

    1. Initial program 97.7%

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

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

    if 2.00000000000000008e36 < (*.f64 a b)

    1. Initial program 85.7%

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

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

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

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

Alternative 11: 42.9% accurate, 0.6× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -1.84999999999999998e56 or 1.3000000000000001e51 < (*.f64 a b)

    1. Initial program 89.5%

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

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

    if -1.84999999999999998e56 < (*.f64 a b) < 1.7999999999999999e-203

    1. Initial program 97.4%

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

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

    if 1.7999999999999999e-203 < (*.f64 a b) < 1.3000000000000001e51

    1. Initial program 98.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.85 \cdot 10^{+56}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq 1.8 \cdot 10^{-203}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.3 \cdot 10^{+51}:\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 60.4% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2.8 \cdot 10^{+37} \lor \neg \left(x \cdot y \leq 1.25 \cdot 10^{+94}\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) -2.8e+37) (not (<= (* x y) 1.25e+94)))
   (* 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) <= -2.8e+37) || !((x * y) <= 1.25e+94)) {
		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) <= (-2.8d+37)) .or. (.not. ((x * y) <= 1.25d+94))) 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) <= -2.8e+37) || !((x * y) <= 1.25e+94)) {
		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) <= -2.8e+37) or not ((x * y) <= 1.25e+94):
		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) <= -2.8e+37) || !(Float64(x * y) <= 1.25e+94))
		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) <= -2.8e+37) || ~(((x * y) <= 1.25e+94)))
		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], -2.8e+37], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1.25e+94]], $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 -2.8 \cdot 10^{+37} \lor \neg \left(x \cdot y \leq 1.25 \cdot 10^{+94}\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) < -2.7999999999999998e37 or 1.25000000000000003e94 < (*.f64 x y)

    1. Initial program 92.9%

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

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

    if -2.7999999999999998e37 < (*.f64 x y) < 1.25000000000000003e94

    1. Initial program 96.5%

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

      \[\leadsto \color{blue}{b \cdot \left(a + \left(\frac{t \cdot z}{b} + \frac{x \cdot y}{b}\right)\right)} + c \cdot i \]
    4. Taylor expanded in b around inf 58.3%

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

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

Alternative 13: 42.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -0.0078 \lor \neg \left(a \cdot b \leq 1.9 \cdot 10^{+48}\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) -0.0078) (not (<= (* a b) 1.9e+48))) (* 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) <= -0.0078) || !((a * b) <= 1.9e+48)) {
		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) <= (-0.0078d0)) .or. (.not. ((a * b) <= 1.9d+48))) 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) <= -0.0078) || !((a * b) <= 1.9e+48)) {
		tmp = a * b;
	} else {
		tmp = c * i;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if ((a * b) <= -0.0078) or not ((a * b) <= 1.9e+48):
		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) <= -0.0078) || !(Float64(a * b) <= 1.9e+48))
		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) <= -0.0078) || ~(((a * b) <= 1.9e+48)))
		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], -0.0078], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1.9e+48]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(c * i), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -0.0078 \lor \neg \left(a \cdot b \leq 1.9 \cdot 10^{+48}\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) < -0.0077999999999999996 or 1.9e48 < (*.f64 a b)

    1. Initial program 91.1%

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

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

    if -0.0077999999999999996 < (*.f64 a b) < 1.9e48

    1. Initial program 97.4%

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

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

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

Alternative 14: 26.0% accurate, 5.0× speedup?

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

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

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

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

Reproduce

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