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

Percentage Accurate: 96.0% → 98.1%
Time: 8.2s
Alternatives: 16
Speedup: 0.5×

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 16 alternatives:

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

Initial Program: 96.0% 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.1% accurate, 0.0× speedup?

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

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

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

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

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

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

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

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

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

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

Alternative 2: 97.9% accurate, 0.0× speedup?

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

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

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

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

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

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

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

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

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

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

Alternative 3: 97.7% accurate, 0.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, c, a \cdot b\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 \]

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

    1. Initial program 0.0%

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

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

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

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

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

      \[\leadsto \color{blue}{c \cdot i + a \cdot b} \]
    6. Step-by-step derivation
      1. *-commutative55.6%

        \[\leadsto \color{blue}{i \cdot c} + a \cdot b \]
      2. fma-def55.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, a \cdot b\right)} \]
    7. Applied egg-rr55.6%

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

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

Alternative 4: 96.3% accurate, 0.1× speedup?

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

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

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

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

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

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

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

Alternative 5: 66.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot b + x \cdot y\\ t_2 := a \cdot b + z \cdot t\\ t_3 := c \cdot i + a \cdot b\\ \mathbf{if}\;c \cdot i \leq -7.4 \cdot 10^{+45}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;c \cdot i \leq -1.9 \cdot 10^{-20}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq -1.9 \cdot 10^{-191}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq 1.4 \cdot 10^{-304}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \cdot i \leq 4.7 \cdot 10^{-119}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \cdot i \leq 4.3 \cdot 10^{+25}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* a b) (* x y)))
        (t_2 (+ (* a b) (* z t)))
        (t_3 (+ (* c i) (* a b))))
   (if (<= (* c i) -7.4e+45)
     t_3
     (if (<= (* c i) -1.9e-20)
       t_1
       (if (<= (* c i) -1.9e-191)
         t_2
         (if (<= (* c i) 1.4e-304)
           t_1
           (if (<= (* c i) 4.7e-119)
             t_2
             (if (<= (* c i) 4.3e+25) t_1 t_3))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (a * b) + (x * y);
	double t_2 = (a * b) + (z * t);
	double t_3 = (c * i) + (a * b);
	double tmp;
	if ((c * i) <= -7.4e+45) {
		tmp = t_3;
	} else if ((c * i) <= -1.9e-20) {
		tmp = t_1;
	} else if ((c * i) <= -1.9e-191) {
		tmp = t_2;
	} else if ((c * i) <= 1.4e-304) {
		tmp = t_1;
	} else if ((c * i) <= 4.7e-119) {
		tmp = t_2;
	} else if ((c * i) <= 4.3e+25) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = (a * b) + (x * y)
    t_2 = (a * b) + (z * t)
    t_3 = (c * i) + (a * b)
    if ((c * i) <= (-7.4d+45)) then
        tmp = t_3
    else if ((c * i) <= (-1.9d-20)) then
        tmp = t_1
    else if ((c * i) <= (-1.9d-191)) then
        tmp = t_2
    else if ((c * i) <= 1.4d-304) then
        tmp = t_1
    else if ((c * i) <= 4.7d-119) then
        tmp = t_2
    else if ((c * i) <= 4.3d+25) then
        tmp = t_1
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (a * b) + (x * y);
	double t_2 = (a * b) + (z * t);
	double t_3 = (c * i) + (a * b);
	double tmp;
	if ((c * i) <= -7.4e+45) {
		tmp = t_3;
	} else if ((c * i) <= -1.9e-20) {
		tmp = t_1;
	} else if ((c * i) <= -1.9e-191) {
		tmp = t_2;
	} else if ((c * i) <= 1.4e-304) {
		tmp = t_1;
	} else if ((c * i) <= 4.7e-119) {
		tmp = t_2;
	} else if ((c * i) <= 4.3e+25) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (a * b) + (x * y)
	t_2 = (a * b) + (z * t)
	t_3 = (c * i) + (a * b)
	tmp = 0
	if (c * i) <= -7.4e+45:
		tmp = t_3
	elif (c * i) <= -1.9e-20:
		tmp = t_1
	elif (c * i) <= -1.9e-191:
		tmp = t_2
	elif (c * i) <= 1.4e-304:
		tmp = t_1
	elif (c * i) <= 4.7e-119:
		tmp = t_2
	elif (c * i) <= 4.3e+25:
		tmp = t_1
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(a * b) + Float64(x * y))
	t_2 = Float64(Float64(a * b) + Float64(z * t))
	t_3 = Float64(Float64(c * i) + Float64(a * b))
	tmp = 0.0
	if (Float64(c * i) <= -7.4e+45)
		tmp = t_3;
	elseif (Float64(c * i) <= -1.9e-20)
		tmp = t_1;
	elseif (Float64(c * i) <= -1.9e-191)
		tmp = t_2;
	elseif (Float64(c * i) <= 1.4e-304)
		tmp = t_1;
	elseif (Float64(c * i) <= 4.7e-119)
		tmp = t_2;
	elseif (Float64(c * i) <= 4.3e+25)
		tmp = t_1;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (a * b) + (x * y);
	t_2 = (a * b) + (z * t);
	t_3 = (c * i) + (a * b);
	tmp = 0.0;
	if ((c * i) <= -7.4e+45)
		tmp = t_3;
	elseif ((c * i) <= -1.9e-20)
		tmp = t_1;
	elseif ((c * i) <= -1.9e-191)
		tmp = t_2;
	elseif ((c * i) <= 1.4e-304)
		tmp = t_1;
	elseif ((c * i) <= 4.7e-119)
		tmp = t_2;
	elseif ((c * i) <= 4.3e+25)
		tmp = t_1;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(c * i), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -7.4e+45], t$95$3, If[LessEqual[N[(c * i), $MachinePrecision], -1.9e-20], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], -1.9e-191], t$95$2, If[LessEqual[N[(c * i), $MachinePrecision], 1.4e-304], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], 4.7e-119], t$95$2, If[LessEqual[N[(c * i), $MachinePrecision], 4.3e+25], t$95$1, t$95$3]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;c \cdot i \leq -1.9 \cdot 10^{-20}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;c \cdot i \leq -1.9 \cdot 10^{-191}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;c \cdot i \leq 1.4 \cdot 10^{-304}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;c \cdot i \leq 4.7 \cdot 10^{-119}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;c \cdot i \leq 4.3 \cdot 10^{+25}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 c i) < -7.39999999999999954e45 or 4.29999999999999998e25 < (*.f64 c i)

    1. Initial program 94.1%

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

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

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

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

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

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

    if -7.39999999999999954e45 < (*.f64 c i) < -1.8999999999999999e-20 or -1.8999999999999999e-191 < (*.f64 c i) < 1.3999999999999999e-304 or 4.70000000000000002e-119 < (*.f64 c i) < 4.29999999999999998e25

    1. Initial program 96.9%

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

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

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

    if -1.8999999999999999e-20 < (*.f64 c i) < -1.8999999999999999e-191 or 1.3999999999999999e-304 < (*.f64 c i) < 4.70000000000000002e-119

    1. Initial program 100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -7.4 \cdot 10^{+45}:\\ \;\;\;\;c \cdot i + a \cdot b\\ \mathbf{elif}\;c \cdot i \leq -1.9 \cdot 10^{-20}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;c \cdot i \leq -1.9 \cdot 10^{-191}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;c \cdot i \leq 1.4 \cdot 10^{-304}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;c \cdot i \leq 4.7 \cdot 10^{-119}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;c \cdot i \leq 4.3 \cdot 10^{+25}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c \cdot i + a \cdot b\\ \end{array} \]

Alternative 6: 64.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := c \cdot i + x \cdot y\\ t_2 := c \cdot i + z \cdot t\\ t_3 := c \cdot i + a \cdot b\\ \mathbf{if}\;a \cdot b \leq -5.4 \cdot 10^{+172}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \cdot b \leq -1.2 \cdot 10^{+157}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq -1.65 \cdot 10^{-39}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 2.55 \cdot 10^{-230}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 1.25 \cdot 10^{-179}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq 5.5 \cdot 10^{+95}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* c i) (* x y)))
        (t_2 (+ (* c i) (* z t)))
        (t_3 (+ (* c i) (* a b))))
   (if (<= (* a b) -5.4e+172)
     t_3
     (if (<= (* a b) -1.2e+157)
       t_2
       (if (<= (* a b) -1.65e-39)
         (+ (* a b) (* x y))
         (if (<= (* a b) 2.55e-230)
           t_1
           (if (<= (* a b) 1.25e-179)
             t_2
             (if (<= (* a b) 5.5e+95) t_1 t_3))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (c * i) + (x * y);
	double t_2 = (c * i) + (z * t);
	double t_3 = (c * i) + (a * b);
	double tmp;
	if ((a * b) <= -5.4e+172) {
		tmp = t_3;
	} else if ((a * b) <= -1.2e+157) {
		tmp = t_2;
	} else if ((a * b) <= -1.65e-39) {
		tmp = (a * b) + (x * y);
	} else if ((a * b) <= 2.55e-230) {
		tmp = t_1;
	} else if ((a * b) <= 1.25e-179) {
		tmp = t_2;
	} else if ((a * b) <= 5.5e+95) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = (c * i) + (x * y)
    t_2 = (c * i) + (z * t)
    t_3 = (c * i) + (a * b)
    if ((a * b) <= (-5.4d+172)) then
        tmp = t_3
    else if ((a * b) <= (-1.2d+157)) then
        tmp = t_2
    else if ((a * b) <= (-1.65d-39)) then
        tmp = (a * b) + (x * y)
    else if ((a * b) <= 2.55d-230) then
        tmp = t_1
    else if ((a * b) <= 1.25d-179) then
        tmp = t_2
    else if ((a * b) <= 5.5d+95) then
        tmp = t_1
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (c * i) + (x * y);
	double t_2 = (c * i) + (z * t);
	double t_3 = (c * i) + (a * b);
	double tmp;
	if ((a * b) <= -5.4e+172) {
		tmp = t_3;
	} else if ((a * b) <= -1.2e+157) {
		tmp = t_2;
	} else if ((a * b) <= -1.65e-39) {
		tmp = (a * b) + (x * y);
	} else if ((a * b) <= 2.55e-230) {
		tmp = t_1;
	} else if ((a * b) <= 1.25e-179) {
		tmp = t_2;
	} else if ((a * b) <= 5.5e+95) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (c * i) + (x * y)
	t_2 = (c * i) + (z * t)
	t_3 = (c * i) + (a * b)
	tmp = 0
	if (a * b) <= -5.4e+172:
		tmp = t_3
	elif (a * b) <= -1.2e+157:
		tmp = t_2
	elif (a * b) <= -1.65e-39:
		tmp = (a * b) + (x * y)
	elif (a * b) <= 2.55e-230:
		tmp = t_1
	elif (a * b) <= 1.25e-179:
		tmp = t_2
	elif (a * b) <= 5.5e+95:
		tmp = t_1
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(c * i) + Float64(x * y))
	t_2 = Float64(Float64(c * i) + Float64(z * t))
	t_3 = Float64(Float64(c * i) + Float64(a * b))
	tmp = 0.0
	if (Float64(a * b) <= -5.4e+172)
		tmp = t_3;
	elseif (Float64(a * b) <= -1.2e+157)
		tmp = t_2;
	elseif (Float64(a * b) <= -1.65e-39)
		tmp = Float64(Float64(a * b) + Float64(x * y));
	elseif (Float64(a * b) <= 2.55e-230)
		tmp = t_1;
	elseif (Float64(a * b) <= 1.25e-179)
		tmp = t_2;
	elseif (Float64(a * b) <= 5.5e+95)
		tmp = t_1;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (c * i) + (x * y);
	t_2 = (c * i) + (z * t);
	t_3 = (c * i) + (a * b);
	tmp = 0.0;
	if ((a * b) <= -5.4e+172)
		tmp = t_3;
	elseif ((a * b) <= -1.2e+157)
		tmp = t_2;
	elseif ((a * b) <= -1.65e-39)
		tmp = (a * b) + (x * y);
	elseif ((a * b) <= 2.55e-230)
		tmp = t_1;
	elseif ((a * b) <= 1.25e-179)
		tmp = t_2;
	elseif ((a * b) <= 5.5e+95)
		tmp = t_1;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(c * i), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(c * i), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -5.4e+172], t$95$3, If[LessEqual[N[(a * b), $MachinePrecision], -1.2e+157], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], -1.65e-39], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2.55e-230], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 1.25e-179], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], 5.5e+95], t$95$1, t$95$3]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;a \cdot b \leq -1.2 \cdot 10^{+157}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;a \cdot b \leq 2.55 \cdot 10^{-230}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;a \cdot b \leq 1.25 \cdot 10^{-179}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;a \cdot b \leq 5.5 \cdot 10^{+95}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 a b) < -5.4e172 or 5.4999999999999997e95 < (*.f64 a b)

    1. Initial program 92.2%

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

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

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

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

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

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

    if -5.4e172 < (*.f64 a b) < -1.2e157 or 2.5499999999999999e-230 < (*.f64 a b) < 1.2499999999999999e-179

    1. Initial program 100.0%

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

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

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

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

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

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

    if -1.2e157 < (*.f64 a b) < -1.64999999999999992e-39

    1. Initial program 96.9%

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

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

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

    if -1.64999999999999992e-39 < (*.f64 a b) < 2.5499999999999999e-230 or 1.2499999999999999e-179 < (*.f64 a b) < 5.4999999999999997e95

    1. Initial program 98.5%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -5.4 \cdot 10^{+172}:\\ \;\;\;\;c \cdot i + a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -1.2 \cdot 10^{+157}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq -1.65 \cdot 10^{-39}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 2.55 \cdot 10^{-230}:\\ \;\;\;\;c \cdot i + x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 1.25 \cdot 10^{-179}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \mathbf{elif}\;a \cdot b \leq 5.5 \cdot 10^{+95}:\\ \;\;\;\;c \cdot i + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c \cdot i + a \cdot b\\ \end{array} \]

Alternative 7: 97.3% accurate, 0.5× speedup?

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

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

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


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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

Alternative 8: 42.2% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;a \cdot b \leq -7.1 \cdot 10^{+118}:\\
\;\;\;\;z \cdot t\\

\mathbf{elif}\;a \cdot b \leq -1.3 \cdot 10^{+70}:\\
\;\;\;\;a \cdot b\\

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 a b) < -5.39999999999999959e176 or -7.0999999999999997e118 < (*.f64 a b) < -1.3e70 or 6.99999999999999999e95 < (*.f64 a b)

    1. Initial program 91.7%

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

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

    if -5.39999999999999959e176 < (*.f64 a b) < -7.0999999999999997e118

    1. Initial program 99.9%

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

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

    if -1.3e70 < (*.f64 a b) < -1.01999999999999992e-154 or 7.2000000000000004e-256 < (*.f64 a b) < 6.99999999999999999e95

    1. Initial program 99.1%

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

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

    if -1.01999999999999992e-154 < (*.f64 a b) < 7.2000000000000004e-256

    1. Initial program 98.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -5.4 \cdot 10^{+176}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -7.1 \cdot 10^{+118}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;a \cdot b \leq -1.3 \cdot 10^{+70}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;a \cdot b \leq -1.02 \cdot 10^{-154}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 7.2 \cdot 10^{-256}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;a \cdot b \leq 7 \cdot 10^{+95}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]

Alternative 9: 62.0% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;c \cdot i \leq -1.75 \cdot 10^{-250}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;c \cdot i \leq 3.5 \cdot 10^{+113}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 c i) < -1.55000000000000007e62 or 3.5000000000000001e113 < (*.f64 c i)

    1. Initial program 95.0%

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

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

    if -1.55000000000000007e62 < (*.f64 c i) < -1.7499999999999999e-250 or -2.5000000000000001e-293 < (*.f64 c i) < 3.5000000000000001e113

    1. Initial program 97.0%

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

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

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

    if -1.7499999999999999e-250 < (*.f64 c i) < -2.5000000000000001e-293

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1.55 \cdot 10^{+62}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq -1.75 \cdot 10^{-250}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;c \cdot i \leq -2.5 \cdot 10^{-293}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \cdot i \leq 3.5 \cdot 10^{+113}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]

Alternative 10: 88.1% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.95 \cdot 10^{+46}:\\
\;\;\;\;c \cdot i + \left(a \cdot b + x \cdot y\right)\\

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

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


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

    1. Initial program 97.5%

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

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

    if -1.94999999999999997e46 < (*.f64 c i) < 6.1000000000000003e25

    1. Initial program 98.1%

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

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

    if 6.1000000000000003e25 < (*.f64 c i)

    1. Initial program 91.7%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1.95 \cdot 10^{+46}:\\ \;\;\;\;c \cdot i + \left(a \cdot b + x \cdot y\right)\\ \mathbf{elif}\;c \cdot i \leq 6.1 \cdot 10^{+25}:\\ \;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + \left(c \cdot i + z \cdot t\right)\\ \end{array} \]

Alternative 11: 75.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_1 := c \cdot i + z \cdot t\\
\mathbf{if}\;y \leq -4.2 \cdot 10^{-53}:\\
\;\;\;\;c \cdot i + x \cdot y\\

\mathbf{elif}\;y \leq 7.5 \cdot 10^{+90}:\\
\;\;\;\;a \cdot b + t_1\\

\mathbf{elif}\;y \leq 1.7 \cdot 10^{+248} \lor \neg \left(y \leq 2.8 \cdot 10^{+258}\right):\\
\;\;\;\;a \cdot b + x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -4.19999999999999955e-53

    1. Initial program 96.2%

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

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

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

    if -4.19999999999999955e-53 < y < 7.50000000000000014e90

    1. Initial program 98.4%

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

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

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

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

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

    if 7.50000000000000014e90 < y < 1.7e248 or 2.79999999999999982e258 < y

    1. Initial program 93.8%

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

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

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

    if 1.7e248 < y < 2.79999999999999982e258

    1. Initial program 66.7%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.2 \cdot 10^{-53}:\\ \;\;\;\;c \cdot i + x \cdot y\\ \mathbf{elif}\;y \leq 7.5 \cdot 10^{+90}:\\ \;\;\;\;a \cdot b + \left(c \cdot i + z \cdot t\right)\\ \mathbf{elif}\;y \leq 1.7 \cdot 10^{+248} \lor \neg \left(y \leq 2.8 \cdot 10^{+258}\right):\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c \cdot i + z \cdot t\\ \end{array} \]

Alternative 12: 59.3% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;y \leq -5 \cdot 10^{-260}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -8.3 \cdot 10^{-308}:\\
\;\;\;\;c \cdot i\\

\mathbf{elif}\;y \leq 9.6 \cdot 10^{+45}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.82000000000000007e-56 or 9.59999999999999958e45 < y

    1. Initial program 94.9%

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

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

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

    if -1.82000000000000007e-56 < y < -5.0000000000000003e-260 or -8.30000000000000033e-308 < y < 9.59999999999999958e45

    1. Initial program 98.1%

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

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

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

    if -5.0000000000000003e-260 < y < -8.30000000000000033e-308

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.82 \cdot 10^{-56}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \mathbf{elif}\;y \leq -5 \cdot 10^{-260}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{elif}\;y \leq -8.3 \cdot 10^{-308}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;y \leq 9.6 \cdot 10^{+45}:\\ \;\;\;\;a \cdot b + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + x \cdot y\\ \end{array} \]

Alternative 13: 77.8% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -6.20000000000000044e135

    1. Initial program 97.1%

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

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

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

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

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

    if -6.20000000000000044e135 < c < 1.1499999999999999e-35

    1. Initial program 96.7%

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

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

    if 1.1499999999999999e-35 < c

    1. Initial program 95.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -6.2 \cdot 10^{+135}:\\ \;\;\;\;a \cdot b + \left(c \cdot i + z \cdot t\right)\\ \mathbf{elif}\;c \leq 1.15 \cdot 10^{-35}:\\ \;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;c \cdot i + x \cdot y\\ \end{array} \]

Alternative 14: 36.7% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;c \leq -1.8 \cdot 10^{-48}:\\
\;\;\;\;a \cdot b\\

\mathbf{elif}\;c \leq 1.75 \cdot 10^{-257}:\\
\;\;\;\;z \cdot t\\

\mathbf{elif}\;c \leq 10^{-35}:\\
\;\;\;\;a \cdot b\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -7.5000000000000002e136 or 1.00000000000000001e-35 < c

    1. Initial program 96.0%

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

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

    if -7.5000000000000002e136 < c < -1.8000000000000001e-48 or 1.75000000000000015e-257 < c < 1.00000000000000001e-35

    1. Initial program 97.8%

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

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

    if -1.8000000000000001e-48 < c < 1.75000000000000015e-257

    1. Initial program 95.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -7.5 \cdot 10^{+136}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \leq -1.8 \cdot 10^{-48}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \leq 1.75 \cdot 10^{-257}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;c \leq 10^{-35}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]

Alternative 15: 43.3% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c i) < -3.90000000000000027e55 or 8.19999999999999951e112 < (*.f64 c i)

    1. Initial program 95.0%

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

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

    if -3.90000000000000027e55 < (*.f64 c i) < 8.19999999999999951e112

    1. Initial program 97.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -3.9 \cdot 10^{+55}:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq 8.2 \cdot 10^{+112}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]

Alternative 16: 27.2% accurate, 5.0× speedup?

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

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

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

    \[\leadsto \color{blue}{a \cdot b} \]
  3. Final simplification28.8%

    \[\leadsto a \cdot b \]

Reproduce

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