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

Percentage Accurate: 89.4% → 95.2%
Time: 16.1s
Alternatives: 14
Speedup: 0.7×

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

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

Initial Program: 89.4% 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: 95.2% accurate, 0.7× speedup?

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

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

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


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

    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. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i}\right) \]
      8. 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)} \]
      9. +-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)} \]
      10. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left(\left(a + b \cdot c\right) \cdot c\right)} \cdot i\right)\right) + \left(x \cdot y + z \cdot t\right)\right) \]
      12. 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) \]
      13. 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) \]
      14. lower-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)} \]
    4. Applied rewrites96.8%

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

    if 4.9999999999999997e304 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 75.2%

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

      \[\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. lower-*.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. lower-*.f64N/A

        \[\leadsto c \cdot \color{blue}{\left(\left(-2 \cdot \left(a + b \cdot c\right)\right) \cdot i\right)} \]
      14. lower-*.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. lower-fma.f64100.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(c \cdot \left(a + b \cdot c\right)\right) \cdot i \leq 5 \cdot 10^{+304}:\\ \;\;\;\;2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(-i\right), \mathsf{fma}\left(z, t, x \cdot y\right)\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 2: 88.4% 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 -3 \cdot 10^{+140}:\\ \;\;\;\;2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(-i\right), x \cdot y\right)\\ \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+211}:\\ \;\;\;\;2 \cdot \left(\mathsf{fma}\left(t, z, x \cdot y\right) - c \cdot \left(a \cdot i\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, c, a\right) \cdot \left(c \cdot \left(i \cdot -2\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 -3e+140)
     (* 2.0 (fma (fma b c a) (* c (- i)) (* x y)))
     (if (<= t_1 4e+211)
       (* 2.0 (- (fma t z (* x y)) (* c (* a i))))
       (* (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 <= -3e+140) {
		tmp = 2.0 * fma(fma(b, c, a), (c * -i), (x * y));
	} else if (t_1 <= 4e+211) {
		tmp = 2.0 * (fma(t, z, (x * y)) - (c * (a * i)));
	} 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 <= -3e+140)
		tmp = Float64(2.0 * fma(fma(b, c, a), Float64(c * Float64(-i)), Float64(x * y)));
	elseif (t_1 <= 4e+211)
		tmp = Float64(2.0 * Float64(fma(t, z, Float64(x * y)) - Float64(c * Float64(a * i))));
	else
		tmp = Float64(fma(b, c, a) * Float64(c * Float64(i * -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, -3e+140], N[(2.0 * N[(N[(b * c + a), $MachinePrecision] * N[(c * (-i)), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+211], N[(2.0 * N[(N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision] - N[(c * N[(a * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * c + a), $MachinePrecision] * N[(c * N[(i * -2.0), $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 -3 \cdot 10^{+140}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(-i\right), x \cdot y\right)\\

\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+211}:\\
\;\;\;\;2 \cdot \left(\mathsf{fma}\left(t, z, x \cdot y\right) - c \cdot \left(a \cdot i\right)\right)\\

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


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

    1. Initial program 72.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. lift-*.f64N/A

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i}\right) \]
      8. 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)} \]
      9. +-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)} \]
      10. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left(\left(a + b \cdot c\right) \cdot c\right)} \cdot i\right)\right) + \left(x \cdot y + z \cdot t\right)\right) \]
      12. 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) \]
      13. 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) \]
      14. lower-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)} \]
    4. Applied rewrites91.6%

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

      \[\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. lower-*.f6487.4

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

      \[\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 -2.99999999999999997e140 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 3.9999999999999998e211

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(\mathsf{fma}\left(t, z, x \cdot y\right) - \color{blue}{c \cdot \left(a \cdot i\right)}\right) \]
      9. lower-*.f6495.0

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

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

    if 3.9999999999999998e211 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 78.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. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{\mathsf{fma}\left(b, c, a\right) \cdot \left(c \cdot i\right)}\right) \]
    5. 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)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{i \cdot \left(\left(-2 \cdot \mathsf{fma}\left(c, b, a\right)\right) \cdot c\right)} \]
    8. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto i \cdot \left(\left(-2 \cdot \color{blue}{\mathsf{fma}\left(c, b, a\right)}\right) \cdot c\right) \]
      2. lift-*.f64N/A

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(\mathsf{fma}\left(c, b, a\right) \cdot -2\right)} \cdot c\right) \cdot i \]
      8. lift-fma.f64N/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(b, c, a\right) \cdot \left(c \cdot \color{blue}{\left(i \cdot -2\right)}\right) \]
      18. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, c, a\right) \cdot \left(c \cdot \color{blue}{\left(i \cdot -2\right)}\right) \]
      19. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, c, a\right) \cdot \color{blue}{\left(c \cdot \left(i \cdot -2\right)\right)} \]
      20. lower-*.f6495.4

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

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

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

Alternative 3: 88.1% 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 -3 \cdot 10^{+140}:\\ \;\;\;\;2 \cdot \left(x \cdot y - \mathsf{fma}\left(b, c, a\right) \cdot \left(c \cdot i\right)\right)\\ \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+211}:\\ \;\;\;\;2 \cdot \left(\mathsf{fma}\left(t, z, x \cdot y\right) - c \cdot \left(a \cdot i\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, c, a\right) \cdot \left(c \cdot \left(i \cdot -2\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 -3e+140)
     (* 2.0 (- (* x y) (* (fma b c a) (* c i))))
     (if (<= t_1 4e+211)
       (* 2.0 (- (fma t z (* x y)) (* c (* a i))))
       (* (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 <= -3e+140) {
		tmp = 2.0 * ((x * y) - (fma(b, c, a) * (c * i)));
	} else if (t_1 <= 4e+211) {
		tmp = 2.0 * (fma(t, z, (x * y)) - (c * (a * i)));
	} 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 <= -3e+140)
		tmp = Float64(2.0 * Float64(Float64(x * y) - Float64(fma(b, c, a) * Float64(c * i))));
	elseif (t_1 <= 4e+211)
		tmp = Float64(2.0 * Float64(fma(t, z, Float64(x * y)) - Float64(c * Float64(a * i))));
	else
		tmp = Float64(fma(b, c, a) * Float64(c * Float64(i * -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, -3e+140], N[(2.0 * N[(N[(x * y), $MachinePrecision] - N[(N[(b * c + a), $MachinePrecision] * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+211], N[(2.0 * N[(N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision] - N[(c * N[(a * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * c + a), $MachinePrecision] * N[(c * N[(i * -2.0), $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 -3 \cdot 10^{+140}:\\
\;\;\;\;2 \cdot \left(x \cdot y - \mathsf{fma}\left(b, c, a\right) \cdot \left(c \cdot i\right)\right)\\

\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+211}:\\
\;\;\;\;2 \cdot \left(\mathsf{fma}\left(t, z, x \cdot y\right) - c \cdot \left(a \cdot i\right)\right)\\

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


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

    1. Initial program 72.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. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.99999999999999997e140 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 3.9999999999999998e211

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(\mathsf{fma}\left(t, z, x \cdot y\right) - \color{blue}{c \cdot \left(a \cdot i\right)}\right) \]
      9. lower-*.f6495.0

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

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

    if 3.9999999999999998e211 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 78.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. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{\mathsf{fma}\left(b, c, a\right) \cdot \left(c \cdot i\right)}\right) \]
    5. 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)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{i \cdot \left(\left(-2 \cdot \mathsf{fma}\left(c, b, a\right)\right) \cdot c\right)} \]
    8. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto i \cdot \left(\left(-2 \cdot \color{blue}{\mathsf{fma}\left(c, b, a\right)}\right) \cdot c\right) \]
      2. lift-*.f64N/A

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(\mathsf{fma}\left(c, b, a\right) \cdot -2\right)} \cdot c\right) \cdot i \]
      8. lift-fma.f64N/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(b, c, a\right) \cdot \left(c \cdot \color{blue}{\left(i \cdot -2\right)}\right) \]
      18. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, c, a\right) \cdot \left(c \cdot \color{blue}{\left(i \cdot -2\right)}\right) \]
      19. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, c, a\right) \cdot \color{blue}{\left(c \cdot \left(i \cdot -2\right)\right)} \]
      20. lower-*.f6495.4

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(b, c, a\right) \cdot \left(c \cdot \left(i \cdot -2\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 -3 \cdot 10^{+140}:\\ \;\;\;\;2 \cdot \left(x \cdot y - \mathsf{fma}\left(b, c, a\right) \cdot \left(c \cdot i\right)\right)\\ \mathbf{elif}\;\left(c \cdot \left(a + b \cdot c\right)\right) \cdot i \leq 4 \cdot 10^{+211}:\\ \;\;\;\;2 \cdot \left(\mathsf{fma}\left(t, z, x \cdot y\right) - c \cdot \left(a \cdot i\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, c, a\right) \cdot \left(c \cdot \left(i \cdot -2\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 83.8% 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^{+58}:\\ \;\;\;\;2 \cdot \left(x \cdot y - \mathsf{fma}\left(b, c, a\right) \cdot \left(c \cdot i\right)\right)\\ \mathbf{elif}\;t\_1 \leq 10^{+289}:\\ \;\;\;\;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} \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+58)
     (* 2.0 (- (* x y) (* (fma b c a) (* c i))))
     (if (<= t_1 1e+289)
       (* 2.0 (fma t z (* x y)))
       (* c (* i (* (fma b c a) -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 <= -2e+58) {
		tmp = 2.0 * ((x * y) - (fma(b, c, a) * (c * i)));
	} else if (t_1 <= 1e+289) {
		tmp = 2.0 * fma(t, z, (x * y));
	} else {
		tmp = c * (i * (fma(b, c, a) * -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 <= -2e+58)
		tmp = Float64(2.0 * Float64(Float64(x * y) - Float64(fma(b, c, a) * Float64(c * i))));
	elseif (t_1 <= 1e+289)
		tmp = Float64(2.0 * fma(t, z, Float64(x * y)));
	else
		tmp = Float64(c * Float64(i * Float64(fma(b, c, a) * -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, -2e+58], N[(2.0 * N[(N[(x * y), $MachinePrecision] - N[(N[(b * c + a), $MachinePrecision] * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+289], N[(2.0 * N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * N[(i * N[(N[(b * c + a), $MachinePrecision] * -2.0), $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^{+58}:\\
\;\;\;\;2 \cdot \left(x \cdot y - \mathsf{fma}\left(b, c, a\right) \cdot \left(c \cdot i\right)\right)\\

\mathbf{elif}\;t\_1 \leq 10^{+289}:\\
\;\;\;\;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}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -1.99999999999999989e58

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.99999999999999989e58 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.0000000000000001e289

    1. Initial program 99.2%

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

      \[\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. lower-*.f64N/A

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

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

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

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

    if 1.0000000000000001e289 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 76.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 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. lower-*.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. lower-*.f64N/A

        \[\leadsto c \cdot \color{blue}{\left(\left(-2 \cdot \left(a + b \cdot c\right)\right) \cdot i\right)} \]
      14. lower-*.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. lower-fma.f6499.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(c \cdot \left(a + b \cdot c\right)\right) \cdot i \leq -2 \cdot 10^{+58}:\\ \;\;\;\;2 \cdot \left(x \cdot y - \mathsf{fma}\left(b, c, a\right) \cdot \left(c \cdot i\right)\right)\\ \mathbf{elif}\;\left(c \cdot \left(a + b \cdot c\right)\right) \cdot i \leq 10^{+289}:\\ \;\;\;\;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 5: 82.6% 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^{+58}:\\ \;\;\;\;2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \mathsf{fma}\left(b, c, a\right)\right)\right)\\ \mathbf{elif}\;t\_1 \leq 10^{+289}:\\ \;\;\;\;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} \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+58)
     (* 2.0 (- (* x y) (* c (* i (fma b c a)))))
     (if (<= t_1 1e+289)
       (* 2.0 (fma t z (* x y)))
       (* c (* i (* (fma b c a) -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 <= -2e+58) {
		tmp = 2.0 * ((x * y) - (c * (i * fma(b, c, a))));
	} else if (t_1 <= 1e+289) {
		tmp = 2.0 * fma(t, z, (x * y));
	} else {
		tmp = c * (i * (fma(b, c, a) * -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 <= -2e+58)
		tmp = Float64(2.0 * Float64(Float64(x * y) - Float64(c * Float64(i * fma(b, c, a)))));
	elseif (t_1 <= 1e+289)
		tmp = Float64(2.0 * fma(t, z, Float64(x * y)));
	else
		tmp = Float64(c * Float64(i * Float64(fma(b, c, a) * -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, -2e+58], N[(2.0 * N[(N[(x * y), $MachinePrecision] - N[(c * N[(i * N[(b * c + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+289], N[(2.0 * N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * N[(i * N[(N[(b * c + a), $MachinePrecision] * -2.0), $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^{+58}:\\
\;\;\;\;2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \mathsf{fma}\left(b, c, a\right)\right)\right)\\

\mathbf{elif}\;t\_1 \leq 10^{+289}:\\
\;\;\;\;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}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -1.99999999999999989e58

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(\color{blue}{\left(b \cdot c + a\right)} \cdot i\right)\right) \]
      8. lower-fma.f6481.6

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

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

    if -1.99999999999999989e58 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.0000000000000001e289

    1. Initial program 99.2%

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

      \[\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. lower-*.f64N/A

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

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

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

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

    if 1.0000000000000001e289 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 76.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 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. lower-*.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. lower-*.f64N/A

        \[\leadsto c \cdot \color{blue}{\left(\left(-2 \cdot \left(a + b \cdot c\right)\right) \cdot i\right)} \]
      14. lower-*.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. lower-fma.f6499.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(c \cdot \left(a + b \cdot c\right)\right) \cdot i \leq -2 \cdot 10^{+58}:\\ \;\;\;\;2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \mathsf{fma}\left(b, c, a\right)\right)\right)\\ \mathbf{elif}\;\left(c \cdot \left(a + b \cdot c\right)\right) \cdot i \leq 10^{+289}:\\ \;\;\;\;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 6: 81.9% 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^{+70}:\\ \;\;\;\;\mathsf{fma}\left(b, c, a\right) \cdot \left(c \cdot \left(i \cdot -2\right)\right)\\ \mathbf{elif}\;t\_1 \leq 10^{+289}:\\ \;\;\;\;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} \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+70)
     (* (fma b c a) (* c (* i -2.0)))
     (if (<= t_1 1e+289)
       (* 2.0 (fma t z (* x y)))
       (* c (* i (* (fma b c a) -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 <= -2e+70) {
		tmp = fma(b, c, a) * (c * (i * -2.0));
	} else if (t_1 <= 1e+289) {
		tmp = 2.0 * fma(t, z, (x * y));
	} else {
		tmp = c * (i * (fma(b, c, a) * -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 <= -2e+70)
		tmp = Float64(fma(b, c, a) * Float64(c * Float64(i * -2.0)));
	elseif (t_1 <= 1e+289)
		tmp = Float64(2.0 * fma(t, z, Float64(x * y)));
	else
		tmp = Float64(c * Float64(i * Float64(fma(b, c, a) * -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, -2e+70], N[(N[(b * c + a), $MachinePrecision] * N[(c * N[(i * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+289], N[(2.0 * N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * N[(i * N[(N[(b * c + a), $MachinePrecision] * -2.0), $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^{+70}:\\
\;\;\;\;\mathsf{fma}\left(b, c, a\right) \cdot \left(c \cdot \left(i \cdot -2\right)\right)\\

\mathbf{elif}\;t\_1 \leq 10^{+289}:\\
\;\;\;\;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}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -2.00000000000000015e70

    1. Initial program 76.8%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{\mathsf{fma}\left(b, c, a\right) \cdot \left(c \cdot i\right)}\right) \]
    5. 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)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto i \cdot \left(\left(-2 \cdot \left(\color{blue}{c \cdot b} + a\right)\right) \cdot c\right) \]
      13. lower-fma.f6470.0

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

      \[\leadsto \color{blue}{i \cdot \left(\left(-2 \cdot \mathsf{fma}\left(c, b, a\right)\right) \cdot c\right)} \]
    8. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto i \cdot \left(\left(-2 \cdot \color{blue}{\mathsf{fma}\left(c, b, a\right)}\right) \cdot c\right) \]
      2. lift-*.f64N/A

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(\mathsf{fma}\left(c, b, a\right) \cdot -2\right)} \cdot c\right) \cdot i \]
      8. lift-fma.f64N/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(b, c, a\right) \cdot \left(c \cdot \color{blue}{\left(i \cdot -2\right)}\right) \]
      18. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, c, a\right) \cdot \left(c \cdot \color{blue}{\left(i \cdot -2\right)}\right) \]
      19. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, c, a\right) \cdot \color{blue}{\left(c \cdot \left(i \cdot -2\right)\right)} \]
      20. lower-*.f6477.8

        \[\leadsto \color{blue}{\mathsf{fma}\left(b, c, a\right) \cdot \left(c \cdot \left(i \cdot -2\right)\right)} \]
    9. Applied rewrites77.8%

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

    if -2.00000000000000015e70 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.0000000000000001e289

    1. Initial program 98.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 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. lower-*.f64N/A

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

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

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

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

    if 1.0000000000000001e289 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 76.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 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. lower-*.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. lower-*.f64N/A

        \[\leadsto c \cdot \color{blue}{\left(\left(-2 \cdot \left(a + b \cdot c\right)\right) \cdot i\right)} \]
      14. lower-*.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. lower-fma.f6499.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(c \cdot \left(a + b \cdot c\right)\right) \cdot i \leq -2 \cdot 10^{+70}:\\ \;\;\;\;\mathsf{fma}\left(b, c, a\right) \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 10^{+289}:\\ \;\;\;\;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 7: 81.1% 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^{+70}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 10^{+289}:\\ \;\;\;\;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+70)
     t_1
     (if (<= t_2 1e+289) (* 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+70) {
		tmp = t_1;
	} else if (t_2 <= 1e+289) {
		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+70)
		tmp = t_1;
	elseif (t_2 <= 1e+289)
		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+70], t$95$1, If[LessEqual[t$95$2, 1e+289], 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^{+70}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 10^{+289}:\\
\;\;\;\;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) < -2.00000000000000015e70 or 1.0000000000000001e289 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 76.7%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. 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. lower-*.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. lower-*.f64N/A

        \[\leadsto c \cdot \color{blue}{\left(\left(-2 \cdot \left(a + b \cdot c\right)\right) \cdot i\right)} \]
      14. lower-*.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. lower-fma.f6484.4

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

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

    if -2.00000000000000015e70 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.0000000000000001e289

    1. Initial program 98.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 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. lower-*.f64N/A

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(c \cdot \left(a + b \cdot c\right)\right) \cdot i \leq -2 \cdot 10^{+70}:\\ \;\;\;\;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 10^{+289}:\\ \;\;\;\;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 8: 74.0% accurate, 0.6× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\left(b \cdot c\right) \cdot 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.00000000000000004e192

    1. Initial program 70.0%

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i}\right) \]
      8. 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)} \]
      9. +-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)} \]
      10. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left(\left(a + b \cdot c\right) \cdot c\right)} \cdot i\right)\right) + \left(x \cdot y + z \cdot t\right)\right) \]
      12. 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) \]
      13. 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) \]
      14. lower-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)} \]
    4. Applied rewrites92.3%

      \[\leadsto 2 \cdot \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(-i\right), \mathsf{fma}\left(z, t, x \cdot y\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. lower-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto c \cdot \left(b \cdot \color{blue}{\left(c \cdot \left(i \cdot -2\right)\right)}\right) \]
      17. lower-*.f6472.4

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

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

    if -1.00000000000000004e192 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.0000000000000001e289

    1. Initial program 98.6%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    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. lower-*.f64N/A

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

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

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

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

    if 1.0000000000000001e289 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 76.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 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. lower-*.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. lower-*.f64N/A

        \[\leadsto b \cdot \color{blue}{\left(i \cdot \left(-2 \cdot {c}^{2}\right)\right)} \]
      8. lower-*.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. lower-*.f6476.3

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(b \cdot i\right) \cdot \color{blue}{\left(c \cdot -2\right)}\right) \cdot c \]
      12. lower-*.f6480.7

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 74.2% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := c \cdot \left(b \cdot \left(c \cdot \left(i \cdot -2\right)\right)\right)\\ t_2 := \left(c \cdot \left(a + b \cdot c\right)\right) \cdot i\\ \mathbf{if}\;t\_2 \leq -1 \cdot 10^{+192}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 10^{+289}:\\ \;\;\;\;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 (* b (* c (* i -2.0))))) (t_2 (* (* c (+ a (* b c))) i)))
   (if (<= t_2 -1e+192)
     t_1
     (if (<= t_2 1e+289) (* 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 * (b * (c * (i * -2.0)));
	double t_2 = (c * (a + (b * c))) * i;
	double tmp;
	if (t_2 <= -1e+192) {
		tmp = t_1;
	} else if (t_2 <= 1e+289) {
		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(b * Float64(c * Float64(i * -2.0))))
	t_2 = Float64(Float64(c * Float64(a + Float64(b * c))) * i)
	tmp = 0.0
	if (t_2 <= -1e+192)
		tmp = t_1;
	elseif (t_2 <= 1e+289)
		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[(b * N[(c * N[(i * -2.0), $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, -1e+192], t$95$1, If[LessEqual[t$95$2, 1e+289], 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(b \cdot \left(c \cdot \left(i \cdot -2\right)\right)\right)\\
t_2 := \left(c \cdot \left(a + b \cdot c\right)\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+192}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 10^{+289}:\\
\;\;\;\;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.00000000000000004e192 or 1.0000000000000001e289 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 72.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. lift-*.f64N/A

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i}\right) \]
      8. 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)} \]
      9. +-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)} \]
      10. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left(\left(a + b \cdot c\right) \cdot c\right)} \cdot i\right)\right) + \left(x \cdot y + z \cdot t\right)\right) \]
      12. 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) \]
      13. 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) \]
      14. lower-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)} \]
    4. Applied rewrites90.5%

      \[\leadsto 2 \cdot \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(-i\right), \mathsf{fma}\left(z, t, x \cdot y\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. lower-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto c \cdot \left(b \cdot \color{blue}{\left(c \cdot \left(i \cdot -2\right)\right)}\right) \]
      17. lower-*.f6476.5

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

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

    if -1.00000000000000004e192 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.0000000000000001e289

    1. Initial program 98.6%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    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. lower-*.f64N/A

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

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

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

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

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

Alternative 10: 73.5% 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 -1 \cdot 10^{+192}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 10^{+289}:\\ \;\;\;\;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 -1e+192)
     t_1
     (if (<= t_2 1e+289) (* 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 <= -1e+192) {
		tmp = t_1;
	} else if (t_2 <= 1e+289) {
		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 <= -1e+192)
		tmp = t_1;
	elseif (t_2 <= 1e+289)
		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, -1e+192], t$95$1, If[LessEqual[t$95$2, 1e+289], 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 -1 \cdot 10^{+192}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 10^{+289}:\\
\;\;\;\;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.00000000000000004e192 or 1.0000000000000001e289 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 72.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. lower-*.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. lower-*.f64N/A

        \[\leadsto b \cdot \color{blue}{\left(i \cdot \left(-2 \cdot {c}^{2}\right)\right)} \]
      8. lower-*.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. lower-*.f6472.3

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

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

    if -1.00000000000000004e192 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.0000000000000001e289

    1. Initial program 98.6%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    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. lower-*.f64N/A

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(c \cdot \left(a + b \cdot c\right)\right) \cdot i \leq -1 \cdot 10^{+192}:\\ \;\;\;\;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 10^{+289}:\\ \;\;\;\;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 11: 62.8% accurate, 0.6× 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 -1 \cdot 10^{+192}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 10^{+289}:\\ \;\;\;\;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 (* a (* c (* i -2.0)))) (t_2 (* (* c (+ a (* b c))) i)))
   (if (<= t_2 -1e+192)
     t_1
     (if (<= t_2 1e+289) (* 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 = a * (c * (i * -2.0));
	double t_2 = (c * (a + (b * c))) * i;
	double tmp;
	if (t_2 <= -1e+192) {
		tmp = t_1;
	} else if (t_2 <= 1e+289) {
		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(a * Float64(c * Float64(i * -2.0)))
	t_2 = Float64(Float64(c * Float64(a + Float64(b * c))) * i)
	tmp = 0.0
	if (t_2 <= -1e+192)
		tmp = t_1;
	elseif (t_2 <= 1e+289)
		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[(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, -1e+192], t$95$1, If[LessEqual[t$95$2, 1e+289], N[(2.0 * N[(t * z + N[(x * y), $MachinePrecision]), $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 -1 \cdot 10^{+192}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 10^{+289}:\\
\;\;\;\;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.00000000000000004e192 or 1.0000000000000001e289 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 72.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. lift-*.f64N/A

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i}\right) \]
      8. 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)} \]
      9. +-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)} \]
      10. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left(\left(a + b \cdot c\right) \cdot c\right)} \cdot i\right)\right) + \left(x \cdot y + z \cdot t\right)\right) \]
      12. 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) \]
      13. 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) \]
      14. lower-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)} \]
    4. Applied rewrites90.5%

      \[\leadsto 2 \cdot \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(-i\right), \mathsf{fma}\left(z, t, x \cdot y\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. lower-*.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. lower-*.f64N/A

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

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

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

    if -1.00000000000000004e192 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.0000000000000001e289

    1. Initial program 98.6%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    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. lower-*.f64N/A

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(c \cdot \left(a + b \cdot c\right)\right) \cdot i \leq -1 \cdot 10^{+192}:\\ \;\;\;\;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 10^{+289}:\\ \;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(c \cdot \left(i \cdot -2\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 42.5% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-289}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+95}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z t) < -9.99999999999999981e149 or 2.00000000000000004e95 < (*.f64 z t)

    1. Initial program 86.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 z around inf

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

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

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

    if -9.99999999999999981e149 < (*.f64 z t) < -5.00000000000000029e-289 or 9.99999999999999956e-247 < (*.f64 z t) < 2.00000000000000004e95

    1. Initial program 89.0%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. 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. lower-*.f64N/A

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

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

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

    if -5.00000000000000029e-289 < (*.f64 z t) < 9.99999999999999956e-247

    1. Initial program 87.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. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i}\right) \]
      8. 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)} \]
      9. +-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)} \]
      10. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left(\left(a + b \cdot c\right) \cdot c\right)} \cdot i\right)\right) + \left(x \cdot y + z \cdot t\right)\right) \]
      12. 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) \]
      13. 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) \]
      14. lower-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)} \]
    4. Applied rewrites97.4%

      \[\leadsto 2 \cdot \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(-i\right), \mathsf{fma}\left(z, t, x \cdot y\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. lower-*.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. lower-*.f64N/A

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

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

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

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

Alternative 13: 43.5% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
t_1 := 2 \cdot \left(z \cdot t\right)\\
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+150}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -9.99999999999999981e149 or 2.00000000000000004e95 < (*.f64 z t)

    1. Initial program 86.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 z around inf

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

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

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

    if -9.99999999999999981e149 < (*.f64 z t) < 2.00000000000000004e95

    1. Initial program 88.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 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. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot 2} \]
      3. lower-*.f6435.5

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

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

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

Alternative 14: 29.1% accurate, 3.6× speedup?

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

\\
2 \cdot \left(z \cdot t\right)
\end{array}
Derivation
  1. Initial program 87.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 z around inf

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

      \[\leadsto 2 \cdot \color{blue}{\left(t \cdot z\right)} \]
  5. Applied rewrites29.0%

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

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

Developer Target 1: 94.0% 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 2024219 
(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))))