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

Percentage Accurate: 90.4% → 95.5%
Time: 15.3s
Alternatives: 14
Speedup: 1.1×

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: 90.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.5% accurate, 1.1× speedup?

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

\\
2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), -c \cdot i, \mathsf{fma}\left(z, t, x \cdot y\right)\right)
\end{array}
Derivation
  1. Initial program 88.2%

    \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
  2. Add Preprocessing
  3. 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 egg-rr95.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)} \]
  5. Final simplification95.8%

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

Alternative 2: 79.8% accurate, 0.5× speedup?

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

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

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

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

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


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

    1. Initial program 74.9%

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

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

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

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

    if -1e238 < (*.f64 (+.f64 a (*.f64 b c)) c) < -2e53

    1. Initial program 94.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \mathsf{fma}\left(a, c \cdot \color{blue}{\left(\mathsf{neg}\left(i\right)\right)}, x \cdot y\right) \]
      13. lower-*.f6484.6

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

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

    if -2e53 < (*.f64 (+.f64 a (*.f64 b c)) c) < 2.00000000000000004e95

    1. Initial program 96.6%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Add Preprocessing
    3. 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-*.f6487.6

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

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

    if 2.00000000000000004e95 < (*.f64 (+.f64 a (*.f64 b c)) c)

    1. Initial program 80.5%

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(t \cdot z - c \cdot \left(\color{blue}{\left(b \cdot c + a\right)} \cdot i\right)\right) \]
      8. lower-fma.f6484.5

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

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

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

Alternative 3: 77.4% accurate, 0.5× 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 := c \cdot \left(a + b \cdot c\right)\\ \mathbf{if}\;t\_2 \leq -1 \cdot 10^{+238}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq -2 \cdot 10^{+53}:\\ \;\;\;\;2 \cdot \mathsf{fma}\left(a, -c \cdot i, x \cdot y\right)\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+95}:\\ \;\;\;\;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)))))
   (if (<= t_2 -1e+238)
     t_1
     (if (<= t_2 -2e+53)
       (* 2.0 (fma a (- (* c i)) (* x y)))
       (if (<= t_2 2e+95) (* 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));
	double tmp;
	if (t_2 <= -1e+238) {
		tmp = t_1;
	} else if (t_2 <= -2e+53) {
		tmp = 2.0 * fma(a, -(c * i), (x * y));
	} else if (t_2 <= 2e+95) {
		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(c * Float64(a + Float64(b * c)))
	tmp = 0.0
	if (t_2 <= -1e+238)
		tmp = t_1;
	elseif (t_2 <= -2e+53)
		tmp = Float64(2.0 * fma(a, Float64(-Float64(c * i)), Float64(x * y)));
	elseif (t_2 <= 2e+95)
		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[(c * N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+238], t$95$1, If[LessEqual[t$95$2, -2e+53], N[(2.0 * N[(a * (-N[(c * i), $MachinePrecision]) + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+95], 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 := c \cdot \left(a + b \cdot c\right)\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+238}:\\
\;\;\;\;t\_1\\

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

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

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


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

    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. 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.f6476.8

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

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

    if -1e238 < (*.f64 (+.f64 a (*.f64 b c)) c) < -2e53

    1. Initial program 94.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \mathsf{fma}\left(a, c \cdot \color{blue}{\left(\mathsf{neg}\left(i\right)\right)}, x \cdot y\right) \]
      13. lower-*.f6484.6

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

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

    if -2e53 < (*.f64 (+.f64 a (*.f64 b c)) c) < 2.00000000000000004e95

    1. Initial program 96.6%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Add Preprocessing
    3. 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-*.f6487.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot \left(a + b \cdot c\right) \leq -1 \cdot 10^{+238}:\\ \;\;\;\;c \cdot \left(i \cdot \left(\mathsf{fma}\left(b, c, a\right) \cdot -2\right)\right)\\ \mathbf{elif}\;c \cdot \left(a + b \cdot c\right) \leq -2 \cdot 10^{+53}:\\ \;\;\;\;2 \cdot \mathsf{fma}\left(a, -c \cdot i, x \cdot y\right)\\ \mathbf{elif}\;c \cdot \left(a + b \cdot c\right) \leq 2 \cdot 10^{+95}:\\ \;\;\;\;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 4: 81.7% 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 := i \cdot \left(c \cdot \left(a + b \cdot c\right)\right)\\ \mathbf{if}\;t\_2 \leq -2 \cdot 10^{+218}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+166}:\\ \;\;\;\;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 (* i (* c (+ a (* b c))))))
   (if (<= t_2 -2e+218)
     t_1
     (if (<= t_2 2e+166) (* 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 = i * (c * (a + (b * c)));
	double tmp;
	if (t_2 <= -2e+218) {
		tmp = t_1;
	} else if (t_2 <= 2e+166) {
		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(i * Float64(c * Float64(a + Float64(b * c))))
	tmp = 0.0
	if (t_2 <= -2e+218)
		tmp = t_1;
	elseif (t_2 <= 2e+166)
		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[(i * N[(c * N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+218], t$95$1, If[LessEqual[t$95$2, 2e+166], 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 := i \cdot \left(c \cdot \left(a + b \cdot c\right)\right)\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+218}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+166}:\\
\;\;\;\;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.00000000000000017e218 or 1.99999999999999988e166 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 76.0%

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

      \[\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.f6479.5

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

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

    if -2.00000000000000017e218 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.99999999999999988e166

    1. Initial program 97.8%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in 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-*.f6481.9

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

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

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

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

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

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

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


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

    1. Initial program 75.1%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in 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-*.f6453.0

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

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

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

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

    if -2.00000000000000017e218 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.00000000000000002e263

    1. Initial program 97.9%

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

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

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

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

    if 1.00000000000000002e263 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 72.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. 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 egg-rr89.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 -2 \cdot \color{blue}{\left(\left({c}^{2} \cdot i\right) \cdot b\right)} \]
      2. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 82.0% accurate, 0.6× speedup?

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

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

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

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


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

    1. Initial program 80.3%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around 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. Simplified81.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.00000000000000001e41 < (*.f64 (+.f64 a (*.f64 b c)) c) < 2.00000000000000004e95

    1. Initial program 97.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-*.f6488.6

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

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

    if 2.00000000000000004e95 < (*.f64 (+.f64 a (*.f64 b c)) c)

    1. Initial program 80.5%

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(t \cdot z - c \cdot \left(\color{blue}{\left(b \cdot c + a\right)} \cdot i\right)\right) \]
      8. lower-fma.f6484.5

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

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

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

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

\mathbf{elif}\;t\_2 \leq 10^{+263}:\\
\;\;\;\;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) < -9.9999999999999994e236 or 1.00000000000000002e263 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 73.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. 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 egg-rr91.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 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.6

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

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

    if -9.9999999999999994e236 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.00000000000000002e263

    1. Initial program 97.9%

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

      \[\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-*.f6478.9

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

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

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

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

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

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+199}:\\
\;\;\;\;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 a (*.f64 b c)) c) < -9.99999999999999945e272 or 4.9999999999999998e199 < (*.f64 (+.f64 a (*.f64 b c)) c)

    1. Initial program 75.1%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Add Preprocessing
    3. 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 egg-rr90.6%

      \[\leadsto 2 \cdot \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), c \cdot \left(-i\right), \mathsf{fma}\left(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 -2 \cdot \color{blue}{\left(\left({c}^{2} \cdot i\right) \cdot b\right)} \]
      2. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

    if -9.99999999999999945e272 < (*.f64 (+.f64 a (*.f64 b c)) c) < 4.9999999999999998e199

    1. Initial program 95.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-*.f6475.9

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

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

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

Alternative 9: 70.4% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 74.8%

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

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

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

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

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

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

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

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

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

    if -9.99999999999999945e272 < (*.f64 (+.f64 a (*.f64 b c)) c) < 4.9999999999999998e199

    1. Initial program 95.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-*.f6475.9

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

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

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

    1. Initial program 75.3%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in 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-*.f6466.1

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

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

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

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+199}:\\
\;\;\;\;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 a (*.f64 b c)) c) < -9.99999999999999945e272 or 4.9999999999999998e199 < (*.f64 (+.f64 a (*.f64 b c)) c)

    1. Initial program 75.1%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in 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-*.f6465.3

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

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

    if -9.99999999999999945e272 < (*.f64 (+.f64 a (*.f64 b c)) c) < 4.9999999999999998e199

    1. Initial program 95.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-*.f6475.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot \left(a + b \cdot c\right) \leq -1 \cdot 10^{+273}:\\ \;\;\;\;b \cdot \left(i \cdot \left(-2 \cdot \left(c \cdot c\right)\right)\right)\\ \mathbf{elif}\;c \cdot \left(a + b \cdot c\right) \leq 5 \cdot 10^{+199}:\\ \;\;\;\;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: 44.6% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(x \cdot y\right)\\ \mathbf{if}\;x \cdot y \leq -4.8 \cdot 10^{+75}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq -1.7 \cdot 10^{-106}:\\ \;\;\;\;a \cdot \left(c \cdot \left(i \cdot -2\right)\right)\\ \mathbf{elif}\;x \cdot y \leq 8.2 \cdot 10^{+122}:\\ \;\;\;\;t \cdot \left(2 \cdot z\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 (* x y))))
   (if (<= (* x y) -4.8e+75)
     t_1
     (if (<= (* x y) -1.7e-106)
       (* a (* c (* i -2.0)))
       (if (<= (* x y) 8.2e+122) (* t (* 2.0 z)) 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 * (x * y);
	double tmp;
	if ((x * y) <= -4.8e+75) {
		tmp = t_1;
	} else if ((x * y) <= -1.7e-106) {
		tmp = a * (c * (i * -2.0));
	} else if ((x * y) <= 8.2e+122) {
		tmp = t * (2.0 * z);
	} 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 * (x * y)
    if ((x * y) <= (-4.8d+75)) then
        tmp = t_1
    else if ((x * y) <= (-1.7d-106)) then
        tmp = a * (c * (i * (-2.0d0)))
    else if ((x * y) <= 8.2d+122) then
        tmp = t * (2.0d0 * z)
    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 * (x * y);
	double tmp;
	if ((x * y) <= -4.8e+75) {
		tmp = t_1;
	} else if ((x * y) <= -1.7e-106) {
		tmp = a * (c * (i * -2.0));
	} else if ((x * y) <= 8.2e+122) {
		tmp = t * (2.0 * z);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = 2.0 * (x * y)
	tmp = 0
	if (x * y) <= -4.8e+75:
		tmp = t_1
	elif (x * y) <= -1.7e-106:
		tmp = a * (c * (i * -2.0))
	elif (x * y) <= 8.2e+122:
		tmp = t * (2.0 * z)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(2.0 * Float64(x * y))
	tmp = 0.0
	if (Float64(x * y) <= -4.8e+75)
		tmp = t_1;
	elseif (Float64(x * y) <= -1.7e-106)
		tmp = Float64(a * Float64(c * Float64(i * -2.0)));
	elseif (Float64(x * y) <= 8.2e+122)
		tmp = Float64(t * Float64(2.0 * z));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = 2.0 * (x * y);
	tmp = 0.0;
	if ((x * y) <= -4.8e+75)
		tmp = t_1;
	elseif ((x * y) <= -1.7e-106)
		tmp = a * (c * (i * -2.0));
	elseif ((x * y) <= 8.2e+122)
		tmp = t * (2.0 * z);
	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[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -4.8e+75], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -1.7e-106], N[(a * N[(c * N[(i * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 8.2e+122], N[(t * N[(2.0 * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

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

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

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


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

    1. Initial program 85.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-*.f6465.0

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

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

    if -4.8e75 < (*.f64 x y) < -1.69999999999999991e-106

    1. Initial program 88.2%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Add Preprocessing
    3. 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 egg-rr94.2%

      \[\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-*.f6434.8

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

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

    if -1.69999999999999991e-106 < (*.f64 x y) < 8.2000000000000004e122

    1. Initial program 91.1%

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

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

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

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

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

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

        \[\leadsto t \cdot \color{blue}{\left(z \cdot 2\right)} \]
      6. lower-*.f6443.0

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

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

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

Alternative 12: 44.4% accurate, 0.9× speedup?

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

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

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

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

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


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

    1. Initial program 85.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-*.f6465.0

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

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

    if -1.5500000000000001e75 < (*.f64 x y) < -2e-107

    1. Initial program 88.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \mathsf{fma}\left(-2, \left(c \cdot i\right) \cdot \frac{\color{blue}{\mathsf{fma}\left(c, b, a\right)}}{y}, 2 \cdot x\right) \]
      11. lower-*.f6478.3

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

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

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

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

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

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

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

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

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

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

    if -2e-107 < (*.f64 x y) < 8.2000000000000004e122

    1. Initial program 91.1%

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

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

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

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

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

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

        \[\leadsto t \cdot \color{blue}{\left(z \cdot 2\right)} \]
      6. lower-*.f6443.0

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

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

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

Alternative 13: 44.4% accurate, 1.2× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -8.7999999999999998e-55 or 8.2000000000000004e122 < (*.f64 x y)

    1. Initial program 85.6%

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

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

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

    if -8.7999999999999998e-55 < (*.f64 x y) < 8.2000000000000004e122

    1. Initial program 90.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 \color{blue}{2 \cdot \left(t \cdot z\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

        \[\leadsto t \cdot \color{blue}{\left(z \cdot 2\right)} \]
      6. lower-*.f6442.0

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

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

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

Alternative 14: 29.9% accurate, 3.6× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto t \cdot \color{blue}{\left(z \cdot 2\right)} \]
    6. lower-*.f6428.8

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

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

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

Developer Target 1: 94.4% accurate, 1.0× speedup?

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

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

Reproduce

?
herbie shell --seed 2024208 
(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))))