Diagrams.ThreeD.Shapes:frustum from diagrams-lib-1.3.0.3, A

Percentage Accurate: 90.0% → 92.8%
Time: 13.3s
Alternatives: 12
Speedup: 0.5×

Specification

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

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

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

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

Alternative 1: 92.8% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(c \cdot \left(t\_1 \cdot i\right)\right)\\


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

    1. Initial program 98.3%

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

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

    1. Initial program 0.0%

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

      \[\leadsto 2 \cdot \color{blue}{\left(-1 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)\right)} \]
    4. Taylor expanded in i around 0 69.5%

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

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

Alternative 2: 41.4% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(i \cdot \left(c \cdot \left(-a\right)\right)\right)\\ t_2 := 2 \cdot \left(z \cdot t\right)\\ t_3 := \left(x \cdot y\right) \cdot 2\\ \mathbf{if}\;x \cdot y \leq -7 \cdot 10^{+143}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;x \cdot y \leq -2.75 \cdot 10^{-102}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 1.3 \cdot 10^{-183}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{-25}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 1.05 \cdot 10^{+216}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (* 2.0 (* i (* c (- a)))))
        (t_2 (* 2.0 (* z t)))
        (t_3 (* (* x y) 2.0)))
   (if (<= (* x y) -7e+143)
     t_3
     (if (<= (* x y) -2.75e-102)
       t_1
       (if (<= (* x y) 1.3e-183)
         t_2
         (if (<= (* x y) 4e-25) t_1 (if (<= (* x y) 1.05e+216) t_2 t_3)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = 2.0 * (i * (c * -a));
	double t_2 = 2.0 * (z * t);
	double t_3 = (x * y) * 2.0;
	double tmp;
	if ((x * y) <= -7e+143) {
		tmp = t_3;
	} else if ((x * y) <= -2.75e-102) {
		tmp = t_1;
	} else if ((x * y) <= 1.3e-183) {
		tmp = t_2;
	} else if ((x * y) <= 4e-25) {
		tmp = t_1;
	} else if ((x * y) <= 1.05e+216) {
		tmp = t_2;
	} 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 = 2.0d0 * (i * (c * -a))
    t_2 = 2.0d0 * (z * t)
    t_3 = (x * y) * 2.0d0
    if ((x * y) <= (-7d+143)) then
        tmp = t_3
    else if ((x * y) <= (-2.75d-102)) then
        tmp = t_1
    else if ((x * y) <= 1.3d-183) then
        tmp = t_2
    else if ((x * y) <= 4d-25) then
        tmp = t_1
    else if ((x * y) <= 1.05d+216) then
        tmp = t_2
    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 = 2.0 * (i * (c * -a));
	double t_2 = 2.0 * (z * t);
	double t_3 = (x * y) * 2.0;
	double tmp;
	if ((x * y) <= -7e+143) {
		tmp = t_3;
	} else if ((x * y) <= -2.75e-102) {
		tmp = t_1;
	} else if ((x * y) <= 1.3e-183) {
		tmp = t_2;
	} else if ((x * y) <= 4e-25) {
		tmp = t_1;
	} else if ((x * y) <= 1.05e+216) {
		tmp = t_2;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = 2.0 * (i * (c * -a))
	t_2 = 2.0 * (z * t)
	t_3 = (x * y) * 2.0
	tmp = 0
	if (x * y) <= -7e+143:
		tmp = t_3
	elif (x * y) <= -2.75e-102:
		tmp = t_1
	elif (x * y) <= 1.3e-183:
		tmp = t_2
	elif (x * y) <= 4e-25:
		tmp = t_1
	elif (x * y) <= 1.05e+216:
		tmp = t_2
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(2.0 * Float64(i * Float64(c * Float64(-a))))
	t_2 = Float64(2.0 * Float64(z * t))
	t_3 = Float64(Float64(x * y) * 2.0)
	tmp = 0.0
	if (Float64(x * y) <= -7e+143)
		tmp = t_3;
	elseif (Float64(x * y) <= -2.75e-102)
		tmp = t_1;
	elseif (Float64(x * y) <= 1.3e-183)
		tmp = t_2;
	elseif (Float64(x * y) <= 4e-25)
		tmp = t_1;
	elseif (Float64(x * y) <= 1.05e+216)
		tmp = t_2;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = 2.0 * (i * (c * -a));
	t_2 = 2.0 * (z * t);
	t_3 = (x * y) * 2.0;
	tmp = 0.0;
	if ((x * y) <= -7e+143)
		tmp = t_3;
	elseif ((x * y) <= -2.75e-102)
		tmp = t_1;
	elseif ((x * y) <= 1.3e-183)
		tmp = t_2;
	elseif ((x * y) <= 4e-25)
		tmp = t_1;
	elseif ((x * y) <= 1.05e+216)
		tmp = t_2;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(2.0 * N[(i * N[(c * (-a)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x * y), $MachinePrecision] * 2.0), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -7e+143], t$95$3, If[LessEqual[N[(x * y), $MachinePrecision], -2.75e-102], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1.3e-183], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 4e-25], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1.05e+216], t$95$2, t$95$3]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := 2 \cdot \left(i \cdot \left(c \cdot \left(-a\right)\right)\right)\\
t_2 := 2 \cdot \left(z \cdot t\right)\\
t_3 := \left(x \cdot y\right) \cdot 2\\
\mathbf{if}\;x \cdot y \leq -7 \cdot 10^{+143}:\\
\;\;\;\;t\_3\\

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

\mathbf{elif}\;x \cdot y \leq 1.3 \cdot 10^{-183}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;x \cdot y \leq 1.05 \cdot 10^{+216}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -7.00000000000000017e143 or 1.05000000000000001e216 < (*.f64 x y)

    1. Initial program 82.7%

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

      \[\leadsto 2 \cdot \color{blue}{\left(x \cdot y\right)} \]

    if -7.00000000000000017e143 < (*.f64 x y) < -2.7499999999999999e-102 or 1.2999999999999999e-183 < (*.f64 x y) < 4.00000000000000015e-25

    1. Initial program 97.1%

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

      \[\leadsto 2 \cdot \color{blue}{\left(i \cdot \left(\left(\frac{t \cdot z}{i} + \frac{x \cdot y}{i}\right) - c \cdot \left(a + b \cdot c\right)\right)\right)} \]
    4. Step-by-step derivation
      1. associate--l+91.5%

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

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

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

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

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

      \[\leadsto 2 \cdot \color{blue}{\left(i \cdot \left(t \cdot \frac{z}{i} + \left(x \cdot \frac{y}{i} - c \cdot \mathsf{fma}\left(b, c, a\right)\right)\right)\right)} \]
    6. Taylor expanded in a around inf 47.1%

      \[\leadsto 2 \cdot \left(i \cdot \color{blue}{\left(-1 \cdot \left(a \cdot c\right)\right)}\right) \]
    7. Step-by-step derivation
      1. associate-*r*47.1%

        \[\leadsto 2 \cdot \left(i \cdot \color{blue}{\left(\left(-1 \cdot a\right) \cdot c\right)}\right) \]
      2. mul-1-neg47.1%

        \[\leadsto 2 \cdot \left(i \cdot \left(\color{blue}{\left(-a\right)} \cdot c\right)\right) \]
    8. Simplified47.1%

      \[\leadsto 2 \cdot \left(i \cdot \color{blue}{\left(\left(-a\right) \cdot c\right)}\right) \]

    if -2.7499999999999999e-102 < (*.f64 x y) < 1.2999999999999999e-183 or 4.00000000000000015e-25 < (*.f64 x y) < 1.05000000000000001e216

    1. Initial program 96.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -7 \cdot 10^{+143}:\\ \;\;\;\;\left(x \cdot y\right) \cdot 2\\ \mathbf{elif}\;x \cdot y \leq -2.75 \cdot 10^{-102}:\\ \;\;\;\;2 \cdot \left(i \cdot \left(c \cdot \left(-a\right)\right)\right)\\ \mathbf{elif}\;x \cdot y \leq 1.3 \cdot 10^{-183}:\\ \;\;\;\;2 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{-25}:\\ \;\;\;\;2 \cdot \left(i \cdot \left(c \cdot \left(-a\right)\right)\right)\\ \mathbf{elif}\;x \cdot y \leq 1.05 \cdot 10^{+216}:\\ \;\;\;\;2 \cdot \left(z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y\right) \cdot 2\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 42.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := -2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\ t_2 := 2 \cdot \left(z \cdot t\right)\\ t_3 := \left(x \cdot y\right) \cdot 2\\ \mathbf{if}\;x \cdot y \leq -1.22 \cdot 10^{+145}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;x \cdot y \leq -5.5 \cdot 10^{-102}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 2.6 \cdot 10^{-179}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \cdot y \leq 9.7 \cdot 10^{-26}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 5.8 \cdot 10^{+213}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (* -2.0 (* a (* c i))))
        (t_2 (* 2.0 (* z t)))
        (t_3 (* (* x y) 2.0)))
   (if (<= (* x y) -1.22e+145)
     t_3
     (if (<= (* x y) -5.5e-102)
       t_1
       (if (<= (* x y) 2.6e-179)
         t_2
         (if (<= (* x y) 9.7e-26) t_1 (if (<= (* x y) 5.8e+213) t_2 t_3)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = -2.0 * (a * (c * i));
	double t_2 = 2.0 * (z * t);
	double t_3 = (x * y) * 2.0;
	double tmp;
	if ((x * y) <= -1.22e+145) {
		tmp = t_3;
	} else if ((x * y) <= -5.5e-102) {
		tmp = t_1;
	} else if ((x * y) <= 2.6e-179) {
		tmp = t_2;
	} else if ((x * y) <= 9.7e-26) {
		tmp = t_1;
	} else if ((x * y) <= 5.8e+213) {
		tmp = t_2;
	} 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 = (-2.0d0) * (a * (c * i))
    t_2 = 2.0d0 * (z * t)
    t_3 = (x * y) * 2.0d0
    if ((x * y) <= (-1.22d+145)) then
        tmp = t_3
    else if ((x * y) <= (-5.5d-102)) then
        tmp = t_1
    else if ((x * y) <= 2.6d-179) then
        tmp = t_2
    else if ((x * y) <= 9.7d-26) then
        tmp = t_1
    else if ((x * y) <= 5.8d+213) then
        tmp = t_2
    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 = -2.0 * (a * (c * i));
	double t_2 = 2.0 * (z * t);
	double t_3 = (x * y) * 2.0;
	double tmp;
	if ((x * y) <= -1.22e+145) {
		tmp = t_3;
	} else if ((x * y) <= -5.5e-102) {
		tmp = t_1;
	} else if ((x * y) <= 2.6e-179) {
		tmp = t_2;
	} else if ((x * y) <= 9.7e-26) {
		tmp = t_1;
	} else if ((x * y) <= 5.8e+213) {
		tmp = t_2;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = -2.0 * (a * (c * i))
	t_2 = 2.0 * (z * t)
	t_3 = (x * y) * 2.0
	tmp = 0
	if (x * y) <= -1.22e+145:
		tmp = t_3
	elif (x * y) <= -5.5e-102:
		tmp = t_1
	elif (x * y) <= 2.6e-179:
		tmp = t_2
	elif (x * y) <= 9.7e-26:
		tmp = t_1
	elif (x * y) <= 5.8e+213:
		tmp = t_2
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(-2.0 * Float64(a * Float64(c * i)))
	t_2 = Float64(2.0 * Float64(z * t))
	t_3 = Float64(Float64(x * y) * 2.0)
	tmp = 0.0
	if (Float64(x * y) <= -1.22e+145)
		tmp = t_3;
	elseif (Float64(x * y) <= -5.5e-102)
		tmp = t_1;
	elseif (Float64(x * y) <= 2.6e-179)
		tmp = t_2;
	elseif (Float64(x * y) <= 9.7e-26)
		tmp = t_1;
	elseif (Float64(x * y) <= 5.8e+213)
		tmp = t_2;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = -2.0 * (a * (c * i));
	t_2 = 2.0 * (z * t);
	t_3 = (x * y) * 2.0;
	tmp = 0.0;
	if ((x * y) <= -1.22e+145)
		tmp = t_3;
	elseif ((x * y) <= -5.5e-102)
		tmp = t_1;
	elseif ((x * y) <= 2.6e-179)
		tmp = t_2;
	elseif ((x * y) <= 9.7e-26)
		tmp = t_1;
	elseif ((x * y) <= 5.8e+213)
		tmp = t_2;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(-2.0 * N[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x * y), $MachinePrecision] * 2.0), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -1.22e+145], t$95$3, If[LessEqual[N[(x * y), $MachinePrecision], -5.5e-102], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2.6e-179], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 9.7e-26], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5.8e+213], t$95$2, t$95$3]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := -2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\
t_2 := 2 \cdot \left(z \cdot t\right)\\
t_3 := \left(x \cdot y\right) \cdot 2\\
\mathbf{if}\;x \cdot y \leq -1.22 \cdot 10^{+145}:\\
\;\;\;\;t\_3\\

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

\mathbf{elif}\;x \cdot y \leq 2.6 \cdot 10^{-179}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;x \cdot y \leq 5.8 \cdot 10^{+213}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -1.21999999999999994e145 or 5.8000000000000006e213 < (*.f64 x y)

    1. Initial program 82.7%

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

      \[\leadsto 2 \cdot \color{blue}{\left(x \cdot y\right)} \]

    if -1.21999999999999994e145 < (*.f64 x y) < -5.4999999999999997e-102 or 2.60000000000000005e-179 < (*.f64 x y) < 9.7000000000000001e-26

    1. Initial program 97.0%

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

      \[\leadsto 2 \cdot \color{blue}{\left(-1 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)\right)} \]
    4. Taylor expanded in c around 0 46.8%

      \[\leadsto \color{blue}{-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutative46.8%

        \[\leadsto \color{blue}{\left(a \cdot \left(c \cdot i\right)\right) \cdot -2} \]
    6. Simplified46.8%

      \[\leadsto \color{blue}{\left(a \cdot \left(c \cdot i\right)\right) \cdot -2} \]

    if -5.4999999999999997e-102 < (*.f64 x y) < 2.60000000000000005e-179 or 9.7000000000000001e-26 < (*.f64 x y) < 5.8000000000000006e213

    1. Initial program 96.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1.22 \cdot 10^{+145}:\\ \;\;\;\;\left(x \cdot y\right) \cdot 2\\ \mathbf{elif}\;x \cdot y \leq -5.5 \cdot 10^{-102}:\\ \;\;\;\;-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\ \mathbf{elif}\;x \cdot y \leq 2.6 \cdot 10^{-179}:\\ \;\;\;\;2 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq 9.7 \cdot 10^{-26}:\\ \;\;\;\;-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\ \mathbf{elif}\;x \cdot y \leq 5.8 \cdot 10^{+213}:\\ \;\;\;\;2 \cdot \left(z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y\right) \cdot 2\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 65.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(z \cdot t - c \cdot \left(b \cdot \left(c \cdot i\right)\right)\right)\\ t_2 := \left(\left(c \cdot \left(a + b \cdot c\right)\right) \cdot i\right) \cdot \left(-2\right)\\ \mathbf{if}\;i \leq -1.5 \cdot 10^{+47}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;i \leq -6.8 \cdot 10^{-63}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;i \leq -5.2 \cdot 10^{-103}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;i \leq 3.6 \cdot 10^{-56}:\\ \;\;\;\;\left(x \cdot y + z \cdot t\right) \cdot 2\\ \mathbf{elif}\;i \leq 48000000:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (* 2.0 (- (* z t) (* c (* b (* c i))))))
        (t_2 (* (* (* c (+ a (* b c))) i) (- 2.0))))
   (if (<= i -1.5e+47)
     t_2
     (if (<= i -6.8e-63)
       t_1
       (if (<= i -5.2e-103)
         t_2
         (if (<= i 3.6e-56)
           (* (+ (* x y) (* z t)) 2.0)
           (if (<= i 48000000.0) 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 = 2.0 * ((z * t) - (c * (b * (c * i))));
	double t_2 = ((c * (a + (b * c))) * i) * -2.0;
	double tmp;
	if (i <= -1.5e+47) {
		tmp = t_2;
	} else if (i <= -6.8e-63) {
		tmp = t_1;
	} else if (i <= -5.2e-103) {
		tmp = t_2;
	} else if (i <= 3.6e-56) {
		tmp = ((x * y) + (z * t)) * 2.0;
	} else if (i <= 48000000.0) {
		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 = 2.0d0 * ((z * t) - (c * (b * (c * i))))
    t_2 = ((c * (a + (b * c))) * i) * -2.0d0
    if (i <= (-1.5d+47)) then
        tmp = t_2
    else if (i <= (-6.8d-63)) then
        tmp = t_1
    else if (i <= (-5.2d-103)) then
        tmp = t_2
    else if (i <= 3.6d-56) then
        tmp = ((x * y) + (z * t)) * 2.0d0
    else if (i <= 48000000.0d0) 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 = 2.0 * ((z * t) - (c * (b * (c * i))));
	double t_2 = ((c * (a + (b * c))) * i) * -2.0;
	double tmp;
	if (i <= -1.5e+47) {
		tmp = t_2;
	} else if (i <= -6.8e-63) {
		tmp = t_1;
	} else if (i <= -5.2e-103) {
		tmp = t_2;
	} else if (i <= 3.6e-56) {
		tmp = ((x * y) + (z * t)) * 2.0;
	} else if (i <= 48000000.0) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = 2.0 * ((z * t) - (c * (b * (c * i))))
	t_2 = ((c * (a + (b * c))) * i) * -2.0
	tmp = 0
	if i <= -1.5e+47:
		tmp = t_2
	elif i <= -6.8e-63:
		tmp = t_1
	elif i <= -5.2e-103:
		tmp = t_2
	elif i <= 3.6e-56:
		tmp = ((x * y) + (z * t)) * 2.0
	elif i <= 48000000.0:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(2.0 * Float64(Float64(z * t) - Float64(c * Float64(b * Float64(c * i)))))
	t_2 = Float64(Float64(Float64(c * Float64(a + Float64(b * c))) * i) * Float64(-2.0))
	tmp = 0.0
	if (i <= -1.5e+47)
		tmp = t_2;
	elseif (i <= -6.8e-63)
		tmp = t_1;
	elseif (i <= -5.2e-103)
		tmp = t_2;
	elseif (i <= 3.6e-56)
		tmp = Float64(Float64(Float64(x * y) + Float64(z * t)) * 2.0);
	elseif (i <= 48000000.0)
		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 = 2.0 * ((z * t) - (c * (b * (c * i))));
	t_2 = ((c * (a + (b * c))) * i) * -2.0;
	tmp = 0.0;
	if (i <= -1.5e+47)
		tmp = t_2;
	elseif (i <= -6.8e-63)
		tmp = t_1;
	elseif (i <= -5.2e-103)
		tmp = t_2;
	elseif (i <= 3.6e-56)
		tmp = ((x * y) + (z * t)) * 2.0;
	elseif (i <= 48000000.0)
		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[(2.0 * N[(N[(z * t), $MachinePrecision] - N[(c * N[(b * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(c * N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision] * (-2.0)), $MachinePrecision]}, If[LessEqual[i, -1.5e+47], t$95$2, If[LessEqual[i, -6.8e-63], t$95$1, If[LessEqual[i, -5.2e-103], t$95$2, If[LessEqual[i, 3.6e-56], N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[i, 48000000.0], t$95$1, t$95$2]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := 2 \cdot \left(z \cdot t - c \cdot \left(b \cdot \left(c \cdot i\right)\right)\right)\\
t_2 := \left(\left(c \cdot \left(a + b \cdot c\right)\right) \cdot i\right) \cdot \left(-2\right)\\
\mathbf{if}\;i \leq -1.5 \cdot 10^{+47}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;i \leq -6.8 \cdot 10^{-63}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;i \leq -5.2 \cdot 10^{-103}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;i \leq 3.6 \cdot 10^{-56}:\\
\;\;\;\;\left(x \cdot y + z \cdot t\right) \cdot 2\\

\mathbf{elif}\;i \leq 48000000:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if i < -1.5000000000000001e47 or -6.79999999999999997e-63 < i < -5.19999999999999993e-103 or 4.8e7 < i

    1. Initial program 93.2%

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

      \[\leadsto 2 \cdot \color{blue}{\left(i \cdot \left(\left(\frac{t \cdot z}{i} + \frac{x \cdot y}{i}\right) - c \cdot \left(a + b \cdot c\right)\right)\right)} \]
    4. Step-by-step derivation
      1. associate--l+93.2%

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

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

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

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

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

      \[\leadsto 2 \cdot \color{blue}{\left(i \cdot \left(t \cdot \frac{z}{i} + \left(x \cdot \frac{y}{i} - c \cdot \mathsf{fma}\left(b, c, a\right)\right)\right)\right)} \]
    6. Taylor expanded in i around inf 82.1%

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

    if -1.5000000000000001e47 < i < -6.79999999999999997e-63 or 3.59999999999999978e-56 < i < 4.8e7

    1. Initial program 94.3%

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

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

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

    if -5.19999999999999993e-103 < i < 3.59999999999999978e-56

    1. Initial program 93.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -1.5 \cdot 10^{+47}:\\ \;\;\;\;\left(\left(c \cdot \left(a + b \cdot c\right)\right) \cdot i\right) \cdot \left(-2\right)\\ \mathbf{elif}\;i \leq -6.8 \cdot 10^{-63}:\\ \;\;\;\;2 \cdot \left(z \cdot t - c \cdot \left(b \cdot \left(c \cdot i\right)\right)\right)\\ \mathbf{elif}\;i \leq -5.2 \cdot 10^{-103}:\\ \;\;\;\;\left(\left(c \cdot \left(a + b \cdot c\right)\right) \cdot i\right) \cdot \left(-2\right)\\ \mathbf{elif}\;i \leq 3.6 \cdot 10^{-56}:\\ \;\;\;\;\left(x \cdot y + z \cdot t\right) \cdot 2\\ \mathbf{elif}\;i \leq 48000000:\\ \;\;\;\;2 \cdot \left(z \cdot t - c \cdot \left(b \cdot \left(c \cdot i\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(c \cdot \left(a + b \cdot c\right)\right) \cdot i\right) \cdot \left(-2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 76.6% accurate, 0.7× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\left(x \cdot y\right) \cdot 2\\


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

    1. Initial program 89.5%

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

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

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

      \[\leadsto \color{blue}{2 \cdot \left(\mathsf{fma}\left(x, y, z \cdot t\right) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-define93.6%

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

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

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

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

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

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

    if -2.25000000000000003e85 < (*.f64 x y) < 3.89999999999999985e262

    1. Initial program 96.7%

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

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

    if 3.89999999999999985e262 < (*.f64 x y)

    1. Initial program 72.7%

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

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

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

Alternative 6: 86.6% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \leq -2.2 \cdot 10^{+18} \lor \neg \left(c \leq 32000\right):\\
\;\;\;\;2 \cdot \left(z \cdot t - c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right)\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - i \cdot \left(a \cdot c\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -2.2e18 or 32000 < c

    1. Initial program 85.9%

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

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

    if -2.2e18 < c < 32000

    1. Initial program 99.2%

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

      \[\leadsto 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{\left(a \cdot c\right)} \cdot i\right) \]
    4. Step-by-step derivation
      1. *-commutative96.2%

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

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

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

Alternative 7: 75.3% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;y \leq 6.5 \cdot 10^{+50}:\\
\;\;\;\;2 \cdot \left(z \cdot t - c \cdot \left(t\_1 \cdot i\right)\right)\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(x \cdot y - t\_1 \cdot \left(c \cdot i\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1e5

    1. Initial program 86.9%

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

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

    if -1e5 < y < 6.5000000000000003e50

    1. Initial program 97.2%

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

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

    if 6.5000000000000003e50 < y

    1. Initial program 89.6%

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

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

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

      \[\leadsto \color{blue}{2 \cdot \left(\mathsf{fma}\left(x, y, z \cdot t\right) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-define93.6%

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

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

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

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

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

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

Alternative 8: 73.6% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.85 \cdot 10^{+30} \lor \neg \left(c \leq 13500000000\right):\\
\;\;\;\;-2 \cdot \left(c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(x \cdot y + z \cdot t\right) \cdot 2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -1.85000000000000008e30 or 1.35e10 < c

    1. Initial program 85.3%

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

      \[\leadsto 2 \cdot \color{blue}{\left(-1 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)\right)} \]
    4. Taylor expanded in i around 0 83.6%

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

    if -1.85000000000000008e30 < c < 1.35e10

    1. Initial program 99.2%

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

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

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

Alternative 9: 72.6% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_1 := a + b \cdot c\\
\mathbf{if}\;c \leq -4.2 \cdot 10^{+30}:\\
\;\;\;\;\left(\left(c \cdot t\_1\right) \cdot i\right) \cdot \left(-2\right)\\

\mathbf{elif}\;c \leq 15000000000:\\
\;\;\;\;\left(x \cdot y + z \cdot t\right) \cdot 2\\

\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(c \cdot \left(t\_1 \cdot i\right)\right)\\


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

    1. Initial program 91.1%

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

      \[\leadsto 2 \cdot \color{blue}{\left(i \cdot \left(\left(\frac{t \cdot z}{i} + \frac{x \cdot y}{i}\right) - c \cdot \left(a + b \cdot c\right)\right)\right)} \]
    4. Step-by-step derivation
      1. associate--l+85.9%

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

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

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

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

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

      \[\leadsto 2 \cdot \color{blue}{\left(i \cdot \left(t \cdot \frac{z}{i} + \left(x \cdot \frac{y}{i} - c \cdot \mathsf{fma}\left(b, c, a\right)\right)\right)\right)} \]
    6. Taylor expanded in i around inf 86.1%

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

    if -4.2e30 < c < 1.5e10

    1. Initial program 99.2%

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

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

    if 1.5e10 < c

    1. Initial program 78.9%

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

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

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

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

Alternative 10: 56.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;i \leq -1 \cdot 10^{+52} \lor \neg \left(i \leq 5.5 \cdot 10^{+134}\right):\\
\;\;\;\;-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(x \cdot y + z \cdot t\right) \cdot 2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < -9.9999999999999999e51 or 5.4999999999999999e134 < i

    1. Initial program 92.8%

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

      \[\leadsto 2 \cdot \color{blue}{\left(-1 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)\right)} \]
    4. Taylor expanded in c around 0 62.4%

      \[\leadsto \color{blue}{-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutative62.4%

        \[\leadsto \color{blue}{\left(a \cdot \left(c \cdot i\right)\right) \cdot -2} \]
    6. Simplified62.4%

      \[\leadsto \color{blue}{\left(a \cdot \left(c \cdot i\right)\right) \cdot -2} \]

    if -9.9999999999999999e51 < i < 5.4999999999999999e134

    1. Initial program 93.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -1 \cdot 10^{+52} \lor \neg \left(i \leq 5.5 \cdot 10^{+134}\right):\\ \;\;\;\;-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y + z \cdot t\right) \cdot 2\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 42.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -6.8 \cdot 10^{-12} \lor \neg \left(x \cdot y \leq 1.05 \cdot 10^{+213}\right):\\
\;\;\;\;\left(x \cdot y\right) \cdot 2\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(z \cdot t\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -6.8000000000000001e-12 or 1.05e213 < (*.f64 x y)

    1. Initial program 88.2%

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

      \[\leadsto 2 \cdot \color{blue}{\left(x \cdot y\right)} \]

    if -6.8000000000000001e-12 < (*.f64 x y) < 1.05e213

    1. Initial program 96.2%

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

      \[\leadsto 2 \cdot \color{blue}{\left(t \cdot z\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification44.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -6.8 \cdot 10^{-12} \lor \neg \left(x \cdot y \leq 1.05 \cdot 10^{+213}\right):\\ \;\;\;\;\left(x \cdot y\right) \cdot 2\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(z \cdot t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 29.1% accurate, 3.8× speedup?

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

\\
2 \cdot \left(z \cdot t\right)
\end{array}
Derivation
  1. Initial program 93.3%

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

    \[\leadsto 2 \cdot \color{blue}{\left(t \cdot z\right)} \]
  4. Final simplification27.4%

    \[\leadsto 2 \cdot \left(z \cdot t\right) \]
  5. Add Preprocessing

Developer target: 94.1% accurate, 1.0× speedup?

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

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

Reproduce

?
herbie shell --seed 2024106 
(FPCore (x y z t a b c i)
  :name "Diagrams.ThreeD.Shapes:frustum from diagrams-lib-1.3.0.3, A"
  :precision binary64

  :alt
  (* 2.0 (- (+ (* x y) (* z t)) (* (+ a (* b c)) (* c i))))

  (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))