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

Percentage Accurate: 95.7% → 97.7%
Time: 13.8s
Alternatives: 11
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 11 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.7% accurate, 1.0× speedup?

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

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

Alternative 1: 97.7% accurate, 0.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}:\\ \;\;\;\;z \cdot \left(t + \frac{c \cdot i}{z}\right)\\ \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 (* z (+ t (/ (* c i) z))))))
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 = z * (t + ((c * i) / z));
	}
	return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = ((a * b) + ((x * y) + (z * t))) + (c * i);
	double tmp;
	if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else {
		tmp = z * (t + ((c * i) / z));
	}
	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 = z * (t + ((c * i) / z))
	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(z * Float64(t + Float64(Float64(c * i) / z)));
	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 = z * (t + ((c * i) / z));
	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[(z * N[(t + N[(N[(c * i), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $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}:\\
\;\;\;\;z \cdot \left(t + \frac{c \cdot i}{z}\right)\\


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

    1. Initial program 100.0%

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

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

    1. Initial program 0.0%

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

      \[\leadsto \mathsf{+.f64}\left(\color{blue}{\left(t \cdot z\right)}, \mathsf{*.f64}\left(c, i\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f6477.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(t, z\right), \mathsf{*.f64}\left(\color{blue}{c}, i\right)\right) \]
    5. Simplified77.9%

      \[\leadsto \color{blue}{t \cdot z} + c \cdot i \]
    6. Taylor expanded in z around inf

      \[\leadsto \color{blue}{z \cdot \left(t + \frac{c \cdot i}{z}\right)} \]
    7. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(z, \color{blue}{\left(t + \frac{c \cdot i}{z}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(z, \mathsf{+.f64}\left(t, \color{blue}{\left(\frac{c \cdot i}{z}\right)}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(z, \mathsf{+.f64}\left(t, \mathsf{/.f64}\left(\left(c \cdot i\right), \color{blue}{z}\right)\right)\right) \]
      4. *-lowering-*.f6477.9%

        \[\leadsto \mathsf{*.f64}\left(z, \mathsf{+.f64}\left(t, \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, i\right), z\right)\right)\right) \]
    8. Simplified77.9%

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

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

Alternative 2: 66.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := c \cdot i + z \cdot t\\ t_2 := x \cdot y + z \cdot t\\ \mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+153}:\\ \;\;\;\;b \cdot \left(a + \frac{c \cdot i}{b}\right)\\ \mathbf{elif}\;a \cdot b \leq -1 \cdot 10^{-26}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;a \cdot b \leq -1 \cdot 10^{-96}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{-321}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;a \cdot b \leq 4 \cdot 10^{+129}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + a \cdot b\\ \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) (* z t))))
   (if (<= (* a b) -1e+153)
     (* b (+ a (/ (* c i) b)))
     (if (<= (* a b) -1e-26)
       t_2
       (if (<= (* a b) -1e-96)
         t_1
         (if (<= (* a b) 2e-321)
           t_2
           (if (<= (* a b) 4e+129) t_1 (+ (* x y) (* a b)))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (c * i) + (z * t);
	double t_2 = (x * y) + (z * t);
	double tmp;
	if ((a * b) <= -1e+153) {
		tmp = b * (a + ((c * i) / b));
	} else if ((a * b) <= -1e-26) {
		tmp = t_2;
	} else if ((a * b) <= -1e-96) {
		tmp = t_1;
	} else if ((a * b) <= 2e-321) {
		tmp = t_2;
	} else if ((a * b) <= 4e+129) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (c * i) + (z * t)
    t_2 = (x * y) + (z * t)
    if ((a * b) <= (-1d+153)) then
        tmp = b * (a + ((c * i) / b))
    else if ((a * b) <= (-1d-26)) then
        tmp = t_2
    else if ((a * b) <= (-1d-96)) then
        tmp = t_1
    else if ((a * b) <= 2d-321) then
        tmp = t_2
    else if ((a * b) <= 4d+129) then
        tmp = t_1
    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 t_1 = (c * i) + (z * t);
	double t_2 = (x * y) + (z * t);
	double tmp;
	if ((a * b) <= -1e+153) {
		tmp = b * (a + ((c * i) / b));
	} else if ((a * b) <= -1e-26) {
		tmp = t_2;
	} else if ((a * b) <= -1e-96) {
		tmp = t_1;
	} else if ((a * b) <= 2e-321) {
		tmp = t_2;
	} else if ((a * b) <= 4e+129) {
		tmp = t_1;
	} else {
		tmp = (x * y) + (a * b);
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (c * i) + (z * t)
	t_2 = (x * y) + (z * t)
	tmp = 0
	if (a * b) <= -1e+153:
		tmp = b * (a + ((c * i) / b))
	elif (a * b) <= -1e-26:
		tmp = t_2
	elif (a * b) <= -1e-96:
		tmp = t_1
	elif (a * b) <= 2e-321:
		tmp = t_2
	elif (a * b) <= 4e+129:
		tmp = t_1
	else:
		tmp = (x * y) + (a * b)
	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(z * t))
	tmp = 0.0
	if (Float64(a * b) <= -1e+153)
		tmp = Float64(b * Float64(a + Float64(Float64(c * i) / b)));
	elseif (Float64(a * b) <= -1e-26)
		tmp = t_2;
	elseif (Float64(a * b) <= -1e-96)
		tmp = t_1;
	elseif (Float64(a * b) <= 2e-321)
		tmp = t_2;
	elseif (Float64(a * b) <= 4e+129)
		tmp = t_1;
	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)
	t_1 = (c * i) + (z * t);
	t_2 = (x * y) + (z * t);
	tmp = 0.0;
	if ((a * b) <= -1e+153)
		tmp = b * (a + ((c * i) / b));
	elseif ((a * b) <= -1e-26)
		tmp = t_2;
	elseif ((a * b) <= -1e-96)
		tmp = t_1;
	elseif ((a * b) <= 2e-321)
		tmp = t_2;
	elseif ((a * b) <= 4e+129)
		tmp = t_1;
	else
		tmp = (x * y) + (a * b);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1e+153], N[(b * N[(a + N[(N[(c * i), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -1e-26], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], -1e-96], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 2e-321], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], 4e+129], t$95$1, N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;a \cdot b \leq -1 \cdot 10^{-26}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{-321}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;a \cdot b \leq 4 \cdot 10^{+129}:\\
\;\;\;\;t\_1\\

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


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

    1. Initial program 93.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

      \[\leadsto \mathsf{+.f64}\left(\color{blue}{\left(a \cdot b\right)}, \mathsf{*.f64}\left(c, i\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f6485.4%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, b\right), \mathsf{*.f64}\left(\color{blue}{c}, i\right)\right) \]
    5. Simplified85.4%

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

      \[\leadsto \color{blue}{b \cdot \left(a + \frac{c \cdot i}{b}\right)} \]
    7. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(b, \color{blue}{\left(a + \frac{c \cdot i}{b}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(a, \color{blue}{\left(\frac{c \cdot i}{b}\right)}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(a, \mathsf{/.f64}\left(\left(c \cdot i\right), \color{blue}{b}\right)\right)\right) \]
      4. *-lowering-*.f6485.4%

        \[\leadsto \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(a, \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, i\right), b\right)\right)\right) \]
    8. Simplified85.4%

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

    if -1e153 < (*.f64 a b) < -1e-26 or -9.9999999999999991e-97 < (*.f64 a b) < 2.00097e-321

    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. Step-by-step derivation
      1. flip-+N/A

        \[\leadsto \frac{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) \cdot \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - \left(c \cdot i\right) \cdot \left(c \cdot i\right)}{\color{blue}{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - c \cdot i}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - c \cdot i}{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) \cdot \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - \left(c \cdot i\right) \cdot \left(c \cdot i\right)}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - c \cdot i}{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) \cdot \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - \left(c \cdot i\right) \cdot \left(c \cdot i\right)}\right)}\right) \]
      4. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{1}{\color{blue}{\frac{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) \cdot \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - \left(c \cdot i\right) \cdot \left(c \cdot i\right)}{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - c \cdot i}}}\right)\right) \]
      5. flip-+N/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{1}{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + \color{blue}{c \cdot i}}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \color{blue}{\left(\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i\right)}\right)\right) \]
      7. associate-+l+N/A

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, y\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(z, t\right), \color{blue}{\left(c \cdot i\right)}\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. *-lowering-*.f6492.7%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, y\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(z, t\right), \mathsf{*.f64}\left(c, \color{blue}{i}\right)\right)\right)\right)\right) \]
    7. Simplified92.7%

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

      \[\leadsto \color{blue}{t \cdot z + x \cdot y} \]
    9. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(t \cdot z\right), \color{blue}{\left(x \cdot y\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(t, z\right), \left(\color{blue}{x} \cdot y\right)\right) \]
      3. *-lowering-*.f6473.2%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(t, z\right), \mathsf{*.f64}\left(x, \color{blue}{y}\right)\right) \]
    10. Simplified73.2%

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

    if -1e-26 < (*.f64 a b) < -9.9999999999999991e-97 or 2.00097e-321 < (*.f64 a b) < 4e129

    1. Initial program 98.8%

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

      \[\leadsto \mathsf{+.f64}\left(\color{blue}{\left(t \cdot z\right)}, \mathsf{*.f64}\left(c, i\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f6482.6%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(t, z\right), \mathsf{*.f64}\left(\color{blue}{c}, i\right)\right) \]
    5. Simplified82.6%

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

    if 4e129 < (*.f64 a b)

    1. Initial program 90.5%

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

      \[\leadsto \color{blue}{a \cdot b + \left(t \cdot z + x \cdot y\right)} \]
    4. Step-by-step derivation
      1. associate-+r+N/A

        \[\leadsto \left(a \cdot b + t \cdot z\right) + \color{blue}{x \cdot y} \]
      2. +-commutativeN/A

        \[\leadsto x \cdot y + \color{blue}{\left(a \cdot b + t \cdot z\right)} \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(x \cdot y\right), \color{blue}{\left(a \cdot b + t \cdot z\right)}\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, y\right), \left(\color{blue}{a \cdot b} + t \cdot z\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, y\right), \mathsf{+.f64}\left(\left(a \cdot b\right), \color{blue}{\left(t \cdot z\right)}\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, y\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, b\right), \left(\color{blue}{t} \cdot z\right)\right)\right) \]
      7. *-lowering-*.f6483.6%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, y\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, b\right), \mathsf{*.f64}\left(t, \color{blue}{z}\right)\right)\right) \]
    5. Simplified83.6%

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

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, y\right), \color{blue}{\left(a \cdot b\right)}\right) \]
    7. Step-by-step derivation
      1. *-lowering-*.f6483.6%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, y\right), \mathsf{*.f64}\left(a, \color{blue}{b}\right)\right) \]
    8. Simplified83.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+153}:\\ \;\;\;\;b \cdot \left(a + \frac{c \cdot i}{b}\right)\\ \mathbf{elif}\;a \cdot b \leq -1 \cdot 10^{-26}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq -1 \cdot 10^{-96}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{-321}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 4 \cdot 10^{+129}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 66.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot y + z \cdot t\\ t_2 := c \cdot i + z \cdot t\\ \mathbf{if}\;a \cdot b \leq -2.4 \cdot 10^{+147}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -1.16 \cdot 10^{-28}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \cdot b \leq -1.45 \cdot 10^{-97}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{-321}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \cdot b \leq 1.3 \cdot 10^{+132}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + a \cdot b\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* x y) (* z t))) (t_2 (+ (* c i) (* z t))))
   (if (<= (* a b) -2.4e+147)
     (+ (* a b) (* c i))
     (if (<= (* a b) -1.16e-28)
       t_1
       (if (<= (* a b) -1.45e-97)
         t_2
         (if (<= (* a b) 2e-321)
           t_1
           (if (<= (* a b) 1.3e+132) t_2 (+ (* x y) (* a b)))))))))
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 t_2 = (c * i) + (z * t);
	double tmp;
	if ((a * b) <= -2.4e+147) {
		tmp = (a * b) + (c * i);
	} else if ((a * b) <= -1.16e-28) {
		tmp = t_1;
	} else if ((a * b) <= -1.45e-97) {
		tmp = t_2;
	} else if ((a * b) <= 2e-321) {
		tmp = t_1;
	} else if ((a * b) <= 1.3e+132) {
		tmp = t_2;
	} 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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (x * y) + (z * t)
    t_2 = (c * i) + (z * t)
    if ((a * b) <= (-2.4d+147)) then
        tmp = (a * b) + (c * i)
    else if ((a * b) <= (-1.16d-28)) then
        tmp = t_1
    else if ((a * b) <= (-1.45d-97)) then
        tmp = t_2
    else if ((a * b) <= 2d-321) then
        tmp = t_1
    else if ((a * b) <= 1.3d+132) then
        tmp = t_2
    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 t_1 = (x * y) + (z * t);
	double t_2 = (c * i) + (z * t);
	double tmp;
	if ((a * b) <= -2.4e+147) {
		tmp = (a * b) + (c * i);
	} else if ((a * b) <= -1.16e-28) {
		tmp = t_1;
	} else if ((a * b) <= -1.45e-97) {
		tmp = t_2;
	} else if ((a * b) <= 2e-321) {
		tmp = t_1;
	} else if ((a * b) <= 1.3e+132) {
		tmp = t_2;
	} else {
		tmp = (x * y) + (a * b);
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (x * y) + (z * t)
	t_2 = (c * i) + (z * t)
	tmp = 0
	if (a * b) <= -2.4e+147:
		tmp = (a * b) + (c * i)
	elif (a * b) <= -1.16e-28:
		tmp = t_1
	elif (a * b) <= -1.45e-97:
		tmp = t_2
	elif (a * b) <= 2e-321:
		tmp = t_1
	elif (a * b) <= 1.3e+132:
		tmp = t_2
	else:
		tmp = (x * y) + (a * b)
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(x * y) + Float64(z * t))
	t_2 = Float64(Float64(c * i) + Float64(z * t))
	tmp = 0.0
	if (Float64(a * b) <= -2.4e+147)
		tmp = Float64(Float64(a * b) + Float64(c * i));
	elseif (Float64(a * b) <= -1.16e-28)
		tmp = t_1;
	elseif (Float64(a * b) <= -1.45e-97)
		tmp = t_2;
	elseif (Float64(a * b) <= 2e-321)
		tmp = t_1;
	elseif (Float64(a * b) <= 1.3e+132)
		tmp = t_2;
	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)
	t_1 = (x * y) + (z * t);
	t_2 = (c * i) + (z * t);
	tmp = 0.0;
	if ((a * b) <= -2.4e+147)
		tmp = (a * b) + (c * i);
	elseif ((a * b) <= -1.16e-28)
		tmp = t_1;
	elseif ((a * b) <= -1.45e-97)
		tmp = t_2;
	elseif ((a * b) <= 2e-321)
		tmp = t_1;
	elseif ((a * b) <= 1.3e+132)
		tmp = t_2;
	else
		tmp = (x * y) + (a * b);
	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]}, Block[{t$95$2 = N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -2.4e+147], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -1.16e-28], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], -1.45e-97], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], 2e-321], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 1.3e+132], t$95$2, N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;a \cdot b \leq -1.45 \cdot 10^{-97}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;a \cdot b \leq 1.3 \cdot 10^{+132}:\\
\;\;\;\;t\_2\\

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


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

    1. Initial program 93.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

      \[\leadsto \mathsf{+.f64}\left(\color{blue}{\left(a \cdot b\right)}, \mathsf{*.f64}\left(c, i\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f6485.4%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, b\right), \mathsf{*.f64}\left(\color{blue}{c}, i\right)\right) \]
    5. Simplified85.4%

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

    if -2.40000000000000002e147 < (*.f64 a b) < -1.1600000000000001e-28 or -1.45e-97 < (*.f64 a b) < 2.00097e-321

    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. Step-by-step derivation
      1. flip-+N/A

        \[\leadsto \frac{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) \cdot \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - \left(c \cdot i\right) \cdot \left(c \cdot i\right)}{\color{blue}{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - c \cdot i}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - c \cdot i}{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) \cdot \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - \left(c \cdot i\right) \cdot \left(c \cdot i\right)}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - c \cdot i}{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) \cdot \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - \left(c \cdot i\right) \cdot \left(c \cdot i\right)}\right)}\right) \]
      4. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{1}{\color{blue}{\frac{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) \cdot \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - \left(c \cdot i\right) \cdot \left(c \cdot i\right)}{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - c \cdot i}}}\right)\right) \]
      5. flip-+N/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{1}{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + \color{blue}{c \cdot i}}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \color{blue}{\left(\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i\right)}\right)\right) \]
      7. associate-+l+N/A

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, y\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(z, t\right), \color{blue}{\left(c \cdot i\right)}\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. *-lowering-*.f6492.7%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, y\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(z, t\right), \mathsf{*.f64}\left(c, \color{blue}{i}\right)\right)\right)\right)\right) \]
    7. Simplified92.7%

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

      \[\leadsto \color{blue}{t \cdot z + x \cdot y} \]
    9. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(t \cdot z\right), \color{blue}{\left(x \cdot y\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(t, z\right), \left(\color{blue}{x} \cdot y\right)\right) \]
      3. *-lowering-*.f6473.2%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(t, z\right), \mathsf{*.f64}\left(x, \color{blue}{y}\right)\right) \]
    10. Simplified73.2%

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

    if -1.1600000000000001e-28 < (*.f64 a b) < -1.45e-97 or 2.00097e-321 < (*.f64 a b) < 1.3e132

    1. Initial program 98.8%

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

      \[\leadsto \mathsf{+.f64}\left(\color{blue}{\left(t \cdot z\right)}, \mathsf{*.f64}\left(c, i\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f6482.6%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(t, z\right), \mathsf{*.f64}\left(\color{blue}{c}, i\right)\right) \]
    5. Simplified82.6%

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

    if 1.3e132 < (*.f64 a b)

    1. Initial program 90.5%

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

      \[\leadsto \color{blue}{a \cdot b + \left(t \cdot z + x \cdot y\right)} \]
    4. Step-by-step derivation
      1. associate-+r+N/A

        \[\leadsto \left(a \cdot b + t \cdot z\right) + \color{blue}{x \cdot y} \]
      2. +-commutativeN/A

        \[\leadsto x \cdot y + \color{blue}{\left(a \cdot b + t \cdot z\right)} \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(x \cdot y\right), \color{blue}{\left(a \cdot b + t \cdot z\right)}\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, y\right), \left(\color{blue}{a \cdot b} + t \cdot z\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, y\right), \mathsf{+.f64}\left(\left(a \cdot b\right), \color{blue}{\left(t \cdot z\right)}\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, y\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, b\right), \left(\color{blue}{t} \cdot z\right)\right)\right) \]
      7. *-lowering-*.f6483.6%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, y\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, b\right), \mathsf{*.f64}\left(t, \color{blue}{z}\right)\right)\right) \]
    5. Simplified83.6%

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

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, y\right), \color{blue}{\left(a \cdot b\right)}\right) \]
    7. Step-by-step derivation
      1. *-lowering-*.f6483.6%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, y\right), \mathsf{*.f64}\left(a, \color{blue}{b}\right)\right) \]
    8. Simplified83.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -2.4 \cdot 10^{+147}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -1.16 \cdot 10^{-28}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq -1.45 \cdot 10^{-97}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{-321}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.3 \cdot 10^{+132}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 66.0% accurate, 0.4× speedup?

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

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

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

\mathbf{elif}\;a \cdot b \leq -6.5 \cdot 10^{-97}:\\
\;\;\;\;t\_3\\

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

\mathbf{elif}\;a \cdot b \leq 1.55 \cdot 10^{+128}:\\
\;\;\;\;t\_3\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -9.6000000000000004e151 or 1.55000000000000002e128 < (*.f64 a b)

    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 inf

      \[\leadsto \mathsf{+.f64}\left(\color{blue}{\left(a \cdot b\right)}, \mathsf{*.f64}\left(c, i\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f6480.4%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, b\right), \mathsf{*.f64}\left(\color{blue}{c}, i\right)\right) \]
    5. Simplified80.4%

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

    if -9.6000000000000004e151 < (*.f64 a b) < -3.3999999999999997e-27 or -6.5000000000000004e-97 < (*.f64 a b) < 2.00097e-321

    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. Step-by-step derivation
      1. flip-+N/A

        \[\leadsto \frac{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) \cdot \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - \left(c \cdot i\right) \cdot \left(c \cdot i\right)}{\color{blue}{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - c \cdot i}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - c \cdot i}{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) \cdot \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - \left(c \cdot i\right) \cdot \left(c \cdot i\right)}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - c \cdot i}{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) \cdot \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - \left(c \cdot i\right) \cdot \left(c \cdot i\right)}\right)}\right) \]
      4. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{1}{\color{blue}{\frac{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) \cdot \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - \left(c \cdot i\right) \cdot \left(c \cdot i\right)}{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) - c \cdot i}}}\right)\right) \]
      5. flip-+N/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{1}{\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + \color{blue}{c \cdot i}}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \color{blue}{\left(\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i\right)}\right)\right) \]
      7. associate-+l+N/A

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, y\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(z, t\right), \color{blue}{\left(c \cdot i\right)}\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. *-lowering-*.f6492.7%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, y\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(z, t\right), \mathsf{*.f64}\left(c, \color{blue}{i}\right)\right)\right)\right)\right) \]
    7. Simplified92.7%

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

      \[\leadsto \color{blue}{t \cdot z + x \cdot y} \]
    9. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(t \cdot z\right), \color{blue}{\left(x \cdot y\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(t, z\right), \left(\color{blue}{x} \cdot y\right)\right) \]
      3. *-lowering-*.f6473.2%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(t, z\right), \mathsf{*.f64}\left(x, \color{blue}{y}\right)\right) \]
    10. Simplified73.2%

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

    if -3.3999999999999997e-27 < (*.f64 a b) < -6.5000000000000004e-97 or 2.00097e-321 < (*.f64 a b) < 1.55000000000000002e128

    1. Initial program 98.8%

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

      \[\leadsto \mathsf{+.f64}\left(\color{blue}{\left(t \cdot z\right)}, \mathsf{*.f64}\left(c, i\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f6482.4%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(t, z\right), \mathsf{*.f64}\left(\color{blue}{c}, i\right)\right) \]
    5. Simplified82.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -9.6 \cdot 10^{+151}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;a \cdot b \leq -3.4 \cdot 10^{-27}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq -6.5 \cdot 10^{-97}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{-321}:\\ \;\;\;\;x \cdot y + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 1.55 \cdot 10^{+128}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 43.2% accurate, 0.4× speedup?

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

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 c i) < -1.18000000000000005e107 or 3.25000000000000007e149 < (*.f64 c i)

    1. Initial program 94.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

      \[\leadsto \color{blue}{c \cdot i} \]
    4. Step-by-step derivation
      1. *-lowering-*.f6471.7%

        \[\leadsto \mathsf{*.f64}\left(c, \color{blue}{i}\right) \]
    5. Simplified71.7%

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

    if -1.18000000000000005e107 < (*.f64 c i) < -5.00000000000000003e40 or 2.3500000000000001e-228 < (*.f64 c i) < 3.25000000000000007e149

    1. Initial program 97.5%

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

      \[\leadsto \color{blue}{x \cdot y} \]
    4. Step-by-step derivation
      1. *-lowering-*.f6440.9%

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{y}\right) \]
    5. Simplified40.9%

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

    if -5.00000000000000003e40 < (*.f64 c i) < -7e-226

    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

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

        \[\leadsto \mathsf{*.f64}\left(t, \color{blue}{z}\right) \]
    5. Simplified51.8%

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

    if -7e-226 < (*.f64 c i) < 2.3500000000000001e-228

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

      \[\leadsto \color{blue}{a \cdot b} \]
    4. Step-by-step derivation
      1. *-lowering-*.f6449.5%

        \[\leadsto \mathsf{*.f64}\left(a, \color{blue}{b}\right) \]
    5. Simplified49.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1.18 \cdot 10^{+107}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -5 \cdot 10^{+40}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \cdot i \leq -7 \cdot 10^{-226}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \cdot i \leq 2.35 \cdot 10^{-228}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq 3.25 \cdot 10^{+149}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 43.2% accurate, 0.5× speedup?

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 c i) < -3.99999999999999999e98 or 2.70000000000000017e137 < (*.f64 c i)

    1. Initial program 94.3%

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

      \[\leadsto \color{blue}{c \cdot i} \]
    4. Step-by-step derivation
      1. *-lowering-*.f6468.2%

        \[\leadsto \mathsf{*.f64}\left(c, \color{blue}{i}\right) \]
    5. Simplified68.2%

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

    if -3.99999999999999999e98 < (*.f64 c i) < -1.45999999999999994e-210 or 2.89999999999999997e-114 < (*.f64 c i) < 2.70000000000000017e137

    1. Initial program 96.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

      \[\leadsto \color{blue}{t \cdot z} \]
    4. Step-by-step derivation
      1. *-lowering-*.f6441.1%

        \[\leadsto \mathsf{*.f64}\left(t, \color{blue}{z}\right) \]
    5. Simplified41.1%

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

    if -1.45999999999999994e-210 < (*.f64 c i) < 2.89999999999999997e-114

    1. Initial program 98.6%

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

      \[\leadsto \color{blue}{a \cdot b} \]
    4. Step-by-step derivation
      1. *-lowering-*.f6445.0%

        \[\leadsto \mathsf{*.f64}\left(a, \color{blue}{b}\right) \]
    5. Simplified45.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -4 \cdot 10^{+98}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -1.46 \cdot 10^{-210}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \cdot i \leq 2.9 \cdot 10^{-114}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq 2.7 \cdot 10^{+137}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 85.2% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := c \cdot i + z \cdot t\\
\mathbf{if}\;c \cdot i \leq -3.4 \cdot 10^{+176}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c i) < -3.40000000000000014e176 or 7.39999999999999957e149 < (*.f64 c i)

    1. Initial program 93.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

      \[\leadsto \mathsf{+.f64}\left(\color{blue}{\left(t \cdot z\right)}, \mathsf{*.f64}\left(c, i\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f6485.4%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(t, z\right), \mathsf{*.f64}\left(\color{blue}{c}, i\right)\right) \]
    5. Simplified85.4%

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

    if -3.40000000000000014e176 < (*.f64 c i) < 7.39999999999999957e149

    1. Initial program 97.8%

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

      \[\leadsto \color{blue}{a \cdot b + \left(t \cdot z + x \cdot y\right)} \]
    4. Step-by-step derivation
      1. associate-+r+N/A

        \[\leadsto \left(a \cdot b + t \cdot z\right) + \color{blue}{x \cdot y} \]
      2. +-commutativeN/A

        \[\leadsto x \cdot y + \color{blue}{\left(a \cdot b + t \cdot z\right)} \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(x \cdot y\right), \color{blue}{\left(a \cdot b + t \cdot z\right)}\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, y\right), \left(\color{blue}{a \cdot b} + t \cdot z\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, y\right), \mathsf{+.f64}\left(\left(a \cdot b\right), \color{blue}{\left(t \cdot z\right)}\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, y\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, b\right), \left(\color{blue}{t} \cdot z\right)\right)\right) \]
      7. *-lowering-*.f6490.3%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, y\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, b\right), \mathsf{*.f64}\left(t, \color{blue}{z}\right)\right)\right) \]
    5. Simplified90.3%

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

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

Alternative 8: 66.0% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot b + c \cdot i\\ \mathbf{if}\;a \cdot b \leq -3.6 \cdot 10^{+95}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \cdot b \leq 9.2 \cdot 10^{+126}:\\ \;\;\;\;c \cdot i + 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 (+ (* a b) (* c i))))
   (if (<= (* a b) -3.6e+95)
     t_1
     (if (<= (* a b) 9.2e+126) (+ (* c i) (* 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 = (a * b) + (c * i);
	double tmp;
	if ((a * b) <= -3.6e+95) {
		tmp = t_1;
	} else if ((a * b) <= 9.2e+126) {
		tmp = (c * i) + (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 = (a * b) + (c * i)
    if ((a * b) <= (-3.6d+95)) then
        tmp = t_1
    else if ((a * b) <= 9.2d+126) then
        tmp = (c * i) + (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 = (a * b) + (c * i);
	double tmp;
	if ((a * b) <= -3.6e+95) {
		tmp = t_1;
	} else if ((a * b) <= 9.2e+126) {
		tmp = (c * i) + (z * t);
	} 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 (a * b) <= -3.6e+95:
		tmp = t_1
	elif (a * b) <= 9.2e+126:
		tmp = (c * i) + (z * t)
	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(a * b) <= -3.6e+95)
		tmp = t_1;
	elseif (Float64(a * b) <= 9.2e+126)
		tmp = Float64(Float64(c * i) + 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 = (a * b) + (c * i);
	tmp = 0.0;
	if ((a * b) <= -3.6e+95)
		tmp = t_1;
	elseif ((a * b) <= 9.2e+126)
		tmp = (c * i) + (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[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -3.6e+95], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 9.2e+126], N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -3.59999999999999978e95 or 9.2000000000000002e126 < (*.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. Add Preprocessing
    3. Taylor expanded in a around inf

      \[\leadsto \mathsf{+.f64}\left(\color{blue}{\left(a \cdot b\right)}, \mathsf{*.f64}\left(c, i\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f6477.4%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, b\right), \mathsf{*.f64}\left(\color{blue}{c}, i\right)\right) \]
    5. Simplified77.4%

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

    if -3.59999999999999978e95 < (*.f64 a b) < 9.2000000000000002e126

    1. Initial program 98.2%

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

      \[\leadsto \mathsf{+.f64}\left(\color{blue}{\left(t \cdot z\right)}, \mathsf{*.f64}\left(c, i\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f6470.2%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(t, z\right), \mathsf{*.f64}\left(\color{blue}{c}, i\right)\right) \]
    5. Simplified70.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -3.6 \cdot 10^{+95}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 9.2 \cdot 10^{+126}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + c \cdot i\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 62.5% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+142}:\\
\;\;\;\;x \cdot y\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -5.0000000000000001e142 or 3.99999999999999981e247 < (*.f64 x y)

    1. Initial program 88.2%

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

      \[\leadsto \color{blue}{x \cdot y} \]
    4. Step-by-step derivation
      1. *-lowering-*.f6476.1%

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{y}\right) \]
    5. Simplified76.1%

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

    if -5.0000000000000001e142 < (*.f64 x y) < 3.99999999999999981e247

    1. Initial program 99.4%

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

      \[\leadsto \mathsf{+.f64}\left(\color{blue}{\left(a \cdot b\right)}, \mathsf{*.f64}\left(c, i\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f6461.3%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, b\right), \mathsf{*.f64}\left(\color{blue}{c}, i\right)\right) \]
    5. Simplified61.3%

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

Alternative 10: 43.2% accurate, 0.9× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -9.39999999999999985e54 or 3.4000000000000001e130 < (*.f64 a b)

    1. Initial program 93.2%

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

      \[\leadsto \color{blue}{a \cdot b} \]
    4. Step-by-step derivation
      1. *-lowering-*.f6463.4%

        \[\leadsto \mathsf{*.f64}\left(a, \color{blue}{b}\right) \]
    5. Simplified63.4%

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

    if -9.39999999999999985e54 < (*.f64 a b) < 3.4000000000000001e130

    1. Initial program 98.2%

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

      \[\leadsto \color{blue}{c \cdot i} \]
    4. Step-by-step derivation
      1. *-lowering-*.f6436.6%

        \[\leadsto \mathsf{*.f64}\left(c, \color{blue}{i}\right) \]
    5. Simplified36.6%

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

Alternative 11: 26.9% accurate, 5.0× speedup?

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

\\
a \cdot b
\end{array}
Derivation
  1. Initial program 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 a around inf

    \[\leadsto \color{blue}{a \cdot b} \]
  4. Step-by-step derivation
    1. *-lowering-*.f6425.4%

      \[\leadsto \mathsf{*.f64}\left(a, \color{blue}{b}\right) \]
  5. Simplified25.4%

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

Reproduce

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