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

Percentage Accurate: 95.8% → 98.3%
Time: 9.5s
Alternatives: 13
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 13 alternatives:

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

Initial Program: 95.8% accurate, 1.0× speedup?

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

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

Alternative 1: 98.3% accurate, 0.4× speedup?

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

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

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


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

    1. Initial program 100.0%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. 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 x around inf

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, y\right), \mathsf{*.f64}\left(\color{blue}{c}, i\right)\right) \]
    5. Simplified50.0%

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{+.f64}\left(c, \mathsf{/.f64}\left(\left(x \cdot y\right), \color{blue}{i}\right)\right)\right) \]
      4. *-lowering-*.f6462.5%

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{+.f64}\left(c, \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, y\right), i\right)\right)\right) \]
    8. Simplified62.5%

      \[\leadsto \color{blue}{i \cdot \left(c + \frac{x \cdot y}{i}\right)} \]
    9. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(c + \frac{x \cdot y}{i}\right) \cdot \color{blue}{i} \]
      2. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(c, \left(\frac{x \cdot y}{i}\right)\right), i\right) \]
      4. associate-/l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(c, \left(x \cdot \frac{y}{i}\right)\right), i\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(c, \mathsf{*.f64}\left(x, \left(\frac{y}{i}\right)\right)\right), i\right) \]
      6. /-lowering-/.f6475.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(c, \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(y, i\right)\right)\right), i\right) \]
    10. Applied egg-rr75.0%

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

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

Alternative 2: 83.4% accurate, 0.4× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -inf.0

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

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

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

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

    if -inf.0 < (*.f64 x y) < -2.00000000000000015e70 or 9.9999999999999997e-49 < (*.f64 x y)

    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 0

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

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

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

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

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

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

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

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

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

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

    if -2.00000000000000015e70 < (*.f64 x y) < 9.9999999999999997e-49

    1. Initial program 100.0%

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

      \[\leadsto \mathsf{+.f64}\left(\color{blue}{\left(-1 \cdot \left(b \cdot \left(-1 \cdot a + -1 \cdot \frac{t \cdot z + x \cdot y}{b}\right)\right)\right)}, \mathsf{*.f64}\left(c, i\right)\right) \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\mathsf{neg}\left(b \cdot \left(-1 \cdot a + -1 \cdot \frac{t \cdot z + x \cdot y}{b}\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{c}, i\right)\right) \]
      2. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{+.f64}\left(\left(b \cdot \left(\mathsf{neg}\left(\left(-1 \cdot a + -1 \cdot \frac{t \cdot z + x \cdot y}{b}\right)\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{c}, i\right)\right) \]
      3. distribute-lft-outN/A

        \[\leadsto \mathsf{+.f64}\left(\left(b \cdot \left(\mathsf{neg}\left(-1 \cdot \left(a + \frac{t \cdot z + x \cdot y}{b}\right)\right)\right)\right), \mathsf{*.f64}\left(c, i\right)\right) \]
      4. mul-1-negN/A

        \[\leadsto \mathsf{+.f64}\left(\left(b \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(a + \frac{t \cdot z + x \cdot y}{b}\right)\right)\right)\right)\right)\right), \mathsf{*.f64}\left(c, i\right)\right) \]
      5. remove-double-negN/A

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(b, \mathsf{+.f64}\left(a, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(t, z\right), \left(x \cdot y\right)\right), b\right)\right)\right), \mathsf{*.f64}\left(c, i\right)\right) \]
      11. *-lowering-*.f6495.4%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(b, \mathsf{+.f64}\left(a, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(t, z\right), \mathsf{*.f64}\left(x, y\right)\right), b\right)\right)\right), \mathsf{*.f64}\left(c, i\right)\right) \]
    5. Simplified95.4%

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(b, \mathsf{+.f64}\left(a, \mathsf{/.f64}\left(\left(t \cdot z\right), b\right)\right)\right), \mathsf{*.f64}\left(c, i\right)\right) \]
      4. *-lowering-*.f6493.6%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(b, \mathsf{+.f64}\left(a, \mathsf{/.f64}\left(\mathsf{*.f64}\left(t, z\right), b\right)\right)\right), \mathsf{*.f64}\left(c, i\right)\right) \]
    8. Simplified93.6%

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

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

Alternative 3: 85.2% accurate, 0.6× speedup?

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

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

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

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


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

    1. Initial program 92.5%

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

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

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

    if -4.99999999999999953e214 < (*.f64 c i) < 4.9999999999999999e155

    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 0

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

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

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

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

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

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

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

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

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

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

    if 4.9999999999999999e155 < (*.f64 c i)

    1. Initial program 97.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-*.f6483.8%

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

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

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

Alternative 4: 65.5% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+130}:\\
\;\;\;\;x \cdot y + z \cdot t\\

\mathbf{elif}\;x \cdot y \leq 20000:\\
\;\;\;\;c \cdot i + z \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -1.0000000000000001e130

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot y + \color{blue}{t \cdot z} \]
      2. +-lowering-+.f64N/A

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

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

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

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

    if -1.0000000000000001e130 < (*.f64 x y) < 2e4

    1. Initial program 100.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-*.f6472.9%

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

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

    if 2e4 < (*.f64 x y)

    1. Initial program 95.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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b + x \cdot y} \]
    7. Step-by-step derivation
      1. +-lowering-+.f64N/A

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

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

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

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

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

Alternative 5: 65.6% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.06 \cdot 10^{+127}:\\
\;\;\;\;x \cdot y + c \cdot i\\

\mathbf{elif}\;x \cdot y \leq 44000000:\\
\;\;\;\;c \cdot i + z \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -1.06000000000000006e127

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

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

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

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

    if -1.06000000000000006e127 < (*.f64 x y) < 4.4e7

    1. Initial program 100.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-*.f6472.9%

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

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

    if 4.4e7 < (*.f64 x y)

    1. Initial program 95.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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b + x \cdot y} \]
    7. Step-by-step derivation
      1. +-lowering-+.f64N/A

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

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

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

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

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

Alternative 6: 64.2% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;x \cdot y \leq 650000000:\\
\;\;\;\;c \cdot i + z \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -1.55e130

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

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

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

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

    if -1.55e130 < (*.f64 x y) < 6.5e8

    1. Initial program 100.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-*.f6472.9%

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

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

    if 6.5e8 < (*.f64 x y)

    1. Initial program 95.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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b + x \cdot y} \]
    7. Step-by-step derivation
      1. +-lowering-+.f64N/A

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

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

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

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

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

Alternative 7: 63.8% accurate, 0.7× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -2.29999999999999998e128

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

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

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

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

    if -2.29999999999999998e128 < (*.f64 x y) < 1.75e91

    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 c around 0

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(t, z\right), \color{blue}{\left(a \cdot b\right)}\right) \]
    7. Step-by-step derivation
      1. *-lowering-*.f6464.3%

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

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

    if 1.75e91 < (*.f64 x y)

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b + x \cdot y} \]
    7. Step-by-step derivation
      1. +-lowering-+.f64N/A

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

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

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

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

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

Alternative 8: 63.7% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;x \cdot y \leq 0.042:\\
\;\;\;\;a \cdot b + c \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -1.9499999999999999e129

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

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

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

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

    if -1.9499999999999999e129 < (*.f64 x y) < 0.0420000000000000026

    1. Initial program 100.0%

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

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

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

    if 0.0420000000000000026 < (*.f64 x y)

    1. Initial program 95.7%

      \[\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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b + x \cdot y} \]
    7. Step-by-step derivation
      1. +-lowering-+.f64N/A

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

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

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

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

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

Alternative 9: 62.7% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2.6 \cdot 10^{+129}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq 7.2 \cdot 10^{+154}:\\ \;\;\;\;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) -2.6e+129)
   (* x y)
   (if (<= (* x y) 7.2e+154) (+ (* 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) <= -2.6e+129) {
		tmp = x * y;
	} else if ((x * y) <= 7.2e+154) {
		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) <= (-2.6d+129)) then
        tmp = x * y
    else if ((x * y) <= 7.2d+154) 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) <= -2.6e+129) {
		tmp = x * y;
	} else if ((x * y) <= 7.2e+154) {
		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) <= -2.6e+129:
		tmp = x * y
	elif (x * y) <= 7.2e+154:
		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) <= -2.6e+129)
		tmp = Float64(x * y);
	elseif (Float64(x * y) <= 7.2e+154)
		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) <= -2.6e+129)
		tmp = x * y;
	elseif ((x * y) <= 7.2e+154)
		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], -2.6e+129], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 7.2e+154], 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 -2.6 \cdot 10^{+129}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;x \cdot y \leq 7.2 \cdot 10^{+154}:\\
\;\;\;\;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) < -2.60000000000000012e129 or 7.2000000000000001e154 < (*.f64 x y)

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

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

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

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

    if -2.60000000000000012e129 < (*.f64 x y) < 7.2000000000000001e154

    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-*.f6459.9%

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

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

Alternative 10: 37.1% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;z \leq 3.1 \cdot 10^{-221}:\\
\;\;\;\;c \cdot i\\

\mathbf{elif}\;z \leq 2.8 \cdot 10^{-116}:\\
\;\;\;\;a \cdot b\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.19999999999999945e61 or 2.7999999999999999e-116 < z

    1. Initial program 96.1%

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

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

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

    if -5.19999999999999945e61 < z < 3.0999999999999999e-221

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

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

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

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

    if 3.0999999999999999e-221 < z < 2.7999999999999999e-116

    1. Initial program 100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.2 \cdot 10^{+61}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;z \leq 3.1 \cdot 10^{-221}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-116}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;z \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 43.0% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;x \cdot y \leq 2.05 \cdot 10^{+89}:\\
\;\;\;\;z \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -3.6000000000000001e129 or 2.04999999999999993e89 < (*.f64 x y)

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

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

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

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

    if -3.6000000000000001e129 < (*.f64 x y) < 2.04999999999999993e89

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -3.6 \cdot 10^{+129}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq 2.05 \cdot 10^{+89}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 42.3% accurate, 0.9× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -4.50000000000000022e170 or 1.3000000000000001e127 < (*.f64 a b)

    1. Initial program 95.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 \color{blue}{a \cdot b} \]
    4. Step-by-step derivation
      1. *-lowering-*.f6462.3%

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

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

    if -4.50000000000000022e170 < (*.f64 a b) < 1.3000000000000001e127

    1. Initial program 97.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-*.f6432.5%

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

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

Alternative 13: 26.4% 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.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 \color{blue}{a \cdot b} \]
  4. Step-by-step derivation
    1. *-lowering-*.f6422.5%

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

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

Reproduce

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