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

Percentage Accurate: 90.1% → 96.5%
Time: 16.0s
Alternatives: 17
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 17 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.1% accurate, 1.0× speedup?

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

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

Alternative 1: 96.5% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\left(-2 \cdot \left(c \cdot c\right)\right) \cdot \left(i \cdot \left(b + \frac{a}{c}\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 96.6%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-negN/A

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

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

        \[\leadsto 2 \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left(a + b \cdot c\right) \cdot \left(c \cdot i\right)}\right)\right) + \left(x \cdot y + z \cdot t\right)\right) \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \left(\color{blue}{\left(a + b \cdot c\right) \cdot \left(\mathsf{neg}\left(c \cdot i\right)\right)} + \left(x \cdot y + z \cdot t\right)\right) \]
      5. accelerator-lowering-fma.f64N/A

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

        \[\leadsto 2 \cdot \mathsf{fma}\left(\color{blue}{b \cdot c + a}, \mathsf{neg}\left(c \cdot i\right), x \cdot y + z \cdot t\right) \]
      7. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, c, a\right)}, \mathsf{neg}\left(c \cdot i\right), x \cdot y + z \cdot t\right) \]
      8. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), \color{blue}{c \cdot \left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), \color{blue}{c \cdot \left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      10. neg-lowering-neg.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \color{blue}{\left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      11. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(\mathsf{neg}\left(i\right)\right), \color{blue}{\mathsf{fma}\left(x, y, z \cdot t\right)}\right) \]
      12. *-lowering-*.f6499.1

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

      \[\leadsto 2 \cdot \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(-i\right), \mathsf{fma}\left(x, y, z \cdot t\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. Add Preprocessing
    3. Taylor expanded in c around inf

      \[\leadsto \color{blue}{{c}^{2} \cdot \left(-2 \cdot \left(b \cdot i\right) + -2 \cdot \frac{a \cdot i}{c}\right)} \]
    4. Step-by-step derivation
      1. distribute-lft-outN/A

        \[\leadsto {c}^{2} \cdot \color{blue}{\left(-2 \cdot \left(b \cdot i + \frac{a \cdot i}{c}\right)\right)} \]
      2. associate-*r*N/A

        \[\leadsto \color{blue}{\left({c}^{2} \cdot -2\right) \cdot \left(b \cdot i + \frac{a \cdot i}{c}\right)} \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\left(-2 \cdot {c}^{2}\right)} \cdot \left(b \cdot i + \frac{a \cdot i}{c}\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(-2 \cdot {c}^{2}\right) \cdot \left(b \cdot i + \frac{a \cdot i}{c}\right)} \]
      5. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(-2 \cdot {c}^{2}\right)} \cdot \left(b \cdot i + \frac{a \cdot i}{c}\right) \]
      6. unpow2N/A

        \[\leadsto \left(-2 \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot \left(b \cdot i + \frac{a \cdot i}{c}\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \left(-2 \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot \left(b \cdot i + \frac{a \cdot i}{c}\right) \]
      8. *-commutativeN/A

        \[\leadsto \left(-2 \cdot \left(c \cdot c\right)\right) \cdot \left(\color{blue}{i \cdot b} + \frac{a \cdot i}{c}\right) \]
      9. *-commutativeN/A

        \[\leadsto \left(-2 \cdot \left(c \cdot c\right)\right) \cdot \left(i \cdot b + \frac{\color{blue}{i \cdot a}}{c}\right) \]
      10. associate-/l*N/A

        \[\leadsto \left(-2 \cdot \left(c \cdot c\right)\right) \cdot \left(i \cdot b + \color{blue}{i \cdot \frac{a}{c}}\right) \]
      11. distribute-lft-outN/A

        \[\leadsto \left(-2 \cdot \left(c \cdot c\right)\right) \cdot \color{blue}{\left(i \cdot \left(b + \frac{a}{c}\right)\right)} \]
      12. *-lowering-*.f64N/A

        \[\leadsto \left(-2 \cdot \left(c \cdot c\right)\right) \cdot \color{blue}{\left(i \cdot \left(b + \frac{a}{c}\right)\right)} \]
      13. +-lowering-+.f64N/A

        \[\leadsto \left(-2 \cdot \left(c \cdot c\right)\right) \cdot \left(i \cdot \color{blue}{\left(b + \frac{a}{c}\right)}\right) \]
      14. /-lowering-/.f6470.6

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

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

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

Alternative 2: 84.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \mathsf{fma}\left(-i, c \cdot \mathsf{fma}\left(b, c, a\right), z \cdot t\right)\\ t_2 := \left(c \cdot \left(a + b \cdot c\right)\right) \cdot i\\ \mathbf{if}\;t\_2 \leq -4 \cdot 10^{+21}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 10^{+86}:\\ \;\;\;\;2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, i \cdot \left(b \cdot \left(c \cdot \left(-c\right)\right)\right)\right)\right)\\ \mathbf{elif}\;t\_2 \leq 10^{+298}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\left(-2 \cdot \left(c \cdot c\right)\right) \cdot \left(i \cdot \left(b + \frac{a}{c}\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (* 2.0 (fma (- i) (* c (fma b c a)) (* z t))))
        (t_2 (* (* c (+ a (* b c))) i)))
   (if (<= t_2 -4e+21)
     t_1
     (if (<= t_2 1e+86)
       (* 2.0 (fma x y (fma t z (* i (* b (* c (- c)))))))
       (if (<= t_2 1e+298) t_1 (* (* -2.0 (* c c)) (* i (+ b (/ a c)))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = 2.0 * fma(-i, (c * fma(b, c, a)), (z * t));
	double t_2 = (c * (a + (b * c))) * i;
	double tmp;
	if (t_2 <= -4e+21) {
		tmp = t_1;
	} else if (t_2 <= 1e+86) {
		tmp = 2.0 * fma(x, y, fma(t, z, (i * (b * (c * -c)))));
	} else if (t_2 <= 1e+298) {
		tmp = t_1;
	} else {
		tmp = (-2.0 * (c * c)) * (i * (b + (a / c)));
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(2.0 * fma(Float64(-i), Float64(c * fma(b, c, a)), Float64(z * t)))
	t_2 = Float64(Float64(c * Float64(a + Float64(b * c))) * i)
	tmp = 0.0
	if (t_2 <= -4e+21)
		tmp = t_1;
	elseif (t_2 <= 1e+86)
		tmp = Float64(2.0 * fma(x, y, fma(t, z, Float64(i * Float64(b * Float64(c * Float64(-c)))))));
	elseif (t_2 <= 1e+298)
		tmp = t_1;
	else
		tmp = Float64(Float64(-2.0 * Float64(c * c)) * Float64(i * Float64(b + Float64(a / c))));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(2.0 * N[((-i) * N[(c * N[(b * c + a), $MachinePrecision]), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c * N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, -4e+21], t$95$1, If[LessEqual[t$95$2, 1e+86], N[(2.0 * N[(x * y + N[(t * z + N[(i * N[(b * N[(c * (-c)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+298], t$95$1, N[(N[(-2.0 * N[(c * c), $MachinePrecision]), $MachinePrecision] * N[(i * N[(b + N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := 2 \cdot \mathsf{fma}\left(-i, c \cdot \mathsf{fma}\left(b, c, a\right), z \cdot t\right)\\
t_2 := \left(c \cdot \left(a + b \cdot c\right)\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 10^{+86}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, i \cdot \left(b \cdot \left(c \cdot \left(-c\right)\right)\right)\right)\right)\\

\mathbf{elif}\;t\_2 \leq 10^{+298}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -4e21 or 1e86 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.9999999999999996e297

    1. Initial program 85.9%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

        \[\leadsto 2 \cdot \color{blue}{\left(t \cdot z - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)} \]
      3. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \left(\color{blue}{t \cdot z} - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \left(t \cdot z - \color{blue}{c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)}\right) \]
      5. *-commutativeN/A

        \[\leadsto 2 \cdot \left(t \cdot z - c \cdot \color{blue}{\left(\left(a + b \cdot c\right) \cdot i\right)}\right) \]
      6. *-lowering-*.f64N/A

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

        \[\leadsto 2 \cdot \left(t \cdot z - c \cdot \left(\color{blue}{\left(b \cdot c + a\right)} \cdot i\right)\right) \]
      8. accelerator-lowering-fma.f6479.9

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z - c \cdot \left(\mathsf{fma}\left(b, c, a\right) \cdot i\right)\right)} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t \cdot z - c \cdot \left(\left(b \cdot c + a\right) \cdot i\right)\right) \cdot 2} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(t \cdot z - c \cdot \left(\left(b \cdot c + a\right) \cdot i\right)\right) \cdot 2} \]
      3. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(t \cdot z + \left(\mathsf{neg}\left(c\right)\right) \cdot \left(\left(b \cdot c + a\right) \cdot i\right)\right)} \cdot 2 \]
      4. *-commutativeN/A

        \[\leadsto \left(t \cdot z + \left(\mathsf{neg}\left(c\right)\right) \cdot \color{blue}{\left(i \cdot \left(b \cdot c + a\right)\right)}\right) \cdot 2 \]
      5. associate-*r*N/A

        \[\leadsto \left(t \cdot z + \color{blue}{\left(\left(\mathsf{neg}\left(c\right)\right) \cdot i\right) \cdot \left(b \cdot c + a\right)}\right) \cdot 2 \]
      6. distribute-lft-neg-inN/A

        \[\leadsto \left(t \cdot z + \color{blue}{\left(\mathsf{neg}\left(c \cdot i\right)\right)} \cdot \left(b \cdot c + a\right)\right) \cdot 2 \]
      7. distribute-rgt-neg-outN/A

        \[\leadsto \left(t \cdot z + \color{blue}{\left(c \cdot \left(\mathsf{neg}\left(i\right)\right)\right)} \cdot \left(b \cdot c + a\right)\right) \cdot 2 \]
      8. *-commutativeN/A

        \[\leadsto \left(t \cdot z + \color{blue}{\left(b \cdot c + a\right) \cdot \left(c \cdot \left(\mathsf{neg}\left(i\right)\right)\right)}\right) \cdot 2 \]
      9. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\left(b \cdot c + a\right) \cdot \left(c \cdot \left(\mathsf{neg}\left(i\right)\right)\right) + t \cdot z\right)} \cdot 2 \]
      10. associate-*r*N/A

        \[\leadsto \left(\color{blue}{\left(\left(b \cdot c + a\right) \cdot c\right) \cdot \left(\mathsf{neg}\left(i\right)\right)} + t \cdot z\right) \cdot 2 \]
      11. *-commutativeN/A

        \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(i\right)\right) \cdot \left(\left(b \cdot c + a\right) \cdot c\right)} + t \cdot z\right) \cdot 2 \]
      12. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(i\right), \left(b \cdot c + a\right) \cdot c, t \cdot z\right)} \cdot 2 \]
      13. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(i\right)}, \left(b \cdot c + a\right) \cdot c, t \cdot z\right) \cdot 2 \]
      14. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(i\right), \color{blue}{c \cdot \left(b \cdot c + a\right)}, t \cdot z\right) \cdot 2 \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(i\right), \color{blue}{c \cdot \left(b \cdot c + a\right)}, t \cdot z\right) \cdot 2 \]
      16. accelerator-lowering-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(i\right), c \cdot \color{blue}{\mathsf{fma}\left(b, c, a\right)}, t \cdot z\right) \cdot 2 \]
      17. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(i\right), c \cdot \mathsf{fma}\left(b, c, a\right), \color{blue}{z \cdot t}\right) \cdot 2 \]
      18. *-lowering-*.f6487.9

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

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

    if -4e21 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1e86

    1. Initial program 99.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(\left(t \cdot z + x \cdot y\right) - b \cdot \left({c}^{2} \cdot i\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{2 \cdot \left(\left(t \cdot z + x \cdot y\right) - b \cdot \left({c}^{2} \cdot i\right)\right)} \]
      2. sub-negN/A

        \[\leadsto 2 \cdot \color{blue}{\left(\left(t \cdot z + x \cdot y\right) + \left(\mathsf{neg}\left(b \cdot \left({c}^{2} \cdot i\right)\right)\right)\right)} \]
      3. +-commutativeN/A

        \[\leadsto 2 \cdot \color{blue}{\left(\left(\mathsf{neg}\left(b \cdot \left({c}^{2} \cdot i\right)\right)\right) + \left(t \cdot z + x \cdot y\right)\right)} \]
      4. associate-+r+N/A

        \[\leadsto 2 \cdot \color{blue}{\left(\left(\left(\mathsf{neg}\left(b \cdot \left({c}^{2} \cdot i\right)\right)\right) + t \cdot z\right) + x \cdot y\right)} \]
      5. +-commutativeN/A

        \[\leadsto 2 \cdot \color{blue}{\left(x \cdot y + \left(\left(\mathsf{neg}\left(b \cdot \left({c}^{2} \cdot i\right)\right)\right) + t \cdot z\right)\right)} \]
      6. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \color{blue}{\mathsf{fma}\left(x, y, \left(\mathsf{neg}\left(b \cdot \left({c}^{2} \cdot i\right)\right)\right) + t \cdot z\right)} \]
      7. +-commutativeN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \color{blue}{t \cdot z + \left(\mathsf{neg}\left(b \cdot \left({c}^{2} \cdot i\right)\right)\right)}\right) \]
      8. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \color{blue}{\mathsf{fma}\left(t, z, \mathsf{neg}\left(b \cdot \left({c}^{2} \cdot i\right)\right)\right)}\right) \]
      9. *-commutativeN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, \mathsf{neg}\left(\color{blue}{\left({c}^{2} \cdot i\right) \cdot b}\right)\right)\right) \]
      10. *-commutativeN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, \mathsf{neg}\left(\color{blue}{\left(i \cdot {c}^{2}\right)} \cdot b\right)\right)\right) \]
      11. associate-*l*N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, \mathsf{neg}\left(\color{blue}{i \cdot \left({c}^{2} \cdot b\right)}\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, \mathsf{neg}\left(i \cdot \color{blue}{\left(b \cdot {c}^{2}\right)}\right)\right)\right) \]
      13. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, \color{blue}{i \cdot \left(\mathsf{neg}\left(b \cdot {c}^{2}\right)\right)}\right)\right) \]
      14. mul-1-negN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, i \cdot \color{blue}{\left(-1 \cdot \left(b \cdot {c}^{2}\right)\right)}\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, \color{blue}{i \cdot \left(-1 \cdot \left(b \cdot {c}^{2}\right)\right)}\right)\right) \]
      16. mul-1-negN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, i \cdot \color{blue}{\left(\mathsf{neg}\left(b \cdot {c}^{2}\right)\right)}\right)\right) \]
      17. distribute-rgt-neg-outN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, i \cdot \color{blue}{\left(b \cdot \left(\mathsf{neg}\left({c}^{2}\right)\right)\right)}\right)\right) \]
      18. mul-1-negN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, i \cdot \left(b \cdot \color{blue}{\left(-1 \cdot {c}^{2}\right)}\right)\right)\right) \]
      19. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, i \cdot \color{blue}{\left(b \cdot \left(-1 \cdot {c}^{2}\right)\right)}\right)\right) \]
      20. mul-1-negN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, i \cdot \left(b \cdot \color{blue}{\left(\mathsf{neg}\left({c}^{2}\right)\right)}\right)\right)\right) \]
      21. unpow2N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, i \cdot \left(b \cdot \left(\mathsf{neg}\left(\color{blue}{c \cdot c}\right)\right)\right)\right)\right) \]
      22. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, i \cdot \left(b \cdot \color{blue}{\left(c \cdot \left(\mathsf{neg}\left(c\right)\right)\right)}\right)\right)\right) \]
      23. mul-1-negN/A

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

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

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

    1. Initial program 77.5%

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

      \[\leadsto \color{blue}{{c}^{2} \cdot \left(-2 \cdot \left(b \cdot i\right) + -2 \cdot \frac{a \cdot i}{c}\right)} \]
    4. Step-by-step derivation
      1. distribute-lft-outN/A

        \[\leadsto {c}^{2} \cdot \color{blue}{\left(-2 \cdot \left(b \cdot i + \frac{a \cdot i}{c}\right)\right)} \]
      2. associate-*r*N/A

        \[\leadsto \color{blue}{\left({c}^{2} \cdot -2\right) \cdot \left(b \cdot i + \frac{a \cdot i}{c}\right)} \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\left(-2 \cdot {c}^{2}\right)} \cdot \left(b \cdot i + \frac{a \cdot i}{c}\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(-2 \cdot {c}^{2}\right) \cdot \left(b \cdot i + \frac{a \cdot i}{c}\right)} \]
      5. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(-2 \cdot {c}^{2}\right)} \cdot \left(b \cdot i + \frac{a \cdot i}{c}\right) \]
      6. unpow2N/A

        \[\leadsto \left(-2 \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot \left(b \cdot i + \frac{a \cdot i}{c}\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \left(-2 \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot \left(b \cdot i + \frac{a \cdot i}{c}\right) \]
      8. *-commutativeN/A

        \[\leadsto \left(-2 \cdot \left(c \cdot c\right)\right) \cdot \left(\color{blue}{i \cdot b} + \frac{a \cdot i}{c}\right) \]
      9. *-commutativeN/A

        \[\leadsto \left(-2 \cdot \left(c \cdot c\right)\right) \cdot \left(i \cdot b + \frac{\color{blue}{i \cdot a}}{c}\right) \]
      10. associate-/l*N/A

        \[\leadsto \left(-2 \cdot \left(c \cdot c\right)\right) \cdot \left(i \cdot b + \color{blue}{i \cdot \frac{a}{c}}\right) \]
      11. distribute-lft-outN/A

        \[\leadsto \left(-2 \cdot \left(c \cdot c\right)\right) \cdot \color{blue}{\left(i \cdot \left(b + \frac{a}{c}\right)\right)} \]
      12. *-lowering-*.f64N/A

        \[\leadsto \left(-2 \cdot \left(c \cdot c\right)\right) \cdot \color{blue}{\left(i \cdot \left(b + \frac{a}{c}\right)\right)} \]
      13. +-lowering-+.f64N/A

        \[\leadsto \left(-2 \cdot \left(c \cdot c\right)\right) \cdot \left(i \cdot \color{blue}{\left(b + \frac{a}{c}\right)}\right) \]
      14. /-lowering-/.f6495.8

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

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

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

Alternative 3: 41.9% accurate, 0.5× speedup?

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

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

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

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+94}:\\
\;\;\;\;x \cdot \left(y \cdot 2\right)\\

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


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

    1. Initial program 81.5%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-negN/A

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

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

        \[\leadsto 2 \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left(a + b \cdot c\right) \cdot \left(c \cdot i\right)}\right)\right) + \left(x \cdot y + z \cdot t\right)\right) \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \left(\color{blue}{\left(a + b \cdot c\right) \cdot \left(\mathsf{neg}\left(c \cdot i\right)\right)} + \left(x \cdot y + z \cdot t\right)\right) \]
      5. accelerator-lowering-fma.f64N/A

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

        \[\leadsto 2 \cdot \mathsf{fma}\left(\color{blue}{b \cdot c + a}, \mathsf{neg}\left(c \cdot i\right), x \cdot y + z \cdot t\right) \]
      7. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, c, a\right)}, \mathsf{neg}\left(c \cdot i\right), x \cdot y + z \cdot t\right) \]
      8. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), \color{blue}{c \cdot \left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), \color{blue}{c \cdot \left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      10. neg-lowering-neg.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \color{blue}{\left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      11. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(\mathsf{neg}\left(i\right)\right), \color{blue}{\mathsf{fma}\left(x, y, z \cdot t\right)}\right) \]
      12. *-lowering-*.f6491.3

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

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

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

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

        \[\leadsto \color{blue}{a \cdot \left(\left(c \cdot i\right) \cdot -2\right)} \]
      3. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(-2 \cdot \left(c \cdot i\right)\right)} \]
      4. *-lowering-*.f64N/A

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

        \[\leadsto a \cdot \color{blue}{\left(\left(c \cdot i\right) \cdot -2\right)} \]
      6. associate-*l*N/A

        \[\leadsto a \cdot \color{blue}{\left(c \cdot \left(i \cdot -2\right)\right)} \]
      7. *-lowering-*.f64N/A

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

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

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

    if -1.99999999999999981e187 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.99999999999999981e-81

    1. Initial program 99.5%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t \cdot z\right) \cdot 2} \]
      2. associate-*r*N/A

        \[\leadsto \color{blue}{t \cdot \left(z \cdot 2\right)} \]
      3. *-commutativeN/A

        \[\leadsto t \cdot \color{blue}{\left(2 \cdot z\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{t \cdot \left(2 \cdot z\right)} \]
      5. *-commutativeN/A

        \[\leadsto t \cdot \color{blue}{\left(z \cdot 2\right)} \]
      6. *-lowering-*.f6456.7

        \[\leadsto t \cdot \color{blue}{\left(z \cdot 2\right)} \]
    5. Simplified56.7%

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

    if 4.99999999999999981e-81 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.0000000000000001e94

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot y\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot 2} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot 2} \]
      3. *-lowering-*.f6454.9

        \[\leadsto \color{blue}{\left(x \cdot y\right)} \cdot 2 \]
    5. Simplified54.9%

      \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot 2} \]
    6. Step-by-step derivation
      1. associate-*l*N/A

        \[\leadsto \color{blue}{x \cdot \left(y \cdot 2\right)} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(y \cdot 2\right) \cdot x} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(y \cdot 2\right) \cdot x} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(2 \cdot y\right)} \cdot x \]
      5. *-lowering-*.f6454.9

        \[\leadsto \color{blue}{\left(2 \cdot y\right)} \cdot x \]
    7. Applied egg-rr54.9%

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

    if 5.0000000000000001e94 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 81.5%

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

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

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

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

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

        \[\leadsto \color{blue}{c \cdot \left(-2 \cdot \left(a \cdot i\right)\right)} \]
      5. *-lowering-*.f64N/A

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

        \[\leadsto c \cdot \color{blue}{\left(\left(a \cdot i\right) \cdot -2\right)} \]
      7. associate-*l*N/A

        \[\leadsto c \cdot \color{blue}{\left(a \cdot \left(i \cdot -2\right)\right)} \]
      8. *-lowering-*.f64N/A

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

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

      \[\leadsto \color{blue}{c \cdot \left(a \cdot \left(i \cdot -2\right)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

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

        \[\leadsto \color{blue}{\left(i \cdot -2\right) \cdot \left(c \cdot a\right)} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(i \cdot -2\right) \cdot \left(c \cdot a\right)} \]
      4. *-lowering-*.f64N/A

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

        \[\leadsto \left(i \cdot -2\right) \cdot \color{blue}{\left(c \cdot a\right)} \]
    7. Applied egg-rr42.2%

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

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

Alternative 4: 43.1% accurate, 0.5× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -1.99999999999999981e187 or 5.0000000000000001e94 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 81.5%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-negN/A

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

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

        \[\leadsto 2 \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left(a + b \cdot c\right) \cdot \left(c \cdot i\right)}\right)\right) + \left(x \cdot y + z \cdot t\right)\right) \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \left(\color{blue}{\left(a + b \cdot c\right) \cdot \left(\mathsf{neg}\left(c \cdot i\right)\right)} + \left(x \cdot y + z \cdot t\right)\right) \]
      5. accelerator-lowering-fma.f64N/A

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

        \[\leadsto 2 \cdot \mathsf{fma}\left(\color{blue}{b \cdot c + a}, \mathsf{neg}\left(c \cdot i\right), x \cdot y + z \cdot t\right) \]
      7. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, c, a\right)}, \mathsf{neg}\left(c \cdot i\right), x \cdot y + z \cdot t\right) \]
      8. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), \color{blue}{c \cdot \left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), \color{blue}{c \cdot \left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      10. neg-lowering-neg.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \color{blue}{\left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      11. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(\mathsf{neg}\left(i\right)\right), \color{blue}{\mathsf{fma}\left(x, y, z \cdot t\right)}\right) \]
      12. *-lowering-*.f6490.9

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

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

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

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

        \[\leadsto \color{blue}{a \cdot \left(\left(c \cdot i\right) \cdot -2\right)} \]
      3. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(-2 \cdot \left(c \cdot i\right)\right)} \]
      4. *-lowering-*.f64N/A

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

        \[\leadsto a \cdot \color{blue}{\left(\left(c \cdot i\right) \cdot -2\right)} \]
      6. associate-*l*N/A

        \[\leadsto a \cdot \color{blue}{\left(c \cdot \left(i \cdot -2\right)\right)} \]
      7. *-lowering-*.f64N/A

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

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

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

    if -1.99999999999999981e187 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.99999999999999981e-81

    1. Initial program 99.5%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t \cdot z\right) \cdot 2} \]
      2. associate-*r*N/A

        \[\leadsto \color{blue}{t \cdot \left(z \cdot 2\right)} \]
      3. *-commutativeN/A

        \[\leadsto t \cdot \color{blue}{\left(2 \cdot z\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{t \cdot \left(2 \cdot z\right)} \]
      5. *-commutativeN/A

        \[\leadsto t \cdot \color{blue}{\left(z \cdot 2\right)} \]
      6. *-lowering-*.f6456.7

        \[\leadsto t \cdot \color{blue}{\left(z \cdot 2\right)} \]
    5. Simplified56.7%

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

    if 4.99999999999999981e-81 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.0000000000000001e94

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot y\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot 2} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot 2} \]
      3. *-lowering-*.f6454.9

        \[\leadsto \color{blue}{\left(x \cdot y\right)} \cdot 2 \]
    5. Simplified54.9%

      \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot 2} \]
    6. Step-by-step derivation
      1. associate-*l*N/A

        \[\leadsto \color{blue}{x \cdot \left(y \cdot 2\right)} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(y \cdot 2\right) \cdot x} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(y \cdot 2\right) \cdot x} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(2 \cdot y\right)} \cdot x \]
      5. *-lowering-*.f6454.9

        \[\leadsto \color{blue}{\left(2 \cdot y\right)} \cdot x \]
    7. Applied egg-rr54.9%

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

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

Alternative 5: 83.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_1 := 2 \cdot \mathsf{fma}\left(-i, c \cdot \mathsf{fma}\left(b, c, a\right), z \cdot t\right)\\
t_2 := \left(c \cdot \left(a + b \cdot c\right)\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 10^{+86}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, i \cdot \left(b \cdot \left(c \cdot \left(-c\right)\right)\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -4e21 or 1e86 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 83.1%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

        \[\leadsto 2 \cdot \color{blue}{\left(t \cdot z - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)} \]
      3. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \left(\color{blue}{t \cdot z} - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \left(t \cdot z - \color{blue}{c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)}\right) \]
      5. *-commutativeN/A

        \[\leadsto 2 \cdot \left(t \cdot z - c \cdot \color{blue}{\left(\left(a + b \cdot c\right) \cdot i\right)}\right) \]
      6. *-lowering-*.f64N/A

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

        \[\leadsto 2 \cdot \left(t \cdot z - c \cdot \left(\color{blue}{\left(b \cdot c + a\right)} \cdot i\right)\right) \]
      8. accelerator-lowering-fma.f6483.1

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z - c \cdot \left(\mathsf{fma}\left(b, c, a\right) \cdot i\right)\right)} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t \cdot z - c \cdot \left(\left(b \cdot c + a\right) \cdot i\right)\right) \cdot 2} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(t \cdot z - c \cdot \left(\left(b \cdot c + a\right) \cdot i\right)\right) \cdot 2} \]
      3. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(t \cdot z + \left(\mathsf{neg}\left(c\right)\right) \cdot \left(\left(b \cdot c + a\right) \cdot i\right)\right)} \cdot 2 \]
      4. *-commutativeN/A

        \[\leadsto \left(t \cdot z + \left(\mathsf{neg}\left(c\right)\right) \cdot \color{blue}{\left(i \cdot \left(b \cdot c + a\right)\right)}\right) \cdot 2 \]
      5. associate-*r*N/A

        \[\leadsto \left(t \cdot z + \color{blue}{\left(\left(\mathsf{neg}\left(c\right)\right) \cdot i\right) \cdot \left(b \cdot c + a\right)}\right) \cdot 2 \]
      6. distribute-lft-neg-inN/A

        \[\leadsto \left(t \cdot z + \color{blue}{\left(\mathsf{neg}\left(c \cdot i\right)\right)} \cdot \left(b \cdot c + a\right)\right) \cdot 2 \]
      7. distribute-rgt-neg-outN/A

        \[\leadsto \left(t \cdot z + \color{blue}{\left(c \cdot \left(\mathsf{neg}\left(i\right)\right)\right)} \cdot \left(b \cdot c + a\right)\right) \cdot 2 \]
      8. *-commutativeN/A

        \[\leadsto \left(t \cdot z + \color{blue}{\left(b \cdot c + a\right) \cdot \left(c \cdot \left(\mathsf{neg}\left(i\right)\right)\right)}\right) \cdot 2 \]
      9. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\left(b \cdot c + a\right) \cdot \left(c \cdot \left(\mathsf{neg}\left(i\right)\right)\right) + t \cdot z\right)} \cdot 2 \]
      10. associate-*r*N/A

        \[\leadsto \left(\color{blue}{\left(\left(b \cdot c + a\right) \cdot c\right) \cdot \left(\mathsf{neg}\left(i\right)\right)} + t \cdot z\right) \cdot 2 \]
      11. *-commutativeN/A

        \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(i\right)\right) \cdot \left(\left(b \cdot c + a\right) \cdot c\right)} + t \cdot z\right) \cdot 2 \]
      12. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(i\right), \left(b \cdot c + a\right) \cdot c, t \cdot z\right)} \cdot 2 \]
      13. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(i\right)}, \left(b \cdot c + a\right) \cdot c, t \cdot z\right) \cdot 2 \]
      14. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(i\right), \color{blue}{c \cdot \left(b \cdot c + a\right)}, t \cdot z\right) \cdot 2 \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(i\right), \color{blue}{c \cdot \left(b \cdot c + a\right)}, t \cdot z\right) \cdot 2 \]
      16. accelerator-lowering-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(i\right), c \cdot \color{blue}{\mathsf{fma}\left(b, c, a\right)}, t \cdot z\right) \cdot 2 \]
      17. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(i\right), c \cdot \mathsf{fma}\left(b, c, a\right), \color{blue}{z \cdot t}\right) \cdot 2 \]
      18. *-lowering-*.f6487.2

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

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

    if -4e21 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1e86

    1. Initial program 99.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(\left(t \cdot z + x \cdot y\right) - b \cdot \left({c}^{2} \cdot i\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{2 \cdot \left(\left(t \cdot z + x \cdot y\right) - b \cdot \left({c}^{2} \cdot i\right)\right)} \]
      2. sub-negN/A

        \[\leadsto 2 \cdot \color{blue}{\left(\left(t \cdot z + x \cdot y\right) + \left(\mathsf{neg}\left(b \cdot \left({c}^{2} \cdot i\right)\right)\right)\right)} \]
      3. +-commutativeN/A

        \[\leadsto 2 \cdot \color{blue}{\left(\left(\mathsf{neg}\left(b \cdot \left({c}^{2} \cdot i\right)\right)\right) + \left(t \cdot z + x \cdot y\right)\right)} \]
      4. associate-+r+N/A

        \[\leadsto 2 \cdot \color{blue}{\left(\left(\left(\mathsf{neg}\left(b \cdot \left({c}^{2} \cdot i\right)\right)\right) + t \cdot z\right) + x \cdot y\right)} \]
      5. +-commutativeN/A

        \[\leadsto 2 \cdot \color{blue}{\left(x \cdot y + \left(\left(\mathsf{neg}\left(b \cdot \left({c}^{2} \cdot i\right)\right)\right) + t \cdot z\right)\right)} \]
      6. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \color{blue}{\mathsf{fma}\left(x, y, \left(\mathsf{neg}\left(b \cdot \left({c}^{2} \cdot i\right)\right)\right) + t \cdot z\right)} \]
      7. +-commutativeN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \color{blue}{t \cdot z + \left(\mathsf{neg}\left(b \cdot \left({c}^{2} \cdot i\right)\right)\right)}\right) \]
      8. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \color{blue}{\mathsf{fma}\left(t, z, \mathsf{neg}\left(b \cdot \left({c}^{2} \cdot i\right)\right)\right)}\right) \]
      9. *-commutativeN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, \mathsf{neg}\left(\color{blue}{\left({c}^{2} \cdot i\right) \cdot b}\right)\right)\right) \]
      10. *-commutativeN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, \mathsf{neg}\left(\color{blue}{\left(i \cdot {c}^{2}\right)} \cdot b\right)\right)\right) \]
      11. associate-*l*N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, \mathsf{neg}\left(\color{blue}{i \cdot \left({c}^{2} \cdot b\right)}\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, \mathsf{neg}\left(i \cdot \color{blue}{\left(b \cdot {c}^{2}\right)}\right)\right)\right) \]
      13. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, \color{blue}{i \cdot \left(\mathsf{neg}\left(b \cdot {c}^{2}\right)\right)}\right)\right) \]
      14. mul-1-negN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, i \cdot \color{blue}{\left(-1 \cdot \left(b \cdot {c}^{2}\right)\right)}\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, \color{blue}{i \cdot \left(-1 \cdot \left(b \cdot {c}^{2}\right)\right)}\right)\right) \]
      16. mul-1-negN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, i \cdot \color{blue}{\left(\mathsf{neg}\left(b \cdot {c}^{2}\right)\right)}\right)\right) \]
      17. distribute-rgt-neg-outN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, i \cdot \color{blue}{\left(b \cdot \left(\mathsf{neg}\left({c}^{2}\right)\right)\right)}\right)\right) \]
      18. mul-1-negN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, i \cdot \left(b \cdot \color{blue}{\left(-1 \cdot {c}^{2}\right)}\right)\right)\right) \]
      19. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, i \cdot \color{blue}{\left(b \cdot \left(-1 \cdot {c}^{2}\right)\right)}\right)\right) \]
      20. mul-1-negN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, i \cdot \left(b \cdot \color{blue}{\left(\mathsf{neg}\left({c}^{2}\right)\right)}\right)\right)\right) \]
      21. unpow2N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, i \cdot \left(b \cdot \left(\mathsf{neg}\left(\color{blue}{c \cdot c}\right)\right)\right)\right)\right) \]
      22. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, i \cdot \left(b \cdot \color{blue}{\left(c \cdot \left(\mathsf{neg}\left(c\right)\right)\right)}\right)\right)\right) \]
      23. mul-1-negN/A

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

      \[\leadsto \color{blue}{2 \cdot \mathsf{fma}\left(x, y, \mathsf{fma}\left(t, z, i \cdot \left(b \cdot \left(c \cdot \left(-c\right)\right)\right)\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification90.3%

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

Alternative 6: 83.3% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_1 := 2 \cdot \mathsf{fma}\left(-i, c \cdot \mathsf{fma}\left(b, c, a\right), z \cdot t\right)\\
t_2 := \left(c \cdot \left(a + b \cdot c\right)\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 10^{+86}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -4e21 or 1e86 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 83.1%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

        \[\leadsto 2 \cdot \color{blue}{\left(t \cdot z - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)} \]
      3. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \left(\color{blue}{t \cdot z} - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \left(t \cdot z - \color{blue}{c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)}\right) \]
      5. *-commutativeN/A

        \[\leadsto 2 \cdot \left(t \cdot z - c \cdot \color{blue}{\left(\left(a + b \cdot c\right) \cdot i\right)}\right) \]
      6. *-lowering-*.f64N/A

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

        \[\leadsto 2 \cdot \left(t \cdot z - c \cdot \left(\color{blue}{\left(b \cdot c + a\right)} \cdot i\right)\right) \]
      8. accelerator-lowering-fma.f6483.1

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z - c \cdot \left(\mathsf{fma}\left(b, c, a\right) \cdot i\right)\right)} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t \cdot z - c \cdot \left(\left(b \cdot c + a\right) \cdot i\right)\right) \cdot 2} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(t \cdot z - c \cdot \left(\left(b \cdot c + a\right) \cdot i\right)\right) \cdot 2} \]
      3. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(t \cdot z + \left(\mathsf{neg}\left(c\right)\right) \cdot \left(\left(b \cdot c + a\right) \cdot i\right)\right)} \cdot 2 \]
      4. *-commutativeN/A

        \[\leadsto \left(t \cdot z + \left(\mathsf{neg}\left(c\right)\right) \cdot \color{blue}{\left(i \cdot \left(b \cdot c + a\right)\right)}\right) \cdot 2 \]
      5. associate-*r*N/A

        \[\leadsto \left(t \cdot z + \color{blue}{\left(\left(\mathsf{neg}\left(c\right)\right) \cdot i\right) \cdot \left(b \cdot c + a\right)}\right) \cdot 2 \]
      6. distribute-lft-neg-inN/A

        \[\leadsto \left(t \cdot z + \color{blue}{\left(\mathsf{neg}\left(c \cdot i\right)\right)} \cdot \left(b \cdot c + a\right)\right) \cdot 2 \]
      7. distribute-rgt-neg-outN/A

        \[\leadsto \left(t \cdot z + \color{blue}{\left(c \cdot \left(\mathsf{neg}\left(i\right)\right)\right)} \cdot \left(b \cdot c + a\right)\right) \cdot 2 \]
      8. *-commutativeN/A

        \[\leadsto \left(t \cdot z + \color{blue}{\left(b \cdot c + a\right) \cdot \left(c \cdot \left(\mathsf{neg}\left(i\right)\right)\right)}\right) \cdot 2 \]
      9. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\left(b \cdot c + a\right) \cdot \left(c \cdot \left(\mathsf{neg}\left(i\right)\right)\right) + t \cdot z\right)} \cdot 2 \]
      10. associate-*r*N/A

        \[\leadsto \left(\color{blue}{\left(\left(b \cdot c + a\right) \cdot c\right) \cdot \left(\mathsf{neg}\left(i\right)\right)} + t \cdot z\right) \cdot 2 \]
      11. *-commutativeN/A

        \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(i\right)\right) \cdot \left(\left(b \cdot c + a\right) \cdot c\right)} + t \cdot z\right) \cdot 2 \]
      12. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(i\right), \left(b \cdot c + a\right) \cdot c, t \cdot z\right)} \cdot 2 \]
      13. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(i\right)}, \left(b \cdot c + a\right) \cdot c, t \cdot z\right) \cdot 2 \]
      14. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(i\right), \color{blue}{c \cdot \left(b \cdot c + a\right)}, t \cdot z\right) \cdot 2 \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(i\right), \color{blue}{c \cdot \left(b \cdot c + a\right)}, t \cdot z\right) \cdot 2 \]
      16. accelerator-lowering-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(i\right), c \cdot \color{blue}{\mathsf{fma}\left(b, c, a\right)}, t \cdot z\right) \cdot 2 \]
      17. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(i\right), c \cdot \mathsf{fma}\left(b, c, a\right), \color{blue}{z \cdot t}\right) \cdot 2 \]
      18. *-lowering-*.f6487.2

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

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

    if -4e21 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1e86

    1. Initial program 99.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z + x \cdot y\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right) \cdot 2} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right) \cdot 2} \]
      3. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, z, x \cdot y\right)} \cdot 2 \]
      4. *-lowering-*.f6491.9

        \[\leadsto \mathsf{fma}\left(t, z, \color{blue}{x \cdot y}\right) \cdot 2 \]
    5. Simplified91.9%

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

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

Alternative 7: 93.1% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\left(-2 \cdot \left(c \cdot c\right)\right) \cdot \left(i \cdot \left(b + \frac{a}{c}\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 96.6%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate--l+N/A

        \[\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. +-commutativeN/A

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

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

        \[\leadsto 2 \cdot \color{blue}{\left(z \cdot t + \left(\left(\mathsf{neg}\left(\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)\right) + x \cdot y\right)\right)} \]
      5. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \color{blue}{\mathsf{fma}\left(z, t, \left(\mathsf{neg}\left(\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)\right) + x \cdot y\right)} \]
      6. *-commutativeN/A

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

        \[\leadsto 2 \cdot \mathsf{fma}\left(z, t, \left(\mathsf{neg}\left(\color{blue}{c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)}\right)\right) + x \cdot y\right) \]
      8. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(z, t, \color{blue}{c \cdot \left(\mathsf{neg}\left(\left(a + b \cdot c\right) \cdot i\right)\right)} + x \cdot y\right) \]
      9. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(z, t, \color{blue}{\mathsf{fma}\left(c, \mathsf{neg}\left(\left(a + b \cdot c\right) \cdot i\right), x \cdot y\right)}\right) \]
      10. neg-lowering-neg.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(z, t, \mathsf{fma}\left(c, \color{blue}{\mathsf{neg}\left(\left(a + b \cdot c\right) \cdot i\right)}, x \cdot y\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(z, t, \mathsf{fma}\left(c, \mathsf{neg}\left(\color{blue}{\left(a + b \cdot c\right) \cdot i}\right), x \cdot y\right)\right) \]
      12. +-commutativeN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(z, t, \mathsf{fma}\left(c, \mathsf{neg}\left(\color{blue}{\left(b \cdot c + a\right)} \cdot i\right), x \cdot y\right)\right) \]
      13. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(z, t, \mathsf{fma}\left(c, \mathsf{neg}\left(\color{blue}{\mathsf{fma}\left(b, c, a\right)} \cdot i\right), x \cdot y\right)\right) \]
      14. *-lowering-*.f6496.0

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

      \[\leadsto 2 \cdot \color{blue}{\mathsf{fma}\left(z, t, \mathsf{fma}\left(c, -\mathsf{fma}\left(b, c, a\right) \cdot i, x \cdot y\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. Add Preprocessing
    3. Taylor expanded in c around inf

      \[\leadsto \color{blue}{{c}^{2} \cdot \left(-2 \cdot \left(b \cdot i\right) + -2 \cdot \frac{a \cdot i}{c}\right)} \]
    4. Step-by-step derivation
      1. distribute-lft-outN/A

        \[\leadsto {c}^{2} \cdot \color{blue}{\left(-2 \cdot \left(b \cdot i + \frac{a \cdot i}{c}\right)\right)} \]
      2. associate-*r*N/A

        \[\leadsto \color{blue}{\left({c}^{2} \cdot -2\right) \cdot \left(b \cdot i + \frac{a \cdot i}{c}\right)} \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\left(-2 \cdot {c}^{2}\right)} \cdot \left(b \cdot i + \frac{a \cdot i}{c}\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(-2 \cdot {c}^{2}\right) \cdot \left(b \cdot i + \frac{a \cdot i}{c}\right)} \]
      5. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(-2 \cdot {c}^{2}\right)} \cdot \left(b \cdot i + \frac{a \cdot i}{c}\right) \]
      6. unpow2N/A

        \[\leadsto \left(-2 \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot \left(b \cdot i + \frac{a \cdot i}{c}\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \left(-2 \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot \left(b \cdot i + \frac{a \cdot i}{c}\right) \]
      8. *-commutativeN/A

        \[\leadsto \left(-2 \cdot \left(c \cdot c\right)\right) \cdot \left(\color{blue}{i \cdot b} + \frac{a \cdot i}{c}\right) \]
      9. *-commutativeN/A

        \[\leadsto \left(-2 \cdot \left(c \cdot c\right)\right) \cdot \left(i \cdot b + \frac{\color{blue}{i \cdot a}}{c}\right) \]
      10. associate-/l*N/A

        \[\leadsto \left(-2 \cdot \left(c \cdot c\right)\right) \cdot \left(i \cdot b + \color{blue}{i \cdot \frac{a}{c}}\right) \]
      11. distribute-lft-outN/A

        \[\leadsto \left(-2 \cdot \left(c \cdot c\right)\right) \cdot \color{blue}{\left(i \cdot \left(b + \frac{a}{c}\right)\right)} \]
      12. *-lowering-*.f64N/A

        \[\leadsto \left(-2 \cdot \left(c \cdot c\right)\right) \cdot \color{blue}{\left(i \cdot \left(b + \frac{a}{c}\right)\right)} \]
      13. +-lowering-+.f64N/A

        \[\leadsto \left(-2 \cdot \left(c \cdot c\right)\right) \cdot \left(i \cdot \color{blue}{\left(b + \frac{a}{c}\right)}\right) \]
      14. /-lowering-/.f6470.6

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

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

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

Alternative 8: 85.4% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+94}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\

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


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

    1. Initial program 83.0%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-negN/A

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

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

        \[\leadsto 2 \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left(a + b \cdot c\right) \cdot \left(c \cdot i\right)}\right)\right) + \left(x \cdot y + z \cdot t\right)\right) \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \left(\color{blue}{\left(a + b \cdot c\right) \cdot \left(\mathsf{neg}\left(c \cdot i\right)\right)} + \left(x \cdot y + z \cdot t\right)\right) \]
      5. accelerator-lowering-fma.f64N/A

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

        \[\leadsto 2 \cdot \mathsf{fma}\left(\color{blue}{b \cdot c + a}, \mathsf{neg}\left(c \cdot i\right), x \cdot y + z \cdot t\right) \]
      7. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, c, a\right)}, \mathsf{neg}\left(c \cdot i\right), x \cdot y + z \cdot t\right) \]
      8. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), \color{blue}{c \cdot \left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), \color{blue}{c \cdot \left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      10. neg-lowering-neg.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \color{blue}{\left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      11. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(\mathsf{neg}\left(i\right)\right), \color{blue}{\mathsf{fma}\left(x, y, z \cdot t\right)}\right) \]
      12. *-lowering-*.f6491.9

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

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

      \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(\mathsf{neg}\left(i\right)\right), \color{blue}{x \cdot y}\right) \]
    6. Step-by-step derivation
      1. *-lowering-*.f6487.3

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

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

    if -1e115 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.0000000000000001e94

    1. Initial program 99.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z + x \cdot y\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right) \cdot 2} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right) \cdot 2} \]
      3. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, z, x \cdot y\right)} \cdot 2 \]
      4. *-lowering-*.f6490.7

        \[\leadsto \mathsf{fma}\left(t, z, \color{blue}{x \cdot y}\right) \cdot 2 \]
    5. Simplified90.7%

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

    if 5.0000000000000001e94 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 81.5%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-negN/A

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

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

        \[\leadsto 2 \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left(a + b \cdot c\right) \cdot \left(c \cdot i\right)}\right)\right) + \left(x \cdot y + z \cdot t\right)\right) \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \left(\color{blue}{\left(a + b \cdot c\right) \cdot \left(\mathsf{neg}\left(c \cdot i\right)\right)} + \left(x \cdot y + z \cdot t\right)\right) \]
      5. accelerator-lowering-fma.f64N/A

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

        \[\leadsto 2 \cdot \mathsf{fma}\left(\color{blue}{b \cdot c + a}, \mathsf{neg}\left(c \cdot i\right), x \cdot y + z \cdot t\right) \]
      7. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, c, a\right)}, \mathsf{neg}\left(c \cdot i\right), x \cdot y + z \cdot t\right) \]
      8. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), \color{blue}{c \cdot \left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), \color{blue}{c \cdot \left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      10. neg-lowering-neg.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \color{blue}{\left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      11. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(\mathsf{neg}\left(i\right)\right), \color{blue}{\mathsf{fma}\left(x, y, z \cdot t\right)}\right) \]
      12. *-lowering-*.f6490.6

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

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

      \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(\mathsf{neg}\left(i\right)\right), \color{blue}{x \cdot y}\right) \]
    6. Step-by-step derivation
      1. *-lowering-*.f6485.5

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

      \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(-i\right), \color{blue}{x \cdot y}\right) \]
    8. Taylor expanded in i around inf

      \[\leadsto 2 \cdot \color{blue}{\left(-1 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)\right)} \]
    9. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto 2 \cdot \left(-1 \cdot \color{blue}{\left(\left(c \cdot i\right) \cdot \left(a + b \cdot c\right)\right)}\right) \]
      2. associate-*r*N/A

        \[\leadsto 2 \cdot \color{blue}{\left(\left(-1 \cdot \left(c \cdot i\right)\right) \cdot \left(a + b \cdot c\right)\right)} \]
      3. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \color{blue}{\left(\left(-1 \cdot \left(c \cdot i\right)\right) \cdot \left(a + b \cdot c\right)\right)} \]
      4. mul-1-negN/A

        \[\leadsto 2 \cdot \left(\color{blue}{\left(\mathsf{neg}\left(c \cdot i\right)\right)} \cdot \left(a + b \cdot c\right)\right) \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \left(\color{blue}{\left(c \cdot \left(\mathsf{neg}\left(i\right)\right)\right)} \cdot \left(a + b \cdot c\right)\right) \]
      6. mul-1-negN/A

        \[\leadsto 2 \cdot \left(\left(c \cdot \color{blue}{\left(-1 \cdot i\right)}\right) \cdot \left(a + b \cdot c\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \left(\color{blue}{\left(c \cdot \left(-1 \cdot i\right)\right)} \cdot \left(a + b \cdot c\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto 2 \cdot \left(\left(c \cdot \color{blue}{\left(\mathsf{neg}\left(i\right)\right)}\right) \cdot \left(a + b \cdot c\right)\right) \]
      9. neg-lowering-neg.f64N/A

        \[\leadsto 2 \cdot \left(\left(c \cdot \color{blue}{\left(\mathsf{neg}\left(i\right)\right)}\right) \cdot \left(a + b \cdot c\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto 2 \cdot \left(\left(c \cdot \left(\mathsf{neg}\left(i\right)\right)\right) \cdot \color{blue}{\left(b \cdot c + a\right)}\right) \]
      11. accelerator-lowering-fma.f6487.4

        \[\leadsto 2 \cdot \left(\left(c \cdot \left(-i\right)\right) \cdot \color{blue}{\mathsf{fma}\left(b, c, a\right)}\right) \]
    10. Simplified87.4%

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

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

Alternative 9: 84.0% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := \left(\mathsf{fma}\left(b, c, a\right) \cdot \left(c \cdot i\right)\right) \cdot \left(-2\right)\\
t_2 := \left(c \cdot \left(a + b \cdot c\right)\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+127}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+94}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -5.0000000000000004e127 or 5.0000000000000001e94 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 81.9%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-negN/A

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

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

        \[\leadsto 2 \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left(a + b \cdot c\right) \cdot \left(c \cdot i\right)}\right)\right) + \left(x \cdot y + z \cdot t\right)\right) \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \left(\color{blue}{\left(a + b \cdot c\right) \cdot \left(\mathsf{neg}\left(c \cdot i\right)\right)} + \left(x \cdot y + z \cdot t\right)\right) \]
      5. accelerator-lowering-fma.f64N/A

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

        \[\leadsto 2 \cdot \mathsf{fma}\left(\color{blue}{b \cdot c + a}, \mathsf{neg}\left(c \cdot i\right), x \cdot y + z \cdot t\right) \]
      7. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, c, a\right)}, \mathsf{neg}\left(c \cdot i\right), x \cdot y + z \cdot t\right) \]
      8. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), \color{blue}{c \cdot \left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), \color{blue}{c \cdot \left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      10. neg-lowering-neg.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \color{blue}{\left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      11. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(\mathsf{neg}\left(i\right)\right), \color{blue}{\mathsf{fma}\left(x, y, z \cdot t\right)}\right) \]
      12. *-lowering-*.f6491.1

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

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

      \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(\mathsf{neg}\left(i\right)\right), \color{blue}{x \cdot y}\right) \]
    6. Step-by-step derivation
      1. *-lowering-*.f6486.2

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

      \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(-i\right), \color{blue}{x \cdot y}\right) \]
    8. Taylor expanded in i around inf

      \[\leadsto 2 \cdot \color{blue}{\left(-1 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)\right)} \]
    9. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto 2 \cdot \left(-1 \cdot \color{blue}{\left(\left(c \cdot i\right) \cdot \left(a + b \cdot c\right)\right)}\right) \]
      2. associate-*r*N/A

        \[\leadsto 2 \cdot \color{blue}{\left(\left(-1 \cdot \left(c \cdot i\right)\right) \cdot \left(a + b \cdot c\right)\right)} \]
      3. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \color{blue}{\left(\left(-1 \cdot \left(c \cdot i\right)\right) \cdot \left(a + b \cdot c\right)\right)} \]
      4. mul-1-negN/A

        \[\leadsto 2 \cdot \left(\color{blue}{\left(\mathsf{neg}\left(c \cdot i\right)\right)} \cdot \left(a + b \cdot c\right)\right) \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \left(\color{blue}{\left(c \cdot \left(\mathsf{neg}\left(i\right)\right)\right)} \cdot \left(a + b \cdot c\right)\right) \]
      6. mul-1-negN/A

        \[\leadsto 2 \cdot \left(\left(c \cdot \color{blue}{\left(-1 \cdot i\right)}\right) \cdot \left(a + b \cdot c\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \left(\color{blue}{\left(c \cdot \left(-1 \cdot i\right)\right)} \cdot \left(a + b \cdot c\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto 2 \cdot \left(\left(c \cdot \color{blue}{\left(\mathsf{neg}\left(i\right)\right)}\right) \cdot \left(a + b \cdot c\right)\right) \]
      9. neg-lowering-neg.f64N/A

        \[\leadsto 2 \cdot \left(\left(c \cdot \color{blue}{\left(\mathsf{neg}\left(i\right)\right)}\right) \cdot \left(a + b \cdot c\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto 2 \cdot \left(\left(c \cdot \left(\mathsf{neg}\left(i\right)\right)\right) \cdot \color{blue}{\left(b \cdot c + a\right)}\right) \]
      11. accelerator-lowering-fma.f6487.1

        \[\leadsto 2 \cdot \left(\left(c \cdot \left(-i\right)\right) \cdot \color{blue}{\mathsf{fma}\left(b, c, a\right)}\right) \]
    10. Simplified87.1%

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

    if -5.0000000000000004e127 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.0000000000000001e94

    1. Initial program 99.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z + x \cdot y\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right) \cdot 2} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right) \cdot 2} \]
      3. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, z, x \cdot y\right)} \cdot 2 \]
      4. *-lowering-*.f6490.2

        \[\leadsto \mathsf{fma}\left(t, z, \color{blue}{x \cdot y}\right) \cdot 2 \]
    5. Simplified90.2%

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

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

Alternative 10: 82.1% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+94}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\

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


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

    1. Initial program 81.5%

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

      \[\leadsto \color{blue}{-2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto -2 \cdot \color{blue}{\left(\left(i \cdot \left(a + b \cdot c\right)\right) \cdot c\right)} \]
      2. associate-*r*N/A

        \[\leadsto \color{blue}{\left(-2 \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \cdot c} \]
      3. distribute-rgt-inN/A

        \[\leadsto \left(-2 \cdot \color{blue}{\left(a \cdot i + \left(b \cdot c\right) \cdot i\right)}\right) \cdot c \]
      4. associate-*r*N/A

        \[\leadsto \left(-2 \cdot \left(a \cdot i + \color{blue}{b \cdot \left(c \cdot i\right)}\right)\right) \cdot c \]
      5. distribute-lft-outN/A

        \[\leadsto \color{blue}{\left(-2 \cdot \left(a \cdot i\right) + -2 \cdot \left(b \cdot \left(c \cdot i\right)\right)\right)} \cdot c \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{c \cdot \left(-2 \cdot \left(a \cdot i\right) + -2 \cdot \left(b \cdot \left(c \cdot i\right)\right)\right)} \]
      7. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{c \cdot \left(-2 \cdot \left(a \cdot i\right) + -2 \cdot \left(b \cdot \left(c \cdot i\right)\right)\right)} \]
      8. distribute-lft-outN/A

        \[\leadsto c \cdot \color{blue}{\left(-2 \cdot \left(a \cdot i + b \cdot \left(c \cdot i\right)\right)\right)} \]
      9. associate-*r*N/A

        \[\leadsto c \cdot \left(-2 \cdot \left(a \cdot i + \color{blue}{\left(b \cdot c\right) \cdot i}\right)\right) \]
      10. distribute-rgt-inN/A

        \[\leadsto c \cdot \left(-2 \cdot \color{blue}{\left(i \cdot \left(a + b \cdot c\right)\right)}\right) \]
      11. *-commutativeN/A

        \[\leadsto c \cdot \left(-2 \cdot \color{blue}{\left(\left(a + b \cdot c\right) \cdot i\right)}\right) \]
      12. associate-*r*N/A

        \[\leadsto c \cdot \color{blue}{\left(\left(-2 \cdot \left(a + b \cdot c\right)\right) \cdot i\right)} \]
      13. *-lowering-*.f64N/A

        \[\leadsto c \cdot \color{blue}{\left(\left(-2 \cdot \left(a + b \cdot c\right)\right) \cdot i\right)} \]
      14. *-lowering-*.f64N/A

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

        \[\leadsto c \cdot \left(\left(-2 \cdot \color{blue}{\left(b \cdot c + a\right)}\right) \cdot i\right) \]
      16. accelerator-lowering-fma.f6486.4

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

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

    if -1.99999999999999981e187 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.0000000000000001e94

    1. Initial program 99.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z + x \cdot y\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right) \cdot 2} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right) \cdot 2} \]
      3. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, z, x \cdot y\right)} \cdot 2 \]
      4. *-lowering-*.f6488.8

        \[\leadsto \mathsf{fma}\left(t, z, \color{blue}{x \cdot y}\right) \cdot 2 \]
    5. Simplified88.8%

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

    if 5.0000000000000001e94 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 81.5%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-negN/A

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

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

        \[\leadsto 2 \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left(a + b \cdot c\right) \cdot \left(c \cdot i\right)}\right)\right) + \left(x \cdot y + z \cdot t\right)\right) \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \left(\color{blue}{\left(a + b \cdot c\right) \cdot \left(\mathsf{neg}\left(c \cdot i\right)\right)} + \left(x \cdot y + z \cdot t\right)\right) \]
      5. accelerator-lowering-fma.f64N/A

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

        \[\leadsto 2 \cdot \mathsf{fma}\left(\color{blue}{b \cdot c + a}, \mathsf{neg}\left(c \cdot i\right), x \cdot y + z \cdot t\right) \]
      7. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, c, a\right)}, \mathsf{neg}\left(c \cdot i\right), x \cdot y + z \cdot t\right) \]
      8. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), \color{blue}{c \cdot \left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), \color{blue}{c \cdot \left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      10. neg-lowering-neg.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \color{blue}{\left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      11. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(\mathsf{neg}\left(i\right)\right), \color{blue}{\mathsf{fma}\left(x, y, z \cdot t\right)}\right) \]
      12. *-lowering-*.f6490.6

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

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

      \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(\mathsf{neg}\left(i\right)\right), \color{blue}{x \cdot y}\right) \]
    6. Step-by-step derivation
      1. *-lowering-*.f6485.5

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

      \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(-i\right), \color{blue}{x \cdot y}\right) \]
    8. Taylor expanded in i around inf

      \[\leadsto \color{blue}{-2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)} \]
    9. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \color{blue}{\left(\left(a + b \cdot c\right) \cdot i\right)}\right) \]
      2. associate-*r*N/A

        \[\leadsto -2 \cdot \color{blue}{\left(\left(c \cdot \left(a + b \cdot c\right)\right) \cdot i\right)} \]
      3. associate-*l*N/A

        \[\leadsto \color{blue}{\left(-2 \cdot \left(c \cdot \left(a + b \cdot c\right)\right)\right) \cdot i} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{i \cdot \left(-2 \cdot \left(c \cdot \left(a + b \cdot c\right)\right)\right)} \]
      5. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{i \cdot \left(-2 \cdot \left(c \cdot \left(a + b \cdot c\right)\right)\right)} \]
      6. *-lowering-*.f64N/A

        \[\leadsto i \cdot \color{blue}{\left(-2 \cdot \left(c \cdot \left(a + b \cdot c\right)\right)\right)} \]
      7. *-lowering-*.f64N/A

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

        \[\leadsto i \cdot \left(-2 \cdot \left(c \cdot \color{blue}{\left(b \cdot c + a\right)}\right)\right) \]
      9. accelerator-lowering-fma.f6484.5

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

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

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

Alternative 11: 82.4% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := c \cdot \left(i \cdot \left(\mathsf{fma}\left(b, c, a\right) \cdot -2\right)\right)\\
t_2 := \left(c \cdot \left(a + b \cdot c\right)\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+187}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+94}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -1.99999999999999981e187 or 5.0000000000000001e94 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 81.5%

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

      \[\leadsto \color{blue}{-2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto -2 \cdot \color{blue}{\left(\left(i \cdot \left(a + b \cdot c\right)\right) \cdot c\right)} \]
      2. associate-*r*N/A

        \[\leadsto \color{blue}{\left(-2 \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \cdot c} \]
      3. distribute-rgt-inN/A

        \[\leadsto \left(-2 \cdot \color{blue}{\left(a \cdot i + \left(b \cdot c\right) \cdot i\right)}\right) \cdot c \]
      4. associate-*r*N/A

        \[\leadsto \left(-2 \cdot \left(a \cdot i + \color{blue}{b \cdot \left(c \cdot i\right)}\right)\right) \cdot c \]
      5. distribute-lft-outN/A

        \[\leadsto \color{blue}{\left(-2 \cdot \left(a \cdot i\right) + -2 \cdot \left(b \cdot \left(c \cdot i\right)\right)\right)} \cdot c \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{c \cdot \left(-2 \cdot \left(a \cdot i\right) + -2 \cdot \left(b \cdot \left(c \cdot i\right)\right)\right)} \]
      7. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{c \cdot \left(-2 \cdot \left(a \cdot i\right) + -2 \cdot \left(b \cdot \left(c \cdot i\right)\right)\right)} \]
      8. distribute-lft-outN/A

        \[\leadsto c \cdot \color{blue}{\left(-2 \cdot \left(a \cdot i + b \cdot \left(c \cdot i\right)\right)\right)} \]
      9. associate-*r*N/A

        \[\leadsto c \cdot \left(-2 \cdot \left(a \cdot i + \color{blue}{\left(b \cdot c\right) \cdot i}\right)\right) \]
      10. distribute-rgt-inN/A

        \[\leadsto c \cdot \left(-2 \cdot \color{blue}{\left(i \cdot \left(a + b \cdot c\right)\right)}\right) \]
      11. *-commutativeN/A

        \[\leadsto c \cdot \left(-2 \cdot \color{blue}{\left(\left(a + b \cdot c\right) \cdot i\right)}\right) \]
      12. associate-*r*N/A

        \[\leadsto c \cdot \color{blue}{\left(\left(-2 \cdot \left(a + b \cdot c\right)\right) \cdot i\right)} \]
      13. *-lowering-*.f64N/A

        \[\leadsto c \cdot \color{blue}{\left(\left(-2 \cdot \left(a + b \cdot c\right)\right) \cdot i\right)} \]
      14. *-lowering-*.f64N/A

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

        \[\leadsto c \cdot \left(\left(-2 \cdot \color{blue}{\left(b \cdot c + a\right)}\right) \cdot i\right) \]
      16. accelerator-lowering-fma.f6484.4

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

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

    if -1.99999999999999981e187 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.0000000000000001e94

    1. Initial program 99.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z + x \cdot y\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right) \cdot 2} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right) \cdot 2} \]
      3. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, z, x \cdot y\right)} \cdot 2 \]
      4. *-lowering-*.f6488.8

        \[\leadsto \mathsf{fma}\left(t, z, \color{blue}{x \cdot y}\right) \cdot 2 \]
    5. Simplified88.8%

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

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

Alternative 12: 74.0% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+296}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\

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


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

    1. Initial program 81.5%

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

      \[\leadsto \color{blue}{-2 \cdot \left(b \cdot \left({c}^{2} \cdot i\right)\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(b \cdot \left({c}^{2} \cdot i\right)\right) \cdot -2} \]
      2. associate-*r*N/A

        \[\leadsto \color{blue}{b \cdot \left(\left({c}^{2} \cdot i\right) \cdot -2\right)} \]
      3. *-commutativeN/A

        \[\leadsto b \cdot \color{blue}{\left(-2 \cdot \left({c}^{2} \cdot i\right)\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{b \cdot \left(-2 \cdot \left({c}^{2} \cdot i\right)\right)} \]
      5. associate-*r*N/A

        \[\leadsto b \cdot \color{blue}{\left(\left(-2 \cdot {c}^{2}\right) \cdot i\right)} \]
      6. *-commutativeN/A

        \[\leadsto b \cdot \color{blue}{\left(i \cdot \left(-2 \cdot {c}^{2}\right)\right)} \]
      7. *-lowering-*.f64N/A

        \[\leadsto b \cdot \color{blue}{\left(i \cdot \left(-2 \cdot {c}^{2}\right)\right)} \]
      8. *-lowering-*.f64N/A

        \[\leadsto b \cdot \left(i \cdot \color{blue}{\left(-2 \cdot {c}^{2}\right)}\right) \]
      9. unpow2N/A

        \[\leadsto b \cdot \left(i \cdot \left(-2 \cdot \color{blue}{\left(c \cdot c\right)}\right)\right) \]
      10. *-lowering-*.f6468.5

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

      \[\leadsto \color{blue}{b \cdot \left(i \cdot \left(-2 \cdot \left(c \cdot c\right)\right)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(b \cdot i\right) \cdot \left(-2 \cdot \left(c \cdot c\right)\right)} \]
      2. associate-*r*N/A

        \[\leadsto \left(b \cdot i\right) \cdot \color{blue}{\left(\left(-2 \cdot c\right) \cdot c\right)} \]
      3. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\left(b \cdot i\right) \cdot \left(-2 \cdot c\right)\right) \cdot c} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(\left(b \cdot i\right) \cdot \left(-2 \cdot c\right)\right) \cdot c} \]
      5. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(\left(b \cdot i\right) \cdot \left(-2 \cdot c\right)\right)} \cdot c \]
      6. *-commutativeN/A

        \[\leadsto \left(\color{blue}{\left(i \cdot b\right)} \cdot \left(-2 \cdot c\right)\right) \cdot c \]
      7. *-lowering-*.f64N/A

        \[\leadsto \left(\color{blue}{\left(i \cdot b\right)} \cdot \left(-2 \cdot c\right)\right) \cdot c \]
      8. *-commutativeN/A

        \[\leadsto \left(\left(i \cdot b\right) \cdot \color{blue}{\left(c \cdot -2\right)}\right) \cdot c \]
      9. *-lowering-*.f6471.2

        \[\leadsto \left(\left(i \cdot b\right) \cdot \color{blue}{\left(c \cdot -2\right)}\right) \cdot c \]
    7. Applied egg-rr71.2%

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

    if -1.99999999999999981e187 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.99999999999999996e296

    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. Add Preprocessing
    3. Taylor expanded in c around 0

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z + x \cdot y\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right) \cdot 2} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right) \cdot 2} \]
      3. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, z, x \cdot y\right)} \cdot 2 \]
      4. *-lowering-*.f6481.8

        \[\leadsto \mathsf{fma}\left(t, z, \color{blue}{x \cdot y}\right) \cdot 2 \]
    5. Simplified81.8%

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

    if 1.99999999999999996e296 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 78.0%

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

      \[\leadsto \color{blue}{-2 \cdot \left(b \cdot \left({c}^{2} \cdot i\right)\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(b \cdot \left({c}^{2} \cdot i\right)\right) \cdot -2} \]
      2. associate-*r*N/A

        \[\leadsto \color{blue}{b \cdot \left(\left({c}^{2} \cdot i\right) \cdot -2\right)} \]
      3. *-commutativeN/A

        \[\leadsto b \cdot \color{blue}{\left(-2 \cdot \left({c}^{2} \cdot i\right)\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{b \cdot \left(-2 \cdot \left({c}^{2} \cdot i\right)\right)} \]
      5. associate-*r*N/A

        \[\leadsto b \cdot \color{blue}{\left(\left(-2 \cdot {c}^{2}\right) \cdot i\right)} \]
      6. *-commutativeN/A

        \[\leadsto b \cdot \color{blue}{\left(i \cdot \left(-2 \cdot {c}^{2}\right)\right)} \]
      7. *-lowering-*.f64N/A

        \[\leadsto b \cdot \color{blue}{\left(i \cdot \left(-2 \cdot {c}^{2}\right)\right)} \]
      8. *-lowering-*.f64N/A

        \[\leadsto b \cdot \left(i \cdot \color{blue}{\left(-2 \cdot {c}^{2}\right)}\right) \]
      9. unpow2N/A

        \[\leadsto b \cdot \left(i \cdot \left(-2 \cdot \color{blue}{\left(c \cdot c\right)}\right)\right) \]
      10. *-lowering-*.f6481.8

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

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

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

Alternative 13: 74.1% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+296}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\

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


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

    1. Initial program 81.5%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-negN/A

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

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

        \[\leadsto 2 \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left(a + b \cdot c\right) \cdot \left(c \cdot i\right)}\right)\right) + \left(x \cdot y + z \cdot t\right)\right) \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \left(\color{blue}{\left(a + b \cdot c\right) \cdot \left(\mathsf{neg}\left(c \cdot i\right)\right)} + \left(x \cdot y + z \cdot t\right)\right) \]
      5. accelerator-lowering-fma.f64N/A

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

        \[\leadsto 2 \cdot \mathsf{fma}\left(\color{blue}{b \cdot c + a}, \mathsf{neg}\left(c \cdot i\right), x \cdot y + z \cdot t\right) \]
      7. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, c, a\right)}, \mathsf{neg}\left(c \cdot i\right), x \cdot y + z \cdot t\right) \]
      8. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), \color{blue}{c \cdot \left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), \color{blue}{c \cdot \left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      10. neg-lowering-neg.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \color{blue}{\left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      11. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(\mathsf{neg}\left(i\right)\right), \color{blue}{\mathsf{fma}\left(x, y, z \cdot t\right)}\right) \]
      12. *-lowering-*.f6491.3

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

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

      \[\leadsto \color{blue}{-2 \cdot \left(b \cdot \left({c}^{2} \cdot i\right)\right)} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(b \cdot \left({c}^{2} \cdot i\right)\right) \cdot -2} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(\left({c}^{2} \cdot i\right) \cdot b\right)} \cdot -2 \]
      3. unpow2N/A

        \[\leadsto \left(\left(\color{blue}{\left(c \cdot c\right)} \cdot i\right) \cdot b\right) \cdot -2 \]
      4. associate-*l*N/A

        \[\leadsto \left(\color{blue}{\left(c \cdot \left(c \cdot i\right)\right)} \cdot b\right) \cdot -2 \]
      5. associate-*r*N/A

        \[\leadsto \color{blue}{\left(c \cdot \left(\left(c \cdot i\right) \cdot b\right)\right)} \cdot -2 \]
      6. *-commutativeN/A

        \[\leadsto \left(c \cdot \color{blue}{\left(b \cdot \left(c \cdot i\right)\right)}\right) \cdot -2 \]
      7. associate-*r*N/A

        \[\leadsto \color{blue}{c \cdot \left(\left(b \cdot \left(c \cdot i\right)\right) \cdot -2\right)} \]
      8. *-commutativeN/A

        \[\leadsto c \cdot \color{blue}{\left(-2 \cdot \left(b \cdot \left(c \cdot i\right)\right)\right)} \]
      9. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{c \cdot \left(-2 \cdot \left(b \cdot \left(c \cdot i\right)\right)\right)} \]
      10. *-lowering-*.f64N/A

        \[\leadsto c \cdot \color{blue}{\left(-2 \cdot \left(b \cdot \left(c \cdot i\right)\right)\right)} \]
      11. *-commutativeN/A

        \[\leadsto c \cdot \left(-2 \cdot \color{blue}{\left(\left(c \cdot i\right) \cdot b\right)}\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto c \cdot \left(-2 \cdot \color{blue}{\left(\left(c \cdot i\right) \cdot b\right)}\right) \]
      13. *-lowering-*.f6471.1

        \[\leadsto c \cdot \left(-2 \cdot \left(\color{blue}{\left(c \cdot i\right)} \cdot b\right)\right) \]
    7. Simplified71.1%

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

    if -1.99999999999999981e187 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.99999999999999996e296

    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. Add Preprocessing
    3. Taylor expanded in c around 0

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z + x \cdot y\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right) \cdot 2} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right) \cdot 2} \]
      3. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, z, x \cdot y\right)} \cdot 2 \]
      4. *-lowering-*.f6481.8

        \[\leadsto \mathsf{fma}\left(t, z, \color{blue}{x \cdot y}\right) \cdot 2 \]
    5. Simplified81.8%

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

    if 1.99999999999999996e296 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 78.0%

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

      \[\leadsto \color{blue}{-2 \cdot \left(b \cdot \left({c}^{2} \cdot i\right)\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(b \cdot \left({c}^{2} \cdot i\right)\right) \cdot -2} \]
      2. associate-*r*N/A

        \[\leadsto \color{blue}{b \cdot \left(\left({c}^{2} \cdot i\right) \cdot -2\right)} \]
      3. *-commutativeN/A

        \[\leadsto b \cdot \color{blue}{\left(-2 \cdot \left({c}^{2} \cdot i\right)\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{b \cdot \left(-2 \cdot \left({c}^{2} \cdot i\right)\right)} \]
      5. associate-*r*N/A

        \[\leadsto b \cdot \color{blue}{\left(\left(-2 \cdot {c}^{2}\right) \cdot i\right)} \]
      6. *-commutativeN/A

        \[\leadsto b \cdot \color{blue}{\left(i \cdot \left(-2 \cdot {c}^{2}\right)\right)} \]
      7. *-lowering-*.f64N/A

        \[\leadsto b \cdot \color{blue}{\left(i \cdot \left(-2 \cdot {c}^{2}\right)\right)} \]
      8. *-lowering-*.f64N/A

        \[\leadsto b \cdot \left(i \cdot \color{blue}{\left(-2 \cdot {c}^{2}\right)}\right) \]
      9. unpow2N/A

        \[\leadsto b \cdot \left(i \cdot \left(-2 \cdot \color{blue}{\left(c \cdot c\right)}\right)\right) \]
      10. *-lowering-*.f6481.8

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

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

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

Alternative 14: 73.8% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+296}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -1.99999999999999981e187 or 1.99999999999999996e296 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    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. Add Preprocessing
    3. Taylor expanded in b around inf

      \[\leadsto \color{blue}{-2 \cdot \left(b \cdot \left({c}^{2} \cdot i\right)\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(b \cdot \left({c}^{2} \cdot i\right)\right) \cdot -2} \]
      2. associate-*r*N/A

        \[\leadsto \color{blue}{b \cdot \left(\left({c}^{2} \cdot i\right) \cdot -2\right)} \]
      3. *-commutativeN/A

        \[\leadsto b \cdot \color{blue}{\left(-2 \cdot \left({c}^{2} \cdot i\right)\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{b \cdot \left(-2 \cdot \left({c}^{2} \cdot i\right)\right)} \]
      5. associate-*r*N/A

        \[\leadsto b \cdot \color{blue}{\left(\left(-2 \cdot {c}^{2}\right) \cdot i\right)} \]
      6. *-commutativeN/A

        \[\leadsto b \cdot \color{blue}{\left(i \cdot \left(-2 \cdot {c}^{2}\right)\right)} \]
      7. *-lowering-*.f64N/A

        \[\leadsto b \cdot \color{blue}{\left(i \cdot \left(-2 \cdot {c}^{2}\right)\right)} \]
      8. *-lowering-*.f64N/A

        \[\leadsto b \cdot \left(i \cdot \color{blue}{\left(-2 \cdot {c}^{2}\right)}\right) \]
      9. unpow2N/A

        \[\leadsto b \cdot \left(i \cdot \left(-2 \cdot \color{blue}{\left(c \cdot c\right)}\right)\right) \]
      10. *-lowering-*.f6474.0

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

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

    if -1.99999999999999981e187 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.99999999999999996e296

    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. Add Preprocessing
    3. Taylor expanded in c around 0

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z + x \cdot y\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right) \cdot 2} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right) \cdot 2} \]
      3. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, z, x \cdot y\right)} \cdot 2 \]
      4. *-lowering-*.f6481.8

        \[\leadsto \mathsf{fma}\left(t, z, \color{blue}{x \cdot y}\right) \cdot 2 \]
    5. Simplified81.8%

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

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

Alternative 15: 62.2% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+94}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\

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


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

    1. Initial program 81.5%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-negN/A

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

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

        \[\leadsto 2 \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left(a + b \cdot c\right) \cdot \left(c \cdot i\right)}\right)\right) + \left(x \cdot y + z \cdot t\right)\right) \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \left(\color{blue}{\left(a + b \cdot c\right) \cdot \left(\mathsf{neg}\left(c \cdot i\right)\right)} + \left(x \cdot y + z \cdot t\right)\right) \]
      5. accelerator-lowering-fma.f64N/A

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

        \[\leadsto 2 \cdot \mathsf{fma}\left(\color{blue}{b \cdot c + a}, \mathsf{neg}\left(c \cdot i\right), x \cdot y + z \cdot t\right) \]
      7. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, c, a\right)}, \mathsf{neg}\left(c \cdot i\right), x \cdot y + z \cdot t\right) \]
      8. distribute-rgt-neg-inN/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), \color{blue}{c \cdot \left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), \color{blue}{c \cdot \left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      10. neg-lowering-neg.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \color{blue}{\left(\mathsf{neg}\left(i\right)\right)}, x \cdot y + z \cdot t\right) \]
      11. accelerator-lowering-fma.f64N/A

        \[\leadsto 2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(\mathsf{neg}\left(i\right)\right), \color{blue}{\mathsf{fma}\left(x, y, z \cdot t\right)}\right) \]
      12. *-lowering-*.f6491.3

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

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

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

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

        \[\leadsto \color{blue}{a \cdot \left(\left(c \cdot i\right) \cdot -2\right)} \]
      3. *-commutativeN/A

        \[\leadsto a \cdot \color{blue}{\left(-2 \cdot \left(c \cdot i\right)\right)} \]
      4. *-lowering-*.f64N/A

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

        \[\leadsto a \cdot \color{blue}{\left(\left(c \cdot i\right) \cdot -2\right)} \]
      6. associate-*l*N/A

        \[\leadsto a \cdot \color{blue}{\left(c \cdot \left(i \cdot -2\right)\right)} \]
      7. *-lowering-*.f64N/A

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

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

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

    if -1.99999999999999981e187 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.0000000000000001e94

    1. Initial program 99.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z + x \cdot y\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right) \cdot 2} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(t \cdot z + x \cdot y\right) \cdot 2} \]
      3. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, z, x \cdot y\right)} \cdot 2 \]
      4. *-lowering-*.f6488.8

        \[\leadsto \mathsf{fma}\left(t, z, \color{blue}{x \cdot y}\right) \cdot 2 \]
    5. Simplified88.8%

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

    if 5.0000000000000001e94 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 81.5%

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

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

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

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

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

        \[\leadsto \color{blue}{c \cdot \left(-2 \cdot \left(a \cdot i\right)\right)} \]
      5. *-lowering-*.f64N/A

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

        \[\leadsto c \cdot \color{blue}{\left(\left(a \cdot i\right) \cdot -2\right)} \]
      7. associate-*l*N/A

        \[\leadsto c \cdot \color{blue}{\left(a \cdot \left(i \cdot -2\right)\right)} \]
      8. *-lowering-*.f64N/A

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

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

      \[\leadsto \color{blue}{c \cdot \left(a \cdot \left(i \cdot -2\right)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

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

        \[\leadsto \color{blue}{\left(i \cdot -2\right) \cdot \left(c \cdot a\right)} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(i \cdot -2\right) \cdot \left(c \cdot a\right)} \]
      4. *-lowering-*.f64N/A

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

        \[\leadsto \left(i \cdot -2\right) \cdot \color{blue}{\left(c \cdot a\right)} \]
    7. Applied egg-rr42.2%

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

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

Alternative 16: 44.1% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot \left(y \cdot 2\right)\\
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+185}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -4.9999999999999999e185 or 3.99999999999999972e-39 < (*.f64 x y)

    1. Initial program 88.0%

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

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot y\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot 2} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot 2} \]
      3. *-lowering-*.f6459.1

        \[\leadsto \color{blue}{\left(x \cdot y\right)} \cdot 2 \]
    5. Simplified59.1%

      \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot 2} \]
    6. Step-by-step derivation
      1. associate-*l*N/A

        \[\leadsto \color{blue}{x \cdot \left(y \cdot 2\right)} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(y \cdot 2\right) \cdot x} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(y \cdot 2\right) \cdot x} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(2 \cdot y\right)} \cdot x \]
      5. *-lowering-*.f6459.1

        \[\leadsto \color{blue}{\left(2 \cdot y\right)} \cdot x \]
    7. Applied egg-rr59.1%

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

    if -4.9999999999999999e185 < (*.f64 x y) < 3.99999999999999972e-39

    1. Initial program 91.4%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t \cdot z\right) \cdot 2} \]
      2. associate-*r*N/A

        \[\leadsto \color{blue}{t \cdot \left(z \cdot 2\right)} \]
      3. *-commutativeN/A

        \[\leadsto t \cdot \color{blue}{\left(2 \cdot z\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{t \cdot \left(2 \cdot z\right)} \]
      5. *-commutativeN/A

        \[\leadsto t \cdot \color{blue}{\left(z \cdot 2\right)} \]
      6. *-lowering-*.f6439.1

        \[\leadsto t \cdot \color{blue}{\left(z \cdot 2\right)} \]
    5. Simplified39.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+185}:\\ \;\;\;\;x \cdot \left(y \cdot 2\right)\\ \mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{-39}:\\ \;\;\;\;t \cdot \left(z \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 29.5% accurate, 3.6× speedup?

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

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

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

    \[\leadsto \color{blue}{2 \cdot \left(t \cdot z\right)} \]
  4. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \color{blue}{\left(t \cdot z\right) \cdot 2} \]
    2. associate-*r*N/A

      \[\leadsto \color{blue}{t \cdot \left(z \cdot 2\right)} \]
    3. *-commutativeN/A

      \[\leadsto t \cdot \color{blue}{\left(2 \cdot z\right)} \]
    4. *-lowering-*.f64N/A

      \[\leadsto \color{blue}{t \cdot \left(2 \cdot z\right)} \]
    5. *-commutativeN/A

      \[\leadsto t \cdot \color{blue}{\left(z \cdot 2\right)} \]
    6. *-lowering-*.f6432.2

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

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

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

  :alt
  (! :herbie-platform default (* 2 (- (+ (* x y) (* z t)) (* (+ a (* b c)) (* c i)))))

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