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

Percentage Accurate: 89.7% → 96.1%
Time: 22.1s
Alternatives: 15
Speedup: 0.4×

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 15 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: 89.7% 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: 96.1% accurate, 0.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t \cdot \left(z - \frac{c \cdot \left(\left(b \cdot c\right) \cdot i\right)}{t}\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 93.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. Step-by-step derivation
      1. fma-define93.0%

        \[\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*98.0%

        \[\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. Simplified98.0%

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

    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 x around 0 33.3%

      \[\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 t around inf 77.8%

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

      \[\leadsto 2 \cdot \left(t \cdot \left(z + -1 \cdot \frac{c \cdot \color{blue}{\left(b \cdot \left(c \cdot i\right)\right)}}{t}\right)\right) \]
    6. Step-by-step derivation
      1. associate-*r*88.9%

        \[\leadsto 2 \cdot \left(t \cdot \left(z + -1 \cdot \frac{c \cdot \color{blue}{\left(\left(b \cdot c\right) \cdot i\right)}}{t}\right)\right) \]
      2. *-commutative88.9%

        \[\leadsto 2 \cdot \left(t \cdot \left(z + -1 \cdot \frac{c \cdot \left(\color{blue}{\left(c \cdot b\right)} \cdot i\right)}{t}\right)\right) \]
      3. *-commutative88.9%

        \[\leadsto 2 \cdot \left(t \cdot \left(z + -1 \cdot \frac{c \cdot \color{blue}{\left(i \cdot \left(c \cdot b\right)\right)}}{t}\right)\right) \]
    7. Simplified88.9%

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

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

Alternative 2: 94.0% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := c \cdot \left(a + b \cdot c\right)\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+263} \lor \neg \left(t\_1 \leq 10^{+267}\right):\\ \;\;\;\;2 \cdot \left(x \cdot y - \left(c \cdot i\right) \cdot \mathsf{fma}\left(b, c, a\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(x \cdot y + z \cdot t\right) - t\_1 \cdot i\right) \cdot 2\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (* c (+ a (* b c)))))
   (if (or (<= t_1 -2e+263) (not (<= t_1 1e+267)))
     (* 2.0 (- (* x y) (* (* c i) (fma b c a))))
     (* (- (+ (* x y) (* z t)) (* t_1 i)) 2.0))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = c * (a + (b * c));
	double tmp;
	if ((t_1 <= -2e+263) || !(t_1 <= 1e+267)) {
		tmp = 2.0 * ((x * y) - ((c * i) * fma(b, c, a)));
	} else {
		tmp = (((x * y) + (z * t)) - (t_1 * i)) * 2.0;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(c * Float64(a + Float64(b * c)))
	tmp = 0.0
	if ((t_1 <= -2e+263) || !(t_1 <= 1e+267))
		tmp = Float64(2.0 * Float64(Float64(x * y) - Float64(Float64(c * i) * fma(b, c, a))));
	else
		tmp = Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(t_1 * i)) * 2.0);
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(c * N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e+263], N[Not[LessEqual[t$95$1, 1e+267]], $MachinePrecision]], N[(2.0 * N[(N[(x * y), $MachinePrecision] - N[(N[(c * i), $MachinePrecision] * N[(b * c + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * i), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := c \cdot \left(a + b \cdot c\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+263} \lor \neg \left(t\_1 \leq 10^{+267}\right):\\
\;\;\;\;2 \cdot \left(x \cdot y - \left(c \cdot i\right) \cdot \mathsf{fma}\left(b, c, a\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (+.f64 a (*.f64 b c)) c) < -2.00000000000000003e263 or 9.9999999999999997e266 < (*.f64 (+.f64 a (*.f64 b c)) c)

    1. Initial program 70.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 z around 0 93.5%

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

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

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

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

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

    if -2.00000000000000003e263 < (*.f64 (+.f64 a (*.f64 b c)) c) < 9.9999999999999997e266

    1. Initial program 98.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. Recombined 2 regimes into one program.
  4. Final simplification96.8%

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

Alternative 3: 42.0% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := -2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\ t_2 := \left(x \cdot y\right) \cdot 2\\ \mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+122}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \cdot y \leq -4 \cdot 10^{+28}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq -200000000000:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-44}:\\ \;\;\;\;-2 \cdot \left(i \cdot \left(a \cdot c\right)\right)\\ \mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{-102}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-52}:\\ \;\;\;\;2 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+66}:\\ \;\;\;\;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 (* a (* c i)))) (t_2 (* (* x y) 2.0)))
   (if (<= (* x y) -2e+122)
     t_2
     (if (<= (* x y) -4e+28)
       t_1
       (if (<= (* x y) -200000000000.0)
         t_2
         (if (<= (* x y) -5e-44)
           (* -2.0 (* i (* a c)))
           (if (<= (* x y) -2e-102)
             t_1
             (if (<= (* x y) 5e-52)
               (* 2.0 (* z t))
               (if (<= (* x y) 5e+66) 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 * (a * (c * i));
	double t_2 = (x * y) * 2.0;
	double tmp;
	if ((x * y) <= -2e+122) {
		tmp = t_2;
	} else if ((x * y) <= -4e+28) {
		tmp = t_1;
	} else if ((x * y) <= -200000000000.0) {
		tmp = t_2;
	} else if ((x * y) <= -5e-44) {
		tmp = -2.0 * (i * (a * c));
	} else if ((x * y) <= -2e-102) {
		tmp = t_1;
	} else if ((x * y) <= 5e-52) {
		tmp = 2.0 * (z * t);
	} else if ((x * y) <= 5e+66) {
		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) * (a * (c * i))
    t_2 = (x * y) * 2.0d0
    if ((x * y) <= (-2d+122)) then
        tmp = t_2
    else if ((x * y) <= (-4d+28)) then
        tmp = t_1
    else if ((x * y) <= (-200000000000.0d0)) then
        tmp = t_2
    else if ((x * y) <= (-5d-44)) then
        tmp = (-2.0d0) * (i * (a * c))
    else if ((x * y) <= (-2d-102)) then
        tmp = t_1
    else if ((x * y) <= 5d-52) then
        tmp = 2.0d0 * (z * t)
    else if ((x * y) <= 5d+66) 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 * (a * (c * i));
	double t_2 = (x * y) * 2.0;
	double tmp;
	if ((x * y) <= -2e+122) {
		tmp = t_2;
	} else if ((x * y) <= -4e+28) {
		tmp = t_1;
	} else if ((x * y) <= -200000000000.0) {
		tmp = t_2;
	} else if ((x * y) <= -5e-44) {
		tmp = -2.0 * (i * (a * c));
	} else if ((x * y) <= -2e-102) {
		tmp = t_1;
	} else if ((x * y) <= 5e-52) {
		tmp = 2.0 * (z * t);
	} else if ((x * y) <= 5e+66) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = -2.0 * (a * (c * i))
	t_2 = (x * y) * 2.0
	tmp = 0
	if (x * y) <= -2e+122:
		tmp = t_2
	elif (x * y) <= -4e+28:
		tmp = t_1
	elif (x * y) <= -200000000000.0:
		tmp = t_2
	elif (x * y) <= -5e-44:
		tmp = -2.0 * (i * (a * c))
	elif (x * y) <= -2e-102:
		tmp = t_1
	elif (x * y) <= 5e-52:
		tmp = 2.0 * (z * t)
	elif (x * y) <= 5e+66:
		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(a * Float64(c * i)))
	t_2 = Float64(Float64(x * y) * 2.0)
	tmp = 0.0
	if (Float64(x * y) <= -2e+122)
		tmp = t_2;
	elseif (Float64(x * y) <= -4e+28)
		tmp = t_1;
	elseif (Float64(x * y) <= -200000000000.0)
		tmp = t_2;
	elseif (Float64(x * y) <= -5e-44)
		tmp = Float64(-2.0 * Float64(i * Float64(a * c)));
	elseif (Float64(x * y) <= -2e-102)
		tmp = t_1;
	elseif (Float64(x * y) <= 5e-52)
		tmp = Float64(2.0 * Float64(z * t));
	elseif (Float64(x * y) <= 5e+66)
		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 * (a * (c * i));
	t_2 = (x * y) * 2.0;
	tmp = 0.0;
	if ((x * y) <= -2e+122)
		tmp = t_2;
	elseif ((x * y) <= -4e+28)
		tmp = t_1;
	elseif ((x * y) <= -200000000000.0)
		tmp = t_2;
	elseif ((x * y) <= -5e-44)
		tmp = -2.0 * (i * (a * c));
	elseif ((x * y) <= -2e-102)
		tmp = t_1;
	elseif ((x * y) <= 5e-52)
		tmp = 2.0 * (z * t);
	elseif ((x * y) <= 5e+66)
		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[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] * 2.0), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+122], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], -4e+28], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -200000000000.0], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], -5e-44], N[(-2.0 * N[(i * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -2e-102], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e-52], N[(2.0 * N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+66], t$95$1, t$95$2]]]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;x \cdot y \leq -200000000000:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-44}:\\
\;\;\;\;-2 \cdot \left(i \cdot \left(a \cdot c\right)\right)\\

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

\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-52}:\\
\;\;\;\;2 \cdot \left(z \cdot t\right)\\

\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+66}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 x y) < -2.00000000000000003e122 or -3.99999999999999983e28 < (*.f64 x y) < -2e11 or 4.99999999999999991e66 < (*.f64 x y)

    1. Initial program 90.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 x around inf 64.7%

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

    if -2.00000000000000003e122 < (*.f64 x y) < -3.99999999999999983e28 or -5.00000000000000039e-44 < (*.f64 x y) < -1.99999999999999987e-102 or 5e-52 < (*.f64 x y) < 4.99999999999999991e66

    1. Initial program 96.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. Add Preprocessing
    3. Taylor expanded in a around inf 47.0%

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

        \[\leadsto 2 \cdot \color{blue}{\left(-a \cdot \left(c \cdot i\right)\right)} \]
      2. *-commutative47.0%

        \[\leadsto 2 \cdot \left(-\color{blue}{\left(c \cdot i\right) \cdot a}\right) \]
      3. associate-*l*35.2%

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

        \[\leadsto 2 \cdot \left(-c \cdot \color{blue}{\left(a \cdot i\right)}\right) \]
      5. distribute-rgt-neg-in35.2%

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

        \[\leadsto 2 \cdot \left(c \cdot \left(-\color{blue}{i \cdot a}\right)\right) \]
      7. distribute-rgt-neg-in35.2%

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

      \[\leadsto 2 \cdot \color{blue}{\left(c \cdot \left(i \cdot \left(-a\right)\right)\right)} \]
    6. Taylor expanded in c around 0 47.0%

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

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

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

    if -2e11 < (*.f64 x y) < -5.00000000000000039e-44

    1. Initial program 93.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 a around inf 56.8%

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

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

        \[\leadsto \color{blue}{\left(a \cdot \left(c \cdot i\right)\right) \cdot -2} \]
      2. associate-*r*41.5%

        \[\leadsto \color{blue}{\left(\left(a \cdot c\right) \cdot i\right)} \cdot -2 \]
      3. *-commutative41.5%

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

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

    if -1.99999999999999987e-102 < (*.f64 x y) < 5e-52

    1. Initial program 84.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. Add Preprocessing
    3. Taylor expanded in z around inf 45.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+122}:\\ \;\;\;\;\left(x \cdot y\right) \cdot 2\\ \mathbf{elif}\;x \cdot y \leq -4 \cdot 10^{+28}:\\ \;\;\;\;-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\ \mathbf{elif}\;x \cdot y \leq -200000000000:\\ \;\;\;\;\left(x \cdot y\right) \cdot 2\\ \mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-44}:\\ \;\;\;\;-2 \cdot \left(i \cdot \left(a \cdot c\right)\right)\\ \mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{-102}:\\ \;\;\;\;-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-52}:\\ \;\;\;\;2 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+66}:\\ \;\;\;\;-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y\right) \cdot 2\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 94.5% accurate, 0.4× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;t\_3 \cdot -2\\


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

    1. Initial program 75.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 x around 0 87.3%

      \[\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 t around inf 90.5%

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

    if -inf.0 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.00000000000000016e284

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

    if 2.00000000000000016e284 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 69.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 89.5%

      \[\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 t around inf 89.8%

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

      \[\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 simplification96.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(c \cdot \left(a + b \cdot c\right)\right) \cdot i \leq -\infty:\\ \;\;\;\;2 \cdot \left(t \cdot \left(z - \frac{c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)}{t}\right)\right)\\ \mathbf{elif}\;\left(c \cdot \left(a + b \cdot c\right)\right) \cdot i \leq 2 \cdot 10^{+284}:\\ \;\;\;\;\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}:\\ \;\;\;\;\left(c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right) \cdot -2\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 42.3% 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 := \left(x \cdot y\right) \cdot 2\\ \mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+122}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{-102}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-52}:\\ \;\;\;\;2 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+66}:\\ \;\;\;\;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 (* a (* c i)))) (t_2 (* (* x y) 2.0)))
   (if (<= (* x y) -2e+122)
     t_2
     (if (<= (* x y) -2e-102)
       t_1
       (if (<= (* x y) 5e-52)
         (* 2.0 (* z t))
         (if (<= (* x y) 5e+66) 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 * (a * (c * i));
	double t_2 = (x * y) * 2.0;
	double tmp;
	if ((x * y) <= -2e+122) {
		tmp = t_2;
	} else if ((x * y) <= -2e-102) {
		tmp = t_1;
	} else if ((x * y) <= 5e-52) {
		tmp = 2.0 * (z * t);
	} else if ((x * y) <= 5e+66) {
		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) * (a * (c * i))
    t_2 = (x * y) * 2.0d0
    if ((x * y) <= (-2d+122)) then
        tmp = t_2
    else if ((x * y) <= (-2d-102)) then
        tmp = t_1
    else if ((x * y) <= 5d-52) then
        tmp = 2.0d0 * (z * t)
    else if ((x * y) <= 5d+66) 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 * (a * (c * i));
	double t_2 = (x * y) * 2.0;
	double tmp;
	if ((x * y) <= -2e+122) {
		tmp = t_2;
	} else if ((x * y) <= -2e-102) {
		tmp = t_1;
	} else if ((x * y) <= 5e-52) {
		tmp = 2.0 * (z * t);
	} else if ((x * y) <= 5e+66) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = -2.0 * (a * (c * i))
	t_2 = (x * y) * 2.0
	tmp = 0
	if (x * y) <= -2e+122:
		tmp = t_2
	elif (x * y) <= -2e-102:
		tmp = t_1
	elif (x * y) <= 5e-52:
		tmp = 2.0 * (z * t)
	elif (x * y) <= 5e+66:
		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(a * Float64(c * i)))
	t_2 = Float64(Float64(x * y) * 2.0)
	tmp = 0.0
	if (Float64(x * y) <= -2e+122)
		tmp = t_2;
	elseif (Float64(x * y) <= -2e-102)
		tmp = t_1;
	elseif (Float64(x * y) <= 5e-52)
		tmp = Float64(2.0 * Float64(z * t));
	elseif (Float64(x * y) <= 5e+66)
		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 * (a * (c * i));
	t_2 = (x * y) * 2.0;
	tmp = 0.0;
	if ((x * y) <= -2e+122)
		tmp = t_2;
	elseif ((x * y) <= -2e-102)
		tmp = t_1;
	elseif ((x * y) <= 5e-52)
		tmp = 2.0 * (z * t);
	elseif ((x * y) <= 5e+66)
		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[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] * 2.0), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+122], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], -2e-102], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e-52], N[(2.0 * N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+66], t$95$1, t$95$2]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-52}:\\
\;\;\;\;2 \cdot \left(z \cdot t\right)\\

\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+66}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -2.00000000000000003e122 or 4.99999999999999991e66 < (*.f64 x y)

    1. Initial program 90.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 x around inf 64.5%

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

    if -2.00000000000000003e122 < (*.f64 x y) < -1.99999999999999987e-102 or 5e-52 < (*.f64 x y) < 4.99999999999999991e66

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

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

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

        \[\leadsto 2 \cdot \left(-\color{blue}{\left(c \cdot i\right) \cdot a}\right) \]
      3. associate-*l*33.8%

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

        \[\leadsto 2 \cdot \left(-c \cdot \color{blue}{\left(a \cdot i\right)}\right) \]
      5. distribute-rgt-neg-in33.8%

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

        \[\leadsto 2 \cdot \left(c \cdot \left(-\color{blue}{i \cdot a}\right)\right) \]
      7. distribute-rgt-neg-in33.8%

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

      \[\leadsto 2 \cdot \color{blue}{\left(c \cdot \left(i \cdot \left(-a\right)\right)\right)} \]
    6. Taylor expanded in c around 0 41.2%

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

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

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

    if -1.99999999999999987e-102 < (*.f64 x y) < 5e-52

    1. Initial program 84.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. Add Preprocessing
    3. Taylor expanded in z around inf 45.1%

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

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

Alternative 6: 73.7% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -3.5 \cdot 10^{+159} \lor \neg \left(c \leq -4.7 \cdot 10^{+114}\right) \land \left(c \leq -46000000 \lor \neg \left(c \leq 1.1 \cdot 10^{+40}\right)\right):\\ \;\;\;\;\left(c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right) \cdot -2\\ \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 -3.5e+159)
         (and (not (<= c -4.7e+114))
              (or (<= c -46000000.0) (not (<= c 1.1e+40)))))
   (* (* c (* (+ a (* b c)) i)) -2.0)
   (* (+ (* 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 <= -3.5e+159) || (!(c <= -4.7e+114) && ((c <= -46000000.0) || !(c <= 1.1e+40)))) {
		tmp = (c * ((a + (b * c)) * i)) * -2.0;
	} 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 <= (-3.5d+159)) .or. (.not. (c <= (-4.7d+114))) .and. (c <= (-46000000.0d0)) .or. (.not. (c <= 1.1d+40))) then
        tmp = (c * ((a + (b * c)) * i)) * (-2.0d0)
    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 <= -3.5e+159) || (!(c <= -4.7e+114) && ((c <= -46000000.0) || !(c <= 1.1e+40)))) {
		tmp = (c * ((a + (b * c)) * i)) * -2.0;
	} else {
		tmp = ((x * y) + (z * t)) * 2.0;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (c <= -3.5e+159) or (not (c <= -4.7e+114) and ((c <= -46000000.0) or not (c <= 1.1e+40))):
		tmp = (c * ((a + (b * c)) * i)) * -2.0
	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 <= -3.5e+159) || (!(c <= -4.7e+114) && ((c <= -46000000.0) || !(c <= 1.1e+40))))
		tmp = Float64(Float64(c * Float64(Float64(a + Float64(b * c)) * i)) * -2.0);
	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 <= -3.5e+159) || (~((c <= -4.7e+114)) && ((c <= -46000000.0) || ~((c <= 1.1e+40)))))
		tmp = (c * ((a + (b * c)) * i)) * -2.0;
	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, -3.5e+159], And[N[Not[LessEqual[c, -4.7e+114]], $MachinePrecision], Or[LessEqual[c, -46000000.0], N[Not[LessEqual[c, 1.1e+40]], $MachinePrecision]]]], N[(N[(c * N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] * -2.0), $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 -3.5 \cdot 10^{+159} \lor \neg \left(c \leq -4.7 \cdot 10^{+114}\right) \land \left(c \leq -46000000 \lor \neg \left(c \leq 1.1 \cdot 10^{+40}\right)\right):\\
\;\;\;\;\left(c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right) \cdot -2\\

\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 < -3.4999999999999999e159 or -4.7000000000000001e114 < c < -4.6e7 or 1.0999999999999999e40 < c

    1. Initial program 79.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.5%

      \[\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 t around inf 83.8%

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

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

    if -3.4999999999999999e159 < c < -4.7000000000000001e114 or -4.6e7 < c < 1.0999999999999999e40

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -3.5 \cdot 10^{+159} \lor \neg \left(c \leq -4.7 \cdot 10^{+114}\right) \land \left(c \leq -46000000 \lor \neg \left(c \leq 1.1 \cdot 10^{+40}\right)\right):\\ \;\;\;\;\left(c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right) \cdot -2\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y + z \cdot t\right) \cdot 2\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 73.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right) \cdot -2\\ \mathbf{if}\;c \leq -1.02 \cdot 10^{+158}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;c \leq -2.7 \cdot 10^{+92}:\\ \;\;\;\;2 \cdot \left(z \cdot t - a \cdot \left(c \cdot i\right)\right)\\ \mathbf{elif}\;c \leq -4500000 \lor \neg \left(c \leq 2.6 \cdot 10^{+39}\right):\\ \;\;\;\;t\_1\\ \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
 (let* ((t_1 (* (* c (* (+ a (* b c)) i)) -2.0)))
   (if (<= c -1.02e+158)
     t_1
     (if (<= c -2.7e+92)
       (* 2.0 (- (* z t) (* a (* c i))))
       (if (or (<= c -4500000.0) (not (<= c 2.6e+39)))
         t_1
         (* (+ (* 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 t_1 = (c * ((a + (b * c)) * i)) * -2.0;
	double tmp;
	if (c <= -1.02e+158) {
		tmp = t_1;
	} else if (c <= -2.7e+92) {
		tmp = 2.0 * ((z * t) - (a * (c * i)));
	} else if ((c <= -4500000.0) || !(c <= 2.6e+39)) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_1 = (c * ((a + (b * c)) * i)) * (-2.0d0)
    if (c <= (-1.02d+158)) then
        tmp = t_1
    else if (c <= (-2.7d+92)) then
        tmp = 2.0d0 * ((z * t) - (a * (c * i)))
    else if ((c <= (-4500000.0d0)) .or. (.not. (c <= 2.6d+39))) then
        tmp = t_1
    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 t_1 = (c * ((a + (b * c)) * i)) * -2.0;
	double tmp;
	if (c <= -1.02e+158) {
		tmp = t_1;
	} else if (c <= -2.7e+92) {
		tmp = 2.0 * ((z * t) - (a * (c * i)));
	} else if ((c <= -4500000.0) || !(c <= 2.6e+39)) {
		tmp = t_1;
	} else {
		tmp = ((x * y) + (z * t)) * 2.0;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (c * ((a + (b * c)) * i)) * -2.0
	tmp = 0
	if c <= -1.02e+158:
		tmp = t_1
	elif c <= -2.7e+92:
		tmp = 2.0 * ((z * t) - (a * (c * i)))
	elif (c <= -4500000.0) or not (c <= 2.6e+39):
		tmp = t_1
	else:
		tmp = ((x * y) + (z * t)) * 2.0
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(c * Float64(Float64(a + Float64(b * c)) * i)) * -2.0)
	tmp = 0.0
	if (c <= -1.02e+158)
		tmp = t_1;
	elseif (c <= -2.7e+92)
		tmp = Float64(2.0 * Float64(Float64(z * t) - Float64(a * Float64(c * i))));
	elseif ((c <= -4500000.0) || !(c <= 2.6e+39))
		tmp = t_1;
	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)
	t_1 = (c * ((a + (b * c)) * i)) * -2.0;
	tmp = 0.0;
	if (c <= -1.02e+158)
		tmp = t_1;
	elseif (c <= -2.7e+92)
		tmp = 2.0 * ((z * t) - (a * (c * i)));
	elseif ((c <= -4500000.0) || ~((c <= 2.6e+39)))
		tmp = t_1;
	else
		tmp = ((x * y) + (z * t)) * 2.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(c * N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision]}, If[LessEqual[c, -1.02e+158], t$95$1, If[LessEqual[c, -2.7e+92], N[(2.0 * N[(N[(z * t), $MachinePrecision] - N[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[c, -4500000.0], N[Not[LessEqual[c, 2.6e+39]], $MachinePrecision]], t$95$1, N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;c \leq -2.7 \cdot 10^{+92}:\\
\;\;\;\;2 \cdot \left(z \cdot t - a \cdot \left(c \cdot i\right)\right)\\

\mathbf{elif}\;c \leq -4500000 \lor \neg \left(c \leq 2.6 \cdot 10^{+39}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -1.02e158 or -2.6999999999999999e92 < c < -4.5e6 or 2.6e39 < c

    1. Initial program 79.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 86.8%

      \[\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 t around inf 84.3%

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

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

    if -1.02e158 < c < -2.6999999999999999e92

    1. Initial program 76.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. Add Preprocessing
    3. Taylor expanded in x around 0 94.2%

      \[\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 c around 0 86.9%

      \[\leadsto 2 \cdot \color{blue}{\left(-1 \cdot \left(a \cdot \left(c \cdot i\right)\right) + t \cdot z\right)} \]
    5. Step-by-step derivation
      1. mul-1-neg86.9%

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

        \[\leadsto 2 \cdot \color{blue}{\left(t \cdot z + \left(-a \cdot \left(c \cdot i\right)\right)\right)} \]
      3. sub-neg86.9%

        \[\leadsto 2 \cdot \color{blue}{\left(t \cdot z - a \cdot \left(c \cdot i\right)\right)} \]
    6. Simplified86.9%

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

    if -4.5e6 < c < 2.6e39

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -1.02 \cdot 10^{+158}:\\ \;\;\;\;\left(c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right) \cdot -2\\ \mathbf{elif}\;c \leq -2.7 \cdot 10^{+92}:\\ \;\;\;\;2 \cdot \left(z \cdot t - a \cdot \left(c \cdot i\right)\right)\\ \mathbf{elif}\;c \leq -4500000 \lor \neg \left(c \leq 2.6 \cdot 10^{+39}\right):\\ \;\;\;\;\left(c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right) \cdot -2\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y + z \cdot t\right) \cdot 2\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 73.5% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;c \leq -5 \cdot 10^{+92}:\\
\;\;\;\;2 \cdot \left(z \cdot t - a \cdot \left(c \cdot i\right)\right)\\

\mathbf{elif}\;c \leq -8000000:\\
\;\;\;\;2 \cdot \left(z \cdot t - c \cdot \left(c \cdot \left(b \cdot i\right)\right)\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if c < -1.02e158 or 3.99999999999999991e38 < c

    1. Initial program 78.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 87.8%

      \[\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 t around inf 85.9%

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

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

    if -1.02e158 < c < -5.00000000000000022e92

    1. Initial program 76.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. Add Preprocessing
    3. Taylor expanded in x around 0 94.2%

      \[\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 c around 0 86.9%

      \[\leadsto 2 \cdot \color{blue}{\left(-1 \cdot \left(a \cdot \left(c \cdot i\right)\right) + t \cdot z\right)} \]
    5. Step-by-step derivation
      1. mul-1-neg86.9%

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

        \[\leadsto 2 \cdot \color{blue}{\left(t \cdot z + \left(-a \cdot \left(c \cdot i\right)\right)\right)} \]
      3. sub-neg86.9%

        \[\leadsto 2 \cdot \color{blue}{\left(t \cdot z - a \cdot \left(c \cdot i\right)\right)} \]
    6. Simplified86.9%

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

    if -5.00000000000000022e92 < c < -8e6

    1. Initial program 81.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 81.9%

      \[\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 c around inf 87.4%

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

      \[\leadsto 2 \cdot \left(t \cdot z - c \cdot \color{blue}{\left(b \cdot \left(c \cdot i\right)\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutative81.2%

        \[\leadsto 2 \cdot \left(t \cdot z - c \cdot \color{blue}{\left(\left(c \cdot i\right) \cdot b\right)}\right) \]
      2. associate-*r*81.3%

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

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

    if -8e6 < c < 3.99999999999999991e38

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

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

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

Alternative 9: 73.6% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;c \leq -5 \cdot 10^{+92}:\\
\;\;\;\;2 \cdot \left(z \cdot t - a \cdot \left(c \cdot i\right)\right)\\

\mathbf{elif}\;c \leq -270000:\\
\;\;\;\;2 \cdot \left(z \cdot t - c \cdot \left(b \cdot \left(c \cdot i\right)\right)\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if c < -1.02e158 or 2.1999999999999999e40 < c

    1. Initial program 78.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 87.8%

      \[\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 t around inf 85.9%

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

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

    if -1.02e158 < c < -5.00000000000000022e92

    1. Initial program 76.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. Add Preprocessing
    3. Taylor expanded in x around 0 94.2%

      \[\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 c around 0 86.9%

      \[\leadsto 2 \cdot \color{blue}{\left(-1 \cdot \left(a \cdot \left(c \cdot i\right)\right) + t \cdot z\right)} \]
    5. Step-by-step derivation
      1. mul-1-neg86.9%

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

        \[\leadsto 2 \cdot \color{blue}{\left(t \cdot z + \left(-a \cdot \left(c \cdot i\right)\right)\right)} \]
      3. sub-neg86.9%

        \[\leadsto 2 \cdot \color{blue}{\left(t \cdot z - a \cdot \left(c \cdot i\right)\right)} \]
    6. Simplified86.9%

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

    if -5.00000000000000022e92 < c < -2.7e5

    1. Initial program 81.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 81.9%

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

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

    if -2.7e5 < c < 2.1999999999999999e40

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

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

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

Alternative 10: 78.8% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -5.8 \cdot 10^{-129} \lor \neg \left(c \leq 2900000000\right):\\ \;\;\;\;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 + z \cdot t\right) \cdot 2\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (or (<= c -5.8e-129) (not (<= c 2900000000.0)))
   (* 2.0 (- (* z t) (* 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 <= -5.8e-129) || !(c <= 2900000000.0)) {
		tmp = 2.0 * ((z * t) - (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 <= (-5.8d-129)) .or. (.not. (c <= 2900000000.0d0))) then
        tmp = 2.0d0 * ((z * t) - (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 <= -5.8e-129) || !(c <= 2900000000.0)) {
		tmp = 2.0 * ((z * t) - (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 <= -5.8e-129) or not (c <= 2900000000.0):
		tmp = 2.0 * ((z * t) - (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 <= -5.8e-129) || !(c <= 2900000000.0))
		tmp = Float64(2.0 * Float64(Float64(z * t) - 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 <= -5.8e-129) || ~((c <= 2900000000.0)))
		tmp = 2.0 * ((z * t) - (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, -5.8e-129], N[Not[LessEqual[c, 2900000000.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[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;c \leq -5.8 \cdot 10^{-129} \lor \neg \left(c \leq 2900000000\right):\\
\;\;\;\;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 + z \cdot t\right) \cdot 2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -5.80000000000000034e-129 or 2.9e9 < c

    1. Initial program 84.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 81.8%

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

    if -5.80000000000000034e-129 < c < 2.9e9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -5.8 \cdot 10^{-129} \lor \neg \left(c \leq 2900000000\right):\\ \;\;\;\;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 + z \cdot t\right) \cdot 2\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 85.5% accurate, 0.8× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;t\_1 \cdot -2\\


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

    1. Initial program 73.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 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.3e31 < c < 2.6000000000000002e100

    1. Initial program 97.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. Add Preprocessing
    3. Taylor expanded in a around inf 90.7%

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

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

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

    if 2.6000000000000002e100 < c

    1. Initial program 81.4%

      \[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 88.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 t around inf 86.2%

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

      \[\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 simplification90.4%

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

Alternative 12: 85.7% accurate, 0.8× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;t\_1 \cdot -2\\


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

    1. Initial program 73.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 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.6500000000000002e31 < c < 1.90000000000000018e97

    1. Initial program 97.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. Add Preprocessing
    3. Taylor expanded in a around inf 90.3%

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

    if 1.90000000000000018e97 < c

    1. Initial program 81.4%

      \[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 88.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 t around inf 86.2%

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

      \[\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 simplification90.2%

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

Alternative 13: 43.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{-55} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{+66}\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) -1e-55) (not (<= (* x y) 5e+66)))
   (* (* 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) <= -1e-55) || !((x * y) <= 5e+66)) {
		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) <= (-1d-55)) .or. (.not. ((x * y) <= 5d+66))) 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) <= -1e-55) || !((x * y) <= 5e+66)) {
		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) <= -1e-55) or not ((x * y) <= 5e+66):
		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) <= -1e-55) || !(Float64(x * y) <= 5e+66))
		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) <= -1e-55) || ~(((x * y) <= 5e+66)))
		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], -1e-55], N[Not[LessEqual[N[(x * y), $MachinePrecision], 5e+66]], $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 -1 \cdot 10^{-55} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{+66}\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) < -9.99999999999999995e-56 or 4.99999999999999991e66 < (*.f64 x y)

    1. Initial program 91.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. Add Preprocessing
    3. Taylor expanded in x around inf 48.4%

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

    if -9.99999999999999995e-56 < (*.f64 x y) < 4.99999999999999991e66

    1. Initial program 88.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 z around inf 40.1%

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

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

Alternative 14: 55.2% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \leq 5.5 \cdot 10^{+119}:\\
\;\;\;\;\left(x \cdot y + z \cdot t\right) \cdot 2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < 5.5000000000000003e119

    1. Initial program 91.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. Add Preprocessing
    3. Taylor expanded in c around 0 60.4%

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

    if 5.5000000000000003e119 < c

    1. Initial program 79.4%

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

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

        \[\leadsto 2 \cdot \color{blue}{\left(-a \cdot \left(c \cdot i\right)\right)} \]
      2. *-commutative37.9%

        \[\leadsto 2 \cdot \left(-\color{blue}{\left(c \cdot i\right) \cdot a}\right) \]
      3. associate-*l*33.1%

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

        \[\leadsto 2 \cdot \left(-c \cdot \color{blue}{\left(a \cdot i\right)}\right) \]
      5. distribute-rgt-neg-in33.1%

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

        \[\leadsto 2 \cdot \left(c \cdot \left(-\color{blue}{i \cdot a}\right)\right) \]
      7. distribute-rgt-neg-in33.1%

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

      \[\leadsto 2 \cdot \color{blue}{\left(c \cdot \left(i \cdot \left(-a\right)\right)\right)} \]
    6. Taylor expanded in c around 0 37.9%

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

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

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

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

Alternative 15: 29.3% 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 89.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 29.2%

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

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

Developer target: 93.6% 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 2024110 
(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))))