Linear.V3:$cdot from linear-1.19.1.3, B

Percentage Accurate: 97.7% → 98.8%
Time: 4.4s
Alternatives: 11
Speedup: 0.5×

Specification

?
\[\begin{array}{l} \\ \left(x \cdot y + z \cdot t\right) + a \cdot b \end{array} \]
(FPCore (x y z t a b) :precision binary64 (+ (+ (* x y) (* z t)) (* a b)))
double code(double x, double y, double z, double t, double a, double b) {
	return ((x * y) + (z * t)) + (a * b);
}
real(8) function code(x, y, z, t, a, b)
    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
    code = ((x * y) + (z * t)) + (a * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return ((x * y) + (z * t)) + (a * b);
}
def code(x, y, z, t, a, b):
	return ((x * y) + (z * t)) + (a * b)
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b))
end
function tmp = code(x, y, z, t, a, b)
	tmp = ((x * y) + (z * t)) + (a * b);
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x \cdot y + z \cdot t\right) + a \cdot b
\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: 97.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(x \cdot y + z \cdot t\right) + a \cdot b \end{array} \]
(FPCore (x y z t a b) :precision binary64 (+ (+ (* x y) (* z t)) (* a b)))
double code(double x, double y, double z, double t, double a, double b) {
	return ((x * y) + (z * t)) + (a * b);
}
real(8) function code(x, y, z, t, a, b)
    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
    code = ((x * y) + (z * t)) + (a * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return ((x * y) + (z * t)) + (a * b);
}
def code(x, y, z, t, a, b):
	return ((x * y) + (z * t)) + (a * b)
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b))
end
function tmp = code(x, y, z, t, a, b)
	tmp = ((x * y) + (z * t)) + (a * b);
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 98.8% accurate, 0.1× speedup?

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

\\
\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)
\end{array}
Derivation
  1. Initial program 95.3%

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)} \]
  4. Final simplification98.4%

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

Alternative 2: 98.8% accurate, 0.1× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

    1. Initial program 0.0%

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

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

        \[\leadsto \color{blue}{t \cdot z + a \cdot b} \]
      2. *-commutative50.0%

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

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

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

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

Alternative 3: 98.8% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot b + \left(z \cdot t + x \cdot y\right)\\ \mathbf{if}\;t_1 \leq \infty:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, t, a \cdot b\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (+ (* a b) (+ (* z t) (* x y)))))
   (if (<= t_1 INFINITY) t_1 (fma z t (* a b)))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (a * b) + ((z * t) + (x * y));
	double tmp;
	if (t_1 <= ((double) INFINITY)) {
		tmp = t_1;
	} else {
		tmp = fma(z, t, (a * b));
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(a * b) + Float64(Float64(z * t) + Float64(x * y)))
	tmp = 0.0
	if (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = fma(z, t, Float64(a * b));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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


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

    1. Initial program 100.0%

      \[\left(x \cdot y + z \cdot t\right) + a \cdot b \]

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

    1. Initial program 0.0%

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

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

        \[\leadsto \color{blue}{t \cdot z + a \cdot b} \]
      2. *-commutative50.0%

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

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

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

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

Alternative 4: 98.4% accurate, 0.1× speedup?

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

\\
\mathsf{fma}\left(z, t, a \cdot b + x \cdot y\right)
\end{array}
Derivation
  1. Initial program 95.3%

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(z, t, \mathsf{fma}\left(x, y, a \cdot b\right)\right)} \]
  4. Step-by-step derivation
    1. fma-udef96.9%

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

    \[\leadsto \mathsf{fma}\left(z, t, \color{blue}{x \cdot y + a \cdot b}\right) \]
  6. Final simplification96.9%

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

Alternative 5: 82.5% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot b + z \cdot t\\ t_2 := z \cdot t + x \cdot y\\ \mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+206}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \cdot t \leq -20000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \cdot t \leq -2 \cdot 10^{-110}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-13}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;z \cdot t \leq 2.6 \cdot 10^{+129}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (+ (* a b) (* z t))) (t_2 (+ (* z t) (* x y))))
   (if (<= (* z t) -1e+206)
     t_2
     (if (<= (* z t) -20000.0)
       t_1
       (if (<= (* z t) -2e-110)
         t_2
         (if (<= (* z t) 2e-13)
           (+ (* a b) (* x y))
           (if (<= (* z t) 2.6e+129) t_2 t_1)))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (a * b) + (z * t);
	double t_2 = (z * t) + (x * y);
	double tmp;
	if ((z * t) <= -1e+206) {
		tmp = t_2;
	} else if ((z * t) <= -20000.0) {
		tmp = t_1;
	} else if ((z * t) <= -2e-110) {
		tmp = t_2;
	} else if ((z * t) <= 2e-13) {
		tmp = (a * b) + (x * y);
	} else if ((z * t) <= 2.6e+129) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (a * b) + (z * t)
    t_2 = (z * t) + (x * y)
    if ((z * t) <= (-1d+206)) then
        tmp = t_2
    else if ((z * t) <= (-20000.0d0)) then
        tmp = t_1
    else if ((z * t) <= (-2d-110)) then
        tmp = t_2
    else if ((z * t) <= 2d-13) then
        tmp = (a * b) + (x * y)
    else if ((z * t) <= 2.6d+129) then
        tmp = t_2
    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 t_1 = (a * b) + (z * t);
	double t_2 = (z * t) + (x * y);
	double tmp;
	if ((z * t) <= -1e+206) {
		tmp = t_2;
	} else if ((z * t) <= -20000.0) {
		tmp = t_1;
	} else if ((z * t) <= -2e-110) {
		tmp = t_2;
	} else if ((z * t) <= 2e-13) {
		tmp = (a * b) + (x * y);
	} else if ((z * t) <= 2.6e+129) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = (a * b) + (z * t)
	t_2 = (z * t) + (x * y)
	tmp = 0
	if (z * t) <= -1e+206:
		tmp = t_2
	elif (z * t) <= -20000.0:
		tmp = t_1
	elif (z * t) <= -2e-110:
		tmp = t_2
	elif (z * t) <= 2e-13:
		tmp = (a * b) + (x * y)
	elif (z * t) <= 2.6e+129:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(a * b) + Float64(z * t))
	t_2 = Float64(Float64(z * t) + Float64(x * y))
	tmp = 0.0
	if (Float64(z * t) <= -1e+206)
		tmp = t_2;
	elseif (Float64(z * t) <= -20000.0)
		tmp = t_1;
	elseif (Float64(z * t) <= -2e-110)
		tmp = t_2;
	elseif (Float64(z * t) <= 2e-13)
		tmp = Float64(Float64(a * b) + Float64(x * y));
	elseif (Float64(z * t) <= 2.6e+129)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = (a * b) + (z * t);
	t_2 = (z * t) + (x * y);
	tmp = 0.0;
	if ((z * t) <= -1e+206)
		tmp = t_2;
	elseif ((z * t) <= -20000.0)
		tmp = t_1;
	elseif ((z * t) <= -2e-110)
		tmp = t_2;
	elseif ((z * t) <= 2e-13)
		tmp = (a * b) + (x * y);
	elseif ((z * t) <= 2.6e+129)
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -1e+206], t$95$2, If[LessEqual[N[(z * t), $MachinePrecision], -20000.0], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], -2e-110], t$95$2, If[LessEqual[N[(z * t), $MachinePrecision], 2e-13], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2.6e+129], t$95$2, t$95$1]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \cdot t \leq -20000:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \cdot t \leq -2 \cdot 10^{-110}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;z \cdot t \leq 2.6 \cdot 10^{+129}:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z t) < -1e206 or -2e4 < (*.f64 z t) < -2.0000000000000001e-110 or 2.0000000000000001e-13 < (*.f64 z t) < 2.60000000000000012e129

    1. Initial program 94.3%

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

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

    if -1e206 < (*.f64 z t) < -2e4 or 2.60000000000000012e129 < (*.f64 z t)

    1. Initial program 91.3%

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

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

    if -2.0000000000000001e-110 < (*.f64 z t) < 2.0000000000000001e-13

    1. Initial program 99.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+206}:\\ \;\;\;\;z \cdot t + x \cdot y\\ \mathbf{elif}\;z \cdot t \leq -20000:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;z \cdot t \leq -2 \cdot 10^{-110}:\\ \;\;\;\;z \cdot t + x \cdot y\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-13}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;z \cdot t \leq 2.6 \cdot 10^{+129}:\\ \;\;\;\;z \cdot t + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \end{array} \]

Alternative 6: 52.6% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;a \cdot b \leq -3.35 \cdot 10^{+117}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;a \cdot b \leq -2.2 \cdot 10^{+77}:\\
\;\;\;\;a \cdot b\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -1.1e141 or -3.3499999999999999e117 < (*.f64 a b) < -2.2e77 or 8.7999999999999997e129 < (*.f64 a b)

    1. Initial program 91.0%

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

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

    if -1.1e141 < (*.f64 a b) < -3.3499999999999999e117 or 3.1000000000000001e-148 < (*.f64 a b) < 8.7999999999999997e129

    1. Initial program 96.3%

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

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

    if -2.2e77 < (*.f64 a b) < 3.1000000000000001e-148

    1. Initial program 98.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.1 \cdot 10^{+141}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -3.35 \cdot 10^{+117}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq -2.2 \cdot 10^{+77}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq 3.1 \cdot 10^{-148}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 8.8 \cdot 10^{+129}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]

Alternative 7: 98.6% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 100.0%

      \[\left(x \cdot y + z \cdot t\right) + a \cdot b \]

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

    1. Initial program 0.0%

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

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

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

Alternative 8: 78.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{+132} \lor \neg \left(x \leq 7.5 \cdot 10^{-54}\right):\\
\;\;\;\;a \cdot b + x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.4999999999999999e132 or 7.5000000000000005e-54 < x

    1. Initial program 91.1%

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

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

    if -1.4999999999999999e132 < x < 7.5000000000000005e-54

    1. Initial program 98.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{+132} \lor \neg \left(x \leq 7.5 \cdot 10^{-54}\right):\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \end{array} \]

Alternative 9: 53.9% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -7.1999999999999996e77 or 4.1699999999999998e30 < (*.f64 a b)

    1. Initial program 91.7%

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

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

    if -7.1999999999999996e77 < (*.f64 a b) < 4.1699999999999998e30

    1. Initial program 97.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -7.2 \cdot 10^{+77}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq 4.17 \cdot 10^{+30}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]

Alternative 10: 70.6% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;y \leq 7 \cdot 10^{+114}:\\
\;\;\;\;a \cdot b + z \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.3e17 or 7.0000000000000001e114 < y

    1. Initial program 92.1%

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

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

    if -2.3e17 < y < 7.0000000000000001e114

    1. Initial program 97.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.3 \cdot 10^{+17}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+114}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]

Alternative 11: 35.4% accurate, 3.7× speedup?

\[\begin{array}{l} \\ a \cdot b \end{array} \]
(FPCore (x y z t a b) :precision binary64 (* a b))
double code(double x, double y, double z, double t, double a, double b) {
	return a * b;
}
real(8) function code(x, y, z, t, a, b)
    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
    code = a * b
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return a * b;
}
def code(x, y, z, t, a, b):
	return a * b
function code(x, y, z, t, a, b)
	return Float64(a * b)
end
function tmp = code(x, y, z, t, a, b)
	tmp = a * b;
end
code[x_, y_, z_, t_, a_, b_] := N[(a * b), $MachinePrecision]
\begin{array}{l}

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

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

    \[\leadsto \color{blue}{a \cdot b} \]
  3. Final simplification32.6%

    \[\leadsto a \cdot b \]

Reproduce

?
herbie shell --seed 2023224 
(FPCore (x y z t a b)
  :name "Linear.V3:$cdot from linear-1.19.1.3, B"
  :precision binary64
  (+ (+ (* x y) (* z t)) (* a b)))