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

Percentage Accurate: 90.3% → 97.1%
Time: 16.7s
Alternatives: 15
Speedup: 0.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 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: 90.3% 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: 97.1% accurate, 0.1× speedup?

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

\\
2 \cdot \mathsf{fma}\left(z, t, \mathsf{fma}\left(x, y, \mathsf{fma}\left(b, c, a\right) \cdot \left(-c \cdot i\right)\right)\right)
\end{array}
Derivation
  1. Initial program 89.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. associate--l+89.0%

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

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

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

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

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

      \[\leadsto 2 \cdot \color{blue}{\left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)} \]
    7. fma-def89.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) \]
    8. associate-*l*93.4%

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

    \[\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. Step-by-step derivation
    1. fma-def93.4%

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

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

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

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

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

      \[\leadsto 2 \cdot \mathsf{fma}\left(z, t, \color{blue}{\mathsf{fma}\left(x, y, -\left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right)}\right) \]
    4. distribute-rgt-neg-in97.7%

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

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

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

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

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

Alternative 2: 95.1% accurate, 0.5× speedup?

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

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

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

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


\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 66.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. Taylor expanded in z around 0 87.5%

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

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

    if -inf.0 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.9999999999999998e297

    1. Initial program 98.6%

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

    if 4.9999999999999998e297 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 80.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. Taylor expanded in x around 0 94.6%

      \[\leadsto 2 \cdot \color{blue}{\left(t \cdot z - 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}\;i \cdot \left(c \cdot \left(a + b \cdot c\right)\right) \leq -\infty:\\ \;\;\;\;-2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)\\ \mathbf{elif}\;i \cdot \left(c \cdot \left(a + b \cdot c\right)\right) \leq 5 \cdot 10^{+297}:\\ \;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - i \cdot \left(c \cdot \left(a + b \cdot c\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(z \cdot t - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)\\ \end{array} \]

Alternative 3: 96.4% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(c \cdot \left(i \cdot t_1\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.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. Step-by-step derivation
      1. associate--l+93.3%

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

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

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

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

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

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

        \[\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) \]
      8. associate-*l*97.6%

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

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

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

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

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

    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. Taylor expanded in z around 0 50.0%

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

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

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

Alternative 4: 70.2% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(x \cdot y + z \cdot t\right)\\ t_2 := -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)\\ \mathbf{if}\;c \leq -2.5 \cdot 10^{+185}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \leq -3.1 \cdot 10^{+121}:\\ \;\;\;\;2 \cdot \left(x \cdot y - c \cdot \left(b \cdot \left(c \cdot i\right)\right)\right)\\ \mathbf{elif}\;c \leq -1.65 \cdot 10^{+68}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \leq 3.65 \cdot 10^{-286}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 6.2 \cdot 10^{-118}:\\ \;\;\;\;2 \cdot \left(z \cdot t - a \cdot \left(c \cdot i\right)\right)\\ \mathbf{elif}\;c \leq 1.45 \cdot 10^{-68}:\\ \;\;\;\;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 (+ (* x y) (* z t))))
        (t_2 (* -2.0 (* c (* i (+ a (* b c)))))))
   (if (<= c -2.5e+185)
     t_2
     (if (<= c -3.1e+121)
       (* 2.0 (- (* x y) (* c (* b (* c i)))))
       (if (<= c -1.65e+68)
         t_2
         (if (<= c 3.65e-286)
           t_1
           (if (<= c 6.2e-118)
             (* 2.0 (- (* z t) (* a (* c i))))
             (if (<= c 1.45e-68) 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 * ((x * y) + (z * t));
	double t_2 = -2.0 * (c * (i * (a + (b * c))));
	double tmp;
	if (c <= -2.5e+185) {
		tmp = t_2;
	} else if (c <= -3.1e+121) {
		tmp = 2.0 * ((x * y) - (c * (b * (c * i))));
	} else if (c <= -1.65e+68) {
		tmp = t_2;
	} else if (c <= 3.65e-286) {
		tmp = t_1;
	} else if (c <= 6.2e-118) {
		tmp = 2.0 * ((z * t) - (a * (c * i)));
	} else if (c <= 1.45e-68) {
		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 * ((x * y) + (z * t))
    t_2 = (-2.0d0) * (c * (i * (a + (b * c))))
    if (c <= (-2.5d+185)) then
        tmp = t_2
    else if (c <= (-3.1d+121)) then
        tmp = 2.0d0 * ((x * y) - (c * (b * (c * i))))
    else if (c <= (-1.65d+68)) then
        tmp = t_2
    else if (c <= 3.65d-286) then
        tmp = t_1
    else if (c <= 6.2d-118) then
        tmp = 2.0d0 * ((z * t) - (a * (c * i)))
    else if (c <= 1.45d-68) 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 * ((x * y) + (z * t));
	double t_2 = -2.0 * (c * (i * (a + (b * c))));
	double tmp;
	if (c <= -2.5e+185) {
		tmp = t_2;
	} else if (c <= -3.1e+121) {
		tmp = 2.0 * ((x * y) - (c * (b * (c * i))));
	} else if (c <= -1.65e+68) {
		tmp = t_2;
	} else if (c <= 3.65e-286) {
		tmp = t_1;
	} else if (c <= 6.2e-118) {
		tmp = 2.0 * ((z * t) - (a * (c * i)));
	} else if (c <= 1.45e-68) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = 2.0 * ((x * y) + (z * t))
	t_2 = -2.0 * (c * (i * (a + (b * c))))
	tmp = 0
	if c <= -2.5e+185:
		tmp = t_2
	elif c <= -3.1e+121:
		tmp = 2.0 * ((x * y) - (c * (b * (c * i))))
	elif c <= -1.65e+68:
		tmp = t_2
	elif c <= 3.65e-286:
		tmp = t_1
	elif c <= 6.2e-118:
		tmp = 2.0 * ((z * t) - (a * (c * i)))
	elif c <= 1.45e-68:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(2.0 * Float64(Float64(x * y) + Float64(z * t)))
	t_2 = Float64(-2.0 * Float64(c * Float64(i * Float64(a + Float64(b * c)))))
	tmp = 0.0
	if (c <= -2.5e+185)
		tmp = t_2;
	elseif (c <= -3.1e+121)
		tmp = Float64(2.0 * Float64(Float64(x * y) - Float64(c * Float64(b * Float64(c * i)))));
	elseif (c <= -1.65e+68)
		tmp = t_2;
	elseif (c <= 3.65e-286)
		tmp = t_1;
	elseif (c <= 6.2e-118)
		tmp = Float64(2.0 * Float64(Float64(z * t) - Float64(a * Float64(c * i))));
	elseif (c <= 1.45e-68)
		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 * ((x * y) + (z * t));
	t_2 = -2.0 * (c * (i * (a + (b * c))));
	tmp = 0.0;
	if (c <= -2.5e+185)
		tmp = t_2;
	elseif (c <= -3.1e+121)
		tmp = 2.0 * ((x * y) - (c * (b * (c * i))));
	elseif (c <= -1.65e+68)
		tmp = t_2;
	elseif (c <= 3.65e-286)
		tmp = t_1;
	elseif (c <= 6.2e-118)
		tmp = 2.0 * ((z * t) - (a * (c * i)));
	elseif (c <= 1.45e-68)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(2.0 * N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-2.0 * N[(c * N[(i * N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -2.5e+185], t$95$2, If[LessEqual[c, -3.1e+121], N[(2.0 * N[(N[(x * y), $MachinePrecision] - N[(c * N[(b * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -1.65e+68], t$95$2, If[LessEqual[c, 3.65e-286], t$95$1, If[LessEqual[c, 6.2e-118], N[(2.0 * N[(N[(z * t), $MachinePrecision] - N[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 1.45e-68], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;c \leq -3.1 \cdot 10^{+121}:\\
\;\;\;\;2 \cdot \left(x \cdot y - c \cdot \left(b \cdot \left(c \cdot i\right)\right)\right)\\

\mathbf{elif}\;c \leq -1.65 \cdot 10^{+68}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;c \leq 3.65 \cdot 10^{-286}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;c \leq 1.45 \cdot 10^{-68}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if c < -2.49999999999999995e185 or -3.10000000000000008e121 < c < -1.65e68 or 1.45e-68 < 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. Taylor expanded in z around 0 85.0%

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

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

    if -2.49999999999999995e185 < c < -3.10000000000000008e121

    1. Initial program 71.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. Taylor expanded in z around 0 73.7%

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

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

    if -1.65e68 < c < 3.64999999999999979e-286 or 6.2000000000000002e-118 < c < 1.45e-68

    1. Initial program 98.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. Taylor expanded in c around 0 78.9%

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

    if 3.64999999999999979e-286 < c < 6.2000000000000002e-118

    1. Initial program 99.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. Taylor expanded in a around inf 96.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.5 \cdot 10^{+185}:\\ \;\;\;\;-2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)\\ \mathbf{elif}\;c \leq -3.1 \cdot 10^{+121}:\\ \;\;\;\;2 \cdot \left(x \cdot y - c \cdot \left(b \cdot \left(c \cdot i\right)\right)\right)\\ \mathbf{elif}\;c \leq -1.65 \cdot 10^{+68}:\\ \;\;\;\;-2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)\\ \mathbf{elif}\;c \leq 3.65 \cdot 10^{-286}:\\ \;\;\;\;2 \cdot \left(x \cdot y + z \cdot t\right)\\ \mathbf{elif}\;c \leq 6.2 \cdot 10^{-118}:\\ \;\;\;\;2 \cdot \left(z \cdot t - a \cdot \left(c \cdot i\right)\right)\\ \mathbf{elif}\;c \leq 1.45 \cdot 10^{-68}:\\ \;\;\;\;2 \cdot \left(x \cdot y + z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)\\ \end{array} \]

Alternative 5: 80.7% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_1 := c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\\
\mathbf{if}\;x \cdot y \leq -4 \cdot 10^{-106} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{+16}\right):\\
\;\;\;\;2 \cdot \left(x \cdot y - t_1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -3.99999999999999976e-106 or 2e16 < (*.f64 x y)

    1. Initial program 86.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. Taylor expanded in z around 0 76.5%

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

    if -3.99999999999999976e-106 < (*.f64 x y) < 2e16

    1. Initial program 91.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -4 \cdot 10^{-106} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{+16}\right):\\ \;\;\;\;2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(z \cdot t - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)\\ \end{array} \]

Alternative 6: 70.6% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;c \leq 3.65 \cdot 10^{-286}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;c \leq 1.25 \cdot 10^{-68}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -1.5000000000000001e68 or 1.24999999999999993e-68 < 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. Taylor expanded in z around 0 83.4%

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

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

    if -1.5000000000000001e68 < c < 3.64999999999999979e-286 or 2.30000000000000002e-116 < c < 1.24999999999999993e-68

    1. Initial program 98.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. Taylor expanded in c around 0 78.9%

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

    if 3.64999999999999979e-286 < c < 2.30000000000000002e-116

    1. Initial program 99.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. Taylor expanded in a around inf 96.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -1.5 \cdot 10^{+68}:\\ \;\;\;\;-2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)\\ \mathbf{elif}\;c \leq 3.65 \cdot 10^{-286}:\\ \;\;\;\;2 \cdot \left(x \cdot y + z \cdot t\right)\\ \mathbf{elif}\;c \leq 2.3 \cdot 10^{-116}:\\ \;\;\;\;2 \cdot \left(z \cdot t - a \cdot \left(c \cdot i\right)\right)\\ \mathbf{elif}\;c \leq 1.25 \cdot 10^{-68}:\\ \;\;\;\;2 \cdot \left(x \cdot y + z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)\\ \end{array} \]

Alternative 7: 72.5% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 86.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. Taylor expanded in c around 0 59.3%

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

    if -1.0800000000000001e23 < y < 4.1999999999999997e139

    1. Initial program 89.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. Taylor expanded in x around 0 79.6%

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

    if 4.1999999999999997e139 < y

    1. Initial program 92.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. Taylor expanded in z around 0 79.2%

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

      \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \color{blue}{\left(b \cdot \left(c \cdot i\right)\right)}\right) \]
    4. Step-by-step derivation
      1. expm1-log1p-u50.3%

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(b \cdot \left(c \cdot i\right)\right)\right)}\right) \]
      2. expm1-udef50.3%

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(b \cdot \left(c \cdot i\right)\right)} - 1\right)}\right) \]
      3. *-commutative50.3%

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\left(c \cdot i\right) \cdot b}\right)} - 1\right)\right) \]
      4. *-commutative50.3%

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\left(i \cdot c\right)} \cdot b\right)} - 1\right)\right) \]
      5. associate-*r*50.3%

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{i \cdot \left(c \cdot b\right)}\right)} - 1\right)\right) \]
      6. *-commutative50.3%

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(e^{\mathsf{log1p}\left(i \cdot \color{blue}{\left(b \cdot c\right)}\right)} - 1\right)\right) \]
      7. associate-*r*50.3%

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\left(i \cdot b\right) \cdot c}\right)} - 1\right)\right) \]
    5. Applied egg-rr50.3%

      \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\left(i \cdot b\right) \cdot c\right)} - 1\right)}\right) \]
    6. Step-by-step derivation
      1. expm1-def50.3%

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(i \cdot b\right) \cdot c\right)\right)}\right) \]
      2. expm1-log1p74.0%

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \color{blue}{\left(\left(i \cdot b\right) \cdot c\right)}\right) \]
      3. *-commutative74.0%

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \color{blue}{\left(c \cdot \left(i \cdot b\right)\right)}\right) \]
      4. *-commutative74.0%

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(c \cdot \color{blue}{\left(b \cdot i\right)}\right)\right) \]
    7. Simplified74.0%

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

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

Alternative 8: 87.2% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -1.12000000000000006e-9

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

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

    if -1.12000000000000006e-9 < c < 1.3e-51

    1. Initial program 99.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. Taylor expanded in a around inf 96.1%

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

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

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

    if 1.3e-51 < c

    1. Initial program 85.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. Taylor expanded in z around 0 86.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -1.12 \cdot 10^{-9}:\\ \;\;\;\;2 \cdot \left(z \cdot t - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)\\ \mathbf{elif}\;c \leq 1.3 \cdot 10^{-51}:\\ \;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - i \cdot \left(c \cdot a\right)\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)\\ \end{array} \]

Alternative 9: 35.4% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;i \leq 5 \cdot 10^{-273}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;i \leq 3 \cdot 10^{-162}:\\
\;\;\;\;2 \cdot \left(x \cdot y\right)\\

\mathbf{elif}\;i \leq 6.6 \cdot 10^{+49}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;i \leq 3.8 \cdot 10^{+273}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if i < -1.79999999999999988e-107 or 6.5999999999999997e49 < i < 3.8e273

    1. Initial program 92.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. Taylor expanded in z around 0 76.1%

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

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

    if -1.79999999999999988e-107 < i < 4.99999999999999965e-273 or 2.99999999999999999e-162 < i < 6.5999999999999997e49

    1. Initial program 85.6%

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

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

    if 4.99999999999999965e-273 < i < 2.99999999999999999e-162

    1. Initial program 80.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. Taylor expanded in x around inf 57.9%

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

    if 3.8e273 < i

    1. Initial program 87.5%

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

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

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

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

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

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

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

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

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

      \[\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. Step-by-step derivation
      1. fma-def75.8%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(2 \cdot \left(\left(-i\right) \cdot \left(c \cdot a\right)\right)\right)\right)} \]
      2. expm1-udef1.4%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(2 \cdot \left(\left(-i\right) \cdot \left(c \cdot a\right)\right)\right)} - 1} \]
      3. *-commutative1.4%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(\left(-i\right) \cdot \left(c \cdot a\right)\right) \cdot 2}\right)} - 1 \]
      4. add-sqr-sqrt0.0%

        \[\leadsto e^{\mathsf{log1p}\left(\left(\color{blue}{\left(\sqrt{-i} \cdot \sqrt{-i}\right)} \cdot \left(c \cdot a\right)\right) \cdot 2\right)} - 1 \]
      5. sqrt-unprod37.5%

        \[\leadsto e^{\mathsf{log1p}\left(\left(\color{blue}{\sqrt{\left(-i\right) \cdot \left(-i\right)}} \cdot \left(c \cdot a\right)\right) \cdot 2\right)} - 1 \]
      6. sqr-neg37.5%

        \[\leadsto e^{\mathsf{log1p}\left(\left(\sqrt{\color{blue}{i \cdot i}} \cdot \left(c \cdot a\right)\right) \cdot 2\right)} - 1 \]
      7. sqrt-unprod26.1%

        \[\leadsto e^{\mathsf{log1p}\left(\left(\color{blue}{\left(\sqrt{i} \cdot \sqrt{i}\right)} \cdot \left(c \cdot a\right)\right) \cdot 2\right)} - 1 \]
      8. add-sqr-sqrt26.1%

        \[\leadsto e^{\mathsf{log1p}\left(\left(\color{blue}{i} \cdot \left(c \cdot a\right)\right) \cdot 2\right)} - 1 \]
      9. *-commutative26.1%

        \[\leadsto e^{\mathsf{log1p}\left(\left(i \cdot \color{blue}{\left(a \cdot c\right)}\right) \cdot 2\right)} - 1 \]
      10. associate-*r*26.1%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(\left(i \cdot a\right) \cdot c\right)} \cdot 2\right)} - 1 \]
    10. Applied egg-rr26.1%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(\left(i \cdot a\right) \cdot c\right) \cdot 2\right)} - 1} \]
    11. Step-by-step derivation
      1. expm1-def26.2%

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

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

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

        \[\leadsto \color{blue}{i \cdot \left(a \cdot \left(c \cdot 2\right)\right)} \]
    12. Simplified51.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -1.8 \cdot 10^{-107}:\\ \;\;\;\;-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\ \mathbf{elif}\;i \leq 5 \cdot 10^{-273}:\\ \;\;\;\;2 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;i \leq 3 \cdot 10^{-162}:\\ \;\;\;\;2 \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;i \leq 6.6 \cdot 10^{+49}:\\ \;\;\;\;2 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;i \leq 3.8 \cdot 10^{+273}:\\ \;\;\;\;-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\ \mathbf{else}:\\ \;\;\;\;i \cdot \left(a \cdot \left(2 \cdot c\right)\right)\\ \end{array} \]

Alternative 10: 35.2% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(z \cdot t\right)\\ t_2 := -2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\ \mathbf{if}\;i \leq -4.8 \cdot 10^{-119}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;i \leq 1.9 \cdot 10^{-276}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \leq 1.12 \cdot 10^{-164}:\\ \;\;\;\;2 \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;i \leq 1.5 \cdot 10^{+49}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \leq 3.8 \cdot 10^{+273}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot i\right) \cdot \left(2 \cdot c\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (* 2.0 (* z t))) (t_2 (* -2.0 (* a (* c i)))))
   (if (<= i -4.8e-119)
     t_2
     (if (<= i 1.9e-276)
       t_1
       (if (<= i 1.12e-164)
         (* 2.0 (* x y))
         (if (<= i 1.5e+49)
           t_1
           (if (<= i 3.8e+273) t_2 (* (* a i) (* 2.0 c)))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = 2.0 * (z * t);
	double t_2 = -2.0 * (a * (c * i));
	double tmp;
	if (i <= -4.8e-119) {
		tmp = t_2;
	} else if (i <= 1.9e-276) {
		tmp = t_1;
	} else if (i <= 1.12e-164) {
		tmp = 2.0 * (x * y);
	} else if (i <= 1.5e+49) {
		tmp = t_1;
	} else if (i <= 3.8e+273) {
		tmp = t_2;
	} else {
		tmp = (a * i) * (2.0 * c);
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = 2.0d0 * (z * t)
    t_2 = (-2.0d0) * (a * (c * i))
    if (i <= (-4.8d-119)) then
        tmp = t_2
    else if (i <= 1.9d-276) then
        tmp = t_1
    else if (i <= 1.12d-164) then
        tmp = 2.0d0 * (x * y)
    else if (i <= 1.5d+49) then
        tmp = t_1
    else if (i <= 3.8d+273) then
        tmp = t_2
    else
        tmp = (a * i) * (2.0d0 * c)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = 2.0 * (z * t);
	double t_2 = -2.0 * (a * (c * i));
	double tmp;
	if (i <= -4.8e-119) {
		tmp = t_2;
	} else if (i <= 1.9e-276) {
		tmp = t_1;
	} else if (i <= 1.12e-164) {
		tmp = 2.0 * (x * y);
	} else if (i <= 1.5e+49) {
		tmp = t_1;
	} else if (i <= 3.8e+273) {
		tmp = t_2;
	} else {
		tmp = (a * i) * (2.0 * c);
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = 2.0 * (z * t)
	t_2 = -2.0 * (a * (c * i))
	tmp = 0
	if i <= -4.8e-119:
		tmp = t_2
	elif i <= 1.9e-276:
		tmp = t_1
	elif i <= 1.12e-164:
		tmp = 2.0 * (x * y)
	elif i <= 1.5e+49:
		tmp = t_1
	elif i <= 3.8e+273:
		tmp = t_2
	else:
		tmp = (a * i) * (2.0 * c)
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(2.0 * Float64(z * t))
	t_2 = Float64(-2.0 * Float64(a * Float64(c * i)))
	tmp = 0.0
	if (i <= -4.8e-119)
		tmp = t_2;
	elseif (i <= 1.9e-276)
		tmp = t_1;
	elseif (i <= 1.12e-164)
		tmp = Float64(2.0 * Float64(x * y));
	elseif (i <= 1.5e+49)
		tmp = t_1;
	elseif (i <= 3.8e+273)
		tmp = t_2;
	else
		tmp = Float64(Float64(a * i) * Float64(2.0 * c));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = 2.0 * (z * t);
	t_2 = -2.0 * (a * (c * i));
	tmp = 0.0;
	if (i <= -4.8e-119)
		tmp = t_2;
	elseif (i <= 1.9e-276)
		tmp = t_1;
	elseif (i <= 1.12e-164)
		tmp = 2.0 * (x * y);
	elseif (i <= 1.5e+49)
		tmp = t_1;
	elseif (i <= 3.8e+273)
		tmp = t_2;
	else
		tmp = (a * i) * (2.0 * c);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(2.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-2.0 * N[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -4.8e-119], t$95$2, If[LessEqual[i, 1.9e-276], t$95$1, If[LessEqual[i, 1.12e-164], N[(2.0 * N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1.5e+49], t$95$1, If[LessEqual[i, 3.8e+273], t$95$2, N[(N[(a * i), $MachinePrecision] * N[(2.0 * c), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;i \leq 1.12 \cdot 10^{-164}:\\
\;\;\;\;2 \cdot \left(x \cdot y\right)\\

\mathbf{elif}\;i \leq 1.5 \cdot 10^{+49}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;i \leq 3.8 \cdot 10^{+273}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if i < -4.80000000000000017e-119 or 1.5000000000000001e49 < i < 3.8e273

    1. Initial program 92.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. Taylor expanded in z around 0 76.1%

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

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

    if -4.80000000000000017e-119 < i < 1.9e-276 or 1.12e-164 < i < 1.5000000000000001e49

    1. Initial program 85.6%

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

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

    if 1.9e-276 < i < 1.12e-164

    1. Initial program 80.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. Taylor expanded in x around inf 57.9%

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

    if 3.8e273 < i

    1. Initial program 87.5%

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

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

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

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

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

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

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

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

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

      \[\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. Step-by-step derivation
      1. fma-def75.8%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(2 \cdot \left(\left(-i\right) \cdot \left(c \cdot a\right)\right)\right)\right)} \]
      2. expm1-udef1.4%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(2 \cdot \left(\left(-i\right) \cdot \left(c \cdot a\right)\right)\right)} - 1} \]
      3. *-commutative1.4%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(\left(-i\right) \cdot \left(c \cdot a\right)\right) \cdot 2}\right)} - 1 \]
      4. add-sqr-sqrt0.0%

        \[\leadsto e^{\mathsf{log1p}\left(\left(\color{blue}{\left(\sqrt{-i} \cdot \sqrt{-i}\right)} \cdot \left(c \cdot a\right)\right) \cdot 2\right)} - 1 \]
      5. sqrt-unprod37.5%

        \[\leadsto e^{\mathsf{log1p}\left(\left(\color{blue}{\sqrt{\left(-i\right) \cdot \left(-i\right)}} \cdot \left(c \cdot a\right)\right) \cdot 2\right)} - 1 \]
      6. sqr-neg37.5%

        \[\leadsto e^{\mathsf{log1p}\left(\left(\sqrt{\color{blue}{i \cdot i}} \cdot \left(c \cdot a\right)\right) \cdot 2\right)} - 1 \]
      7. sqrt-unprod26.1%

        \[\leadsto e^{\mathsf{log1p}\left(\left(\color{blue}{\left(\sqrt{i} \cdot \sqrt{i}\right)} \cdot \left(c \cdot a\right)\right) \cdot 2\right)} - 1 \]
      8. add-sqr-sqrt26.1%

        \[\leadsto e^{\mathsf{log1p}\left(\left(\color{blue}{i} \cdot \left(c \cdot a\right)\right) \cdot 2\right)} - 1 \]
      9. *-commutative26.1%

        \[\leadsto e^{\mathsf{log1p}\left(\left(i \cdot \color{blue}{\left(a \cdot c\right)}\right) \cdot 2\right)} - 1 \]
      10. associate-*r*26.1%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(\left(i \cdot a\right) \cdot c\right)} \cdot 2\right)} - 1 \]
    10. Applied egg-rr26.1%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(\left(i \cdot a\right) \cdot c\right) \cdot 2\right)} - 1} \]
    11. Step-by-step derivation
      1. expm1-def26.2%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -4.8 \cdot 10^{-119}:\\ \;\;\;\;-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\ \mathbf{elif}\;i \leq 1.9 \cdot 10^{-276}:\\ \;\;\;\;2 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;i \leq 1.12 \cdot 10^{-164}:\\ \;\;\;\;2 \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;i \leq 1.5 \cdot 10^{+49}:\\ \;\;\;\;2 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;i \leq 3.8 \cdot 10^{+273}:\\ \;\;\;\;-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot i\right) \cdot \left(2 \cdot c\right)\\ \end{array} \]

Alternative 11: 36.3% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(z \cdot t\right)\\ t_2 := -2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\ \mathbf{if}\;i \leq -9.5 \cdot 10^{-104}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;i \leq 4.5 \cdot 10^{-275}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \leq 7.2 \cdot 10^{-163}:\\ \;\;\;\;2 \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;i \leq 4.8 \cdot 10^{+49}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (* 2.0 (* z t))) (t_2 (* -2.0 (* a (* c i)))))
   (if (<= i -9.5e-104)
     t_2
     (if (<= i 4.5e-275)
       t_1
       (if (<= i 7.2e-163) (* 2.0 (* x y)) (if (<= i 4.8e+49) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = 2.0 * (z * t);
	double t_2 = -2.0 * (a * (c * i));
	double tmp;
	if (i <= -9.5e-104) {
		tmp = t_2;
	} else if (i <= 4.5e-275) {
		tmp = t_1;
	} else if (i <= 7.2e-163) {
		tmp = 2.0 * (x * y);
	} else if (i <= 4.8e+49) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = 2.0d0 * (z * t)
    t_2 = (-2.0d0) * (a * (c * i))
    if (i <= (-9.5d-104)) then
        tmp = t_2
    else if (i <= 4.5d-275) then
        tmp = t_1
    else if (i <= 7.2d-163) then
        tmp = 2.0d0 * (x * y)
    else if (i <= 4.8d+49) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = 2.0 * (z * t);
	double t_2 = -2.0 * (a * (c * i));
	double tmp;
	if (i <= -9.5e-104) {
		tmp = t_2;
	} else if (i <= 4.5e-275) {
		tmp = t_1;
	} else if (i <= 7.2e-163) {
		tmp = 2.0 * (x * y);
	} else if (i <= 4.8e+49) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = 2.0 * (z * t)
	t_2 = -2.0 * (a * (c * i))
	tmp = 0
	if i <= -9.5e-104:
		tmp = t_2
	elif i <= 4.5e-275:
		tmp = t_1
	elif i <= 7.2e-163:
		tmp = 2.0 * (x * y)
	elif i <= 4.8e+49:
		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(z * t))
	t_2 = Float64(-2.0 * Float64(a * Float64(c * i)))
	tmp = 0.0
	if (i <= -9.5e-104)
		tmp = t_2;
	elseif (i <= 4.5e-275)
		tmp = t_1;
	elseif (i <= 7.2e-163)
		tmp = Float64(2.0 * Float64(x * y));
	elseif (i <= 4.8e+49)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = 2.0 * (z * t);
	t_2 = -2.0 * (a * (c * i));
	tmp = 0.0;
	if (i <= -9.5e-104)
		tmp = t_2;
	elseif (i <= 4.5e-275)
		tmp = t_1;
	elseif (i <= 7.2e-163)
		tmp = 2.0 * (x * y);
	elseif (i <= 4.8e+49)
		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[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-2.0 * N[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -9.5e-104], t$95$2, If[LessEqual[i, 4.5e-275], t$95$1, If[LessEqual[i, 7.2e-163], N[(2.0 * N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 4.8e+49], t$95$1, t$95$2]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;i \leq 4.5 \cdot 10^{-275}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;i \leq 7.2 \cdot 10^{-163}:\\
\;\;\;\;2 \cdot \left(x \cdot y\right)\\

\mathbf{elif}\;i \leq 4.8 \cdot 10^{+49}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if i < -9.5000000000000002e-104 or 4.8e49 < i

    1. Initial program 92.6%

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

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

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

    if -9.5000000000000002e-104 < i < 4.49999999999999978e-275 or 7.1999999999999996e-163 < i < 4.8e49

    1. Initial program 85.6%

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

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

    if 4.49999999999999978e-275 < i < 7.1999999999999996e-163

    1. Initial program 80.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. Taylor expanded in x around inf 57.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -9.5 \cdot 10^{-104}:\\ \;\;\;\;-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\ \mathbf{elif}\;i \leq 4.5 \cdot 10^{-275}:\\ \;\;\;\;2 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;i \leq 7.2 \cdot 10^{-163}:\\ \;\;\;\;2 \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;i \leq 4.8 \cdot 10^{+49}:\\ \;\;\;\;2 \cdot \left(z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\ \end{array} \]

Alternative 12: 74.3% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \leq -4.8 \cdot 10^{+67} \lor \neg \left(c \leq 1.45 \cdot 10^{-68}\right):\\
\;\;\;\;-2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -4.80000000000000004e67 or 1.45e-68 < 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. Taylor expanded in z around 0 83.4%

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

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

    if -4.80000000000000004e67 < c < 1.45e-68

    1. Initial program 99.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. Taylor expanded in c around 0 74.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -4.8 \cdot 10^{+67} \lor \neg \left(c \leq 1.45 \cdot 10^{-68}\right):\\ \;\;\;\;-2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot y + z \cdot t\right)\\ \end{array} \]

Alternative 13: 44.8% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+39} \lor \neg \left(x \cdot y \leq 10^{+60}\right):\\ \;\;\;\;2 \cdot \left(x \cdot y\right)\\ \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) -5e+39) (not (<= (* x y) 1e+60)))
   (* 2.0 (* x y))
   (* 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) <= -5e+39) || !((x * y) <= 1e+60)) {
		tmp = 2.0 * (x * y);
	} 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) <= (-5d+39)) .or. (.not. ((x * y) <= 1d+60))) then
        tmp = 2.0d0 * (x * y)
    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) <= -5e+39) || !((x * y) <= 1e+60)) {
		tmp = 2.0 * (x * y);
	} else {
		tmp = 2.0 * (z * t);
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if ((x * y) <= -5e+39) or not ((x * y) <= 1e+60):
		tmp = 2.0 * (x * y)
	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) <= -5e+39) || !(Float64(x * y) <= 1e+60))
		tmp = Float64(2.0 * Float64(x * y));
	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) <= -5e+39) || ~(((x * y) <= 1e+60)))
		tmp = 2.0 * (x * y);
	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], -5e+39], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1e+60]], $MachinePrecision]], N[(2.0 * N[(x * y), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+39} \lor \neg \left(x \cdot y \leq 10^{+60}\right):\\
\;\;\;\;2 \cdot \left(x \cdot y\right)\\

\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) < -5.00000000000000015e39 or 9.9999999999999995e59 < (*.f64 x y)

    1. Initial program 85.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. Taylor expanded in x around inf 50.7%

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

    if -5.00000000000000015e39 < (*.f64 x y) < 9.9999999999999995e59

    1. Initial program 91.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. Taylor expanded in z around inf 33.0%

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

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

Alternative 14: 57.6% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \leq -3.1 \cdot 10^{+182} \lor \neg \left(c \leq 8.6 \cdot 10^{+51}\right):\\
\;\;\;\;-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -3.09999999999999996e182 or 8.5999999999999994e51 < 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. Taylor expanded in z around 0 89.9%

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

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

    if -3.09999999999999996e182 < c < 8.5999999999999994e51

    1. Initial program 92.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. Taylor expanded in c around 0 61.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -3.1 \cdot 10^{+182} \lor \neg \left(c \leq 8.6 \cdot 10^{+51}\right):\\ \;\;\;\;-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot y + z \cdot t\right)\\ \end{array} \]

Alternative 15: 29.7% 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.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. Taylor expanded in z around inf 25.6%

    \[\leadsto 2 \cdot \color{blue}{\left(t \cdot z\right)} \]
  3. Final simplification25.6%

    \[\leadsto 2 \cdot \left(z \cdot t\right) \]

Developer target: 94.2% 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 2023326 
(FPCore (x y z t a b c i)
  :name "Diagrams.ThreeD.Shapes:frustum from diagrams-lib-1.3.0.3, A"
  :precision binary64

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

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