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

Percentage Accurate: 89.3% → 97.2%
Time: 17.4s
Alternatives: 17
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 17 alternatives:

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

Initial Program: 89.3% accurate, 1.0× speedup?

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

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

Alternative 1: 97.2% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(x \cdot \mathsf{fma}\left(t\_1, \frac{\mathsf{fma}\left(c, b, a\right)}{x}, y\right)\right)\\


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

    1. Initial program 94.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if +inf.0 < (-.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i))

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(x \cdot \mathsf{fma}\left(0 - c \cdot i, \frac{\color{blue}{c \cdot b} + a}{x}, y\right)\right) \]
      16. accelerator-lowering-fma.f6490.0

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

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

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

Alternative 2: 63.3% accurate, 0.4× speedup?

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

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

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

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

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


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

    1. Initial program 82.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 i around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999999e100 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.9999999999999998e-95

    1. Initial program 99.1%

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

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

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

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

    if 4.9999999999999998e-95 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.99999999999999978e122

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

Alternative 3: 52.0% accurate, 0.4× speedup?

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

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

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

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

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


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

    1. Initial program 83.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999999e100 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.9999999999999998e-95

    1. Initial program 99.1%

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

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

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

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

    if 4.9999999999999998e-95 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5e258

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(y \cdot 2\right)} \]
      6. *-lowering-*.f6450.4

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

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

    if 5e258 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 74.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 i around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 51.8% accurate, 0.4× speedup?

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

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

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

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

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


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

    1. Initial program 83.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999999e100 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.9999999999999998e-95

    1. Initial program 99.1%

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

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

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

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

    if 4.9999999999999998e-95 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5e258

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(y \cdot 2\right)} \]
      6. *-lowering-*.f6450.4

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

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

    if 5e258 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 74.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 i around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 52.4% accurate, 0.4× speedup?

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

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

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

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

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


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

    1. Initial program 80.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 i around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999999e100 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.9999999999999998e-95

    1. Initial program 99.1%

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

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

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

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

    if 4.9999999999999998e-95 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5e258

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(y \cdot 2\right)} \]
      6. *-lowering-*.f6450.4

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

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

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

Alternative 6: 59.0% accurate, 0.5× speedup?

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

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

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

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+36}:\\
\;\;\;\;2 \cdot \left(z \cdot t\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) < -2.0000000000000001e149 or 4.99999999999999977e36 < (*.f64 (+.f64 a (*.f64 b c)) c)

    1. Initial program 83.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.0000000000000001e149 < (*.f64 (+.f64 a (*.f64 b c)) c) < -3.99999999999999969e-24

    1. Initial program 99.9%

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

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

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

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

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

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

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

    if -3.99999999999999969e-24 < (*.f64 (+.f64 a (*.f64 b c)) c) < 4.99999999999999977e36

    1. Initial program 98.9%

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

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

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

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

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

Alternative 7: 89.8% accurate, 0.5× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -4.9999999999999999e100 or 9.9999999999999997e223 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    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. Step-by-step derivation
      1. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999999e100 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.9999999999999997e223

    1. Initial program 99.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 a around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 87.6% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 83.0%

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999999e100 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5e258

    1. Initial program 99.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 a around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5e258 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 74.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 i around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 87.7% accurate, 0.5× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -4.9999999999999999e100 or 5e258 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 80.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 i around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999999e100 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5e258

    1. Initial program 99.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 a around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 66.6% accurate, 0.5× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -4.9999999999999999e100 or 9.9999999999999997e223 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    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 i around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999999e100 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.9999999999999997e223

    1. Initial program 99.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 a around inf

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(t \cdot z - \color{blue}{a \cdot \left(c \cdot i\right)}\right) \]
      4. *-lowering-*.f6459.0

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

      \[\leadsto 2 \cdot \color{blue}{\left(t \cdot z - a \cdot \left(c \cdot i\right)\right)} \]
    9. Step-by-step derivation
      1. sub-negN/A

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

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

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

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

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

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

        \[\leadsto 2 \cdot \mathsf{fma}\left(z, t, a \cdot \color{blue}{\left(0 - c \cdot i\right)}\right) \]
      8. *-lowering-*.f6459.0

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

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

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

Alternative 11: 66.6% accurate, 0.6× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -4.9999999999999999e100 or 9.9999999999999997e223 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    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 i around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999999e100 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.9999999999999997e223

    1. Initial program 99.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 a around inf

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(t \cdot z - \color{blue}{a \cdot \left(c \cdot i\right)}\right) \]
      4. *-lowering-*.f6459.0

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

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

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

Alternative 12: 42.5% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -200000:\\
\;\;\;\;2 \cdot \left(z \cdot t\right)\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 z t) < -2e5

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

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

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

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

    if -2e5 < (*.f64 z t) < -9.99999999999999995e-56

    1. Initial program 76.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 a around inf

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

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

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

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

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

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

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

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

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

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

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

    if -9.99999999999999995e-56 < (*.f64 z t) < 9.99999999999999929e-40

    1. Initial program 90.8%

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

      \[\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. associate-*r*N/A

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(y \cdot 2\right)} \]
      6. *-lowering-*.f6442.7

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

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

    if 9.99999999999999929e-40 < (*.f64 z t)

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(2 \cdot z\right)} \cdot t \]
    7. Applied egg-rr58.7%

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

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

Alternative 13: 94.5% accurate, 1.1× speedup?

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

\\
2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), 0 - c \cdot i, \mathsf{fma}\left(x, y, z \cdot t\right)\right)
\end{array}
Derivation
  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. Step-by-step derivation
    1. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 91.8% accurate, 1.1× speedup?

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

\\
2 \cdot \mathsf{fma}\left(z, t, x \cdot y - c \cdot \left(i \cdot \mathsf{fma}\left(b, c, a\right)\right)\right)
\end{array}
Derivation
  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. Step-by-step derivation
    1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \mathsf{fma}\left(z, t, x \cdot y - c \cdot \left(i \cdot \color{blue}{\left(b \cdot c + a\right)}\right)\right) \]
    12. accelerator-lowering-fma.f6495.8

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

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

Alternative 15: 42.1% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{-53}:\\
\;\;\;\;2 \cdot \left(z \cdot t\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z t) < -1.00000000000000003e-53

    1. Initial program 88.4%

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

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

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

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

    if -1.00000000000000003e-53 < (*.f64 z t) < 9.99999999999999929e-40

    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 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. associate-*r*N/A

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

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

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

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

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

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

    if 9.99999999999999929e-40 < (*.f64 z t)

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(2 \cdot z\right)} \cdot t \]
    7. Applied egg-rr58.7%

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

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

Alternative 16: 42.2% accurate, 1.2× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -1.00000000000000003e-53 or 9.99999999999999929e-40 < (*.f64 z t)

    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 2 \cdot \color{blue}{\left(t \cdot z\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f6456.0

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

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

    if -1.00000000000000003e-53 < (*.f64 z t) < 9.99999999999999929e-40

    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 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. associate-*r*N/A

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

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

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

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

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

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

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

Alternative 17: 28.7% accurate, 3.6× speedup?

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

\\
2 \cdot \left(z \cdot t\right)
\end{array}
Derivation
  1. Initial program 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 2 \cdot \color{blue}{\left(t \cdot z\right)} \]
  4. Step-by-step derivation
    1. *-lowering-*.f6433.4

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

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

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

Developer Target 1: 93.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 2024195 
(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))))