Diagrams.Solve.Polynomial:quartForm from diagrams-solve-0.1, C

Percentage Accurate: 97.5% → 98.7%
Time: 12.3s
Alternatives: 13
Speedup: 0.5×

Specification

?
\[\begin{array}{l} \\ \left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
	return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
real(8) function code(x, y, z, t, a, b, c)
    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
    code = (((x * y) + ((z * t) / 16.0d0)) - ((a * b) / 4.0d0)) + c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
	return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
def code(x, y, z, t, a, b, c):
	return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c
function code(x, y, z, t, a, b, c)
	return Float64(Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) + c)
end
function tmp = code(x, y, z, t, a, b, c)
	tmp = (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
\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 13 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: 97.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
	return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
real(8) function code(x, y, z, t, a, b, c)
    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
    code = (((x * y) + ((z * t) / 16.0d0)) - ((a * b) / 4.0d0)) + c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
	return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
def code(x, y, z, t, a, b, c):
	return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c
function code(x, y, z, t, a, b, c)
	return Float64(Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) + c)
end
function tmp = code(x, y, z, t, a, b, c)
	tmp = (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
\end{array}

Alternative 1: 98.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\\ \mathbf{if}\;t\_1 \leq \infty:\\ \;\;\;\;c + t\_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y + -0.25 \cdot \frac{a \cdot b}{x}\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0))))
   (if (<= t_1 INFINITY) (+ c t_1) (* x (+ y (* -0.25 (/ (* a b) x)))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = ((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0);
	double tmp;
	if (t_1 <= ((double) INFINITY)) {
		tmp = c + t_1;
	} else {
		tmp = x * (y + (-0.25 * ((a * b) / x)));
	}
	return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = ((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0);
	double tmp;
	if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = c + t_1;
	} else {
		tmp = x * (y + (-0.25 * ((a * b) / x)));
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = ((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)
	tmp = 0
	if t_1 <= math.inf:
		tmp = c + t_1
	else:
		tmp = x * (y + (-0.25 * ((a * b) / x)))
	return tmp
function code(x, y, z, t, a, b, c)
	t_1 = Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0))
	tmp = 0.0
	if (t_1 <= Inf)
		tmp = Float64(c + t_1);
	else
		tmp = Float64(x * Float64(y + Float64(-0.25 * Float64(Float64(a * b) / x))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	t_1 = ((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0);
	tmp = 0.0;
	if (t_1 <= Inf)
		tmp = c + t_1;
	else
		tmp = x * (y + (-0.25 * ((a * b) / x)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], N[(c + t$95$1), $MachinePrecision], N[(x * N[(y + N[(-0.25 * N[(N[(a * b), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;x \cdot \left(y + -0.25 \cdot \frac{a \cdot b}{x}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) (/.f64 (*.f64 a b) #s(literal 4 binary64))) < +inf.0

    1. Initial program 100.0%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing

    if +inf.0 < (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) (/.f64 (*.f64 a b) #s(literal 4 binary64)))

    1. Initial program 0.0%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Step-by-step derivation
      1. associate-+l-0.0%

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

        \[\leadsto \color{blue}{\left(\frac{z \cdot t}{16} + x \cdot y\right)} - \left(\frac{a \cdot b}{4} - c\right) \]
      3. *-commutative0.0%

        \[\leadsto \left(\frac{\color{blue}{t \cdot z}}{16} + x \cdot y\right) - \left(\frac{a \cdot b}{4} - c\right) \]
      4. +-commutative0.0%

        \[\leadsto \color{blue}{\left(x \cdot y + \frac{t \cdot z}{16}\right)} - \left(\frac{a \cdot b}{4} - c\right) \]
      5. associate-+l-0.0%

        \[\leadsto \color{blue}{\left(\left(x \cdot y + \frac{t \cdot z}{16}\right) - \frac{a \cdot b}{4}\right) + c} \]
      6. fma-define0.0%

        \[\leadsto \left(\color{blue}{\mathsf{fma}\left(x, y, \frac{t \cdot z}{16}\right)} - \frac{a \cdot b}{4}\right) + c \]
      7. *-commutative0.0%

        \[\leadsto \left(\mathsf{fma}\left(x, y, \frac{\color{blue}{z \cdot t}}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
      8. associate-/l*0.0%

        \[\leadsto \left(\mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}}\right) - \frac{a \cdot b}{4}\right) + c \]
      9. associate-/l*0.0%

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

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x, y, z \cdot \frac{t}{16}\right) - a \cdot \frac{b}{4}\right) + c} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 33.3%

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

      \[\leadsto \color{blue}{x \cdot \left(y + -0.25 \cdot \frac{a \cdot b}{x}\right)} + c \]
    7. Taylor expanded in c around 0 66.7%

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

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

Alternative 2: 98.9% accurate, 0.1× speedup?

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

\\
\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \frac{a \cdot b}{-4}\right)\right) + c
\end{array}
Derivation
  1. Initial program 97.6%

    \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
  2. Step-by-step derivation
    1. associate--l+97.6%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \frac{z \cdot t}{16} - \frac{a \cdot b}{4}\right)} + c \]
    3. associate-/l*98.0%

      \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}} - \frac{a \cdot b}{4}\right) + c \]
    4. fmm-def98.8%

      \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\mathsf{fma}\left(z, \frac{t}{16}, -\frac{a \cdot b}{4}\right)}\right) + c \]
    5. distribute-neg-frac298.8%

      \[\leadsto \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{\frac{a \cdot b}{-4}}\right)\right) + c \]
    6. metadata-eval98.8%

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

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

Alternative 3: 43.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := b \cdot \left(a \cdot -0.25\right)\\ \mathbf{if}\;x \cdot y \leq -2.5 \cdot 10^{+111}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -6.5 \cdot 10^{-207}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 5.5 \cdot 10^{-90}:\\ \;\;\;\;c\\ \mathbf{elif}\;x \cdot y \leq 7.5 \cdot 10^{+172}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (* b (* a -0.25))))
   (if (<= (* x y) -2.5e+111)
     (* x y)
     (if (<= (* x y) -6.5e-207)
       t_1
       (if (<= (* x y) 5.5e-90) c (if (<= (* x y) 7.5e+172) t_1 (* x y)))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = b * (a * -0.25);
	double tmp;
	if ((x * y) <= -2.5e+111) {
		tmp = x * y;
	} else if ((x * y) <= -6.5e-207) {
		tmp = t_1;
	} else if ((x * y) <= 5.5e-90) {
		tmp = c;
	} else if ((x * y) <= 7.5e+172) {
		tmp = t_1;
	} else {
		tmp = x * y;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
    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) :: t_1
    real(8) :: tmp
    t_1 = b * (a * (-0.25d0))
    if ((x * y) <= (-2.5d+111)) then
        tmp = x * y
    else if ((x * y) <= (-6.5d-207)) then
        tmp = t_1
    else if ((x * y) <= 5.5d-90) then
        tmp = c
    else if ((x * y) <= 7.5d+172) then
        tmp = t_1
    else
        tmp = x * y
    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 t_1 = b * (a * -0.25);
	double tmp;
	if ((x * y) <= -2.5e+111) {
		tmp = x * y;
	} else if ((x * y) <= -6.5e-207) {
		tmp = t_1;
	} else if ((x * y) <= 5.5e-90) {
		tmp = c;
	} else if ((x * y) <= 7.5e+172) {
		tmp = t_1;
	} else {
		tmp = x * y;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = b * (a * -0.25)
	tmp = 0
	if (x * y) <= -2.5e+111:
		tmp = x * y
	elif (x * y) <= -6.5e-207:
		tmp = t_1
	elif (x * y) <= 5.5e-90:
		tmp = c
	elif (x * y) <= 7.5e+172:
		tmp = t_1
	else:
		tmp = x * y
	return tmp
function code(x, y, z, t, a, b, c)
	t_1 = Float64(b * Float64(a * -0.25))
	tmp = 0.0
	if (Float64(x * y) <= -2.5e+111)
		tmp = Float64(x * y);
	elseif (Float64(x * y) <= -6.5e-207)
		tmp = t_1;
	elseif (Float64(x * y) <= 5.5e-90)
		tmp = c;
	elseif (Float64(x * y) <= 7.5e+172)
		tmp = t_1;
	else
		tmp = Float64(x * y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	t_1 = b * (a * -0.25);
	tmp = 0.0;
	if ((x * y) <= -2.5e+111)
		tmp = x * y;
	elseif ((x * y) <= -6.5e-207)
		tmp = t_1;
	elseif ((x * y) <= 5.5e-90)
		tmp = c;
	elseif ((x * y) <= 7.5e+172)
		tmp = t_1;
	else
		tmp = x * y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2.5e+111], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -6.5e-207], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5.5e-90], c, If[LessEqual[N[(x * y), $MachinePrecision], 7.5e+172], t$95$1, N[(x * y), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := b \cdot \left(a \cdot -0.25\right)\\
\mathbf{if}\;x \cdot y \leq -2.5 \cdot 10^{+111}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;x \cdot y \leq -6.5 \cdot 10^{-207}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \cdot y \leq 5.5 \cdot 10^{-90}:\\
\;\;\;\;c\\

\mathbf{elif}\;x \cdot y \leq 7.5 \cdot 10^{+172}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;x \cdot y\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -2.4999999999999998e111 or 7.4999999999999994e172 < (*.f64 x y)

    1. Initial program 94.2%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Step-by-step derivation
      1. associate--l+94.2%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \frac{z \cdot t}{16} - \frac{a \cdot b}{4}\right)} + c \]
      3. associate-/l*95.6%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}} - \frac{a \cdot b}{4}\right) + c \]
      4. fmm-def97.1%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\mathsf{fma}\left(z, \frac{t}{16}, -\frac{a \cdot b}{4}\right)}\right) + c \]
      5. distribute-neg-frac297.1%

        \[\leadsto \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{\frac{a \cdot b}{-4}}\right)\right) + c \]
      6. metadata-eval97.1%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \frac{a \cdot b}{-4}\right)\right) + c} \]
    4. Add Preprocessing
    5. Taylor expanded in a around 0 88.4%

      \[\leadsto \color{blue}{c + \left(0.0625 \cdot \left(t \cdot z\right) + x \cdot y\right)} \]
    6. Taylor expanded in t around 0 79.9%

      \[\leadsto c + \color{blue}{x \cdot y} \]
    7. Taylor expanded in c around 0 74.1%

      \[\leadsto \color{blue}{x \cdot y} \]

    if -2.4999999999999998e111 < (*.f64 x y) < -6.5000000000000001e-207 or 5.5000000000000003e-90 < (*.f64 x y) < 7.4999999999999994e172

    1. Initial program 100.0%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Step-by-step derivation
      1. associate-+l-100.0%

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

        \[\leadsto \color{blue}{\left(\frac{z \cdot t}{16} + x \cdot y\right)} - \left(\frac{a \cdot b}{4} - c\right) \]
      3. *-commutative100.0%

        \[\leadsto \left(\frac{\color{blue}{t \cdot z}}{16} + x \cdot y\right) - \left(\frac{a \cdot b}{4} - c\right) \]
      4. +-commutative100.0%

        \[\leadsto \color{blue}{\left(x \cdot y + \frac{t \cdot z}{16}\right)} - \left(\frac{a \cdot b}{4} - c\right) \]
      5. associate-+l-100.0%

        \[\leadsto \color{blue}{\left(\left(x \cdot y + \frac{t \cdot z}{16}\right) - \frac{a \cdot b}{4}\right) + c} \]
      6. fma-define100.0%

        \[\leadsto \left(\color{blue}{\mathsf{fma}\left(x, y, \frac{t \cdot z}{16}\right)} - \frac{a \cdot b}{4}\right) + c \]
      7. *-commutative100.0%

        \[\leadsto \left(\mathsf{fma}\left(x, y, \frac{\color{blue}{z \cdot t}}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
      8. associate-/l*100.0%

        \[\leadsto \left(\mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}}\right) - \frac{a \cdot b}{4}\right) + c \]
      9. associate-/l*100.0%

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

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x, y, z \cdot \frac{t}{16}\right) - a \cdot \frac{b}{4}\right) + c} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 67.8%

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

      \[\leadsto \color{blue}{x \cdot \left(y + -0.25 \cdot \frac{a \cdot b}{x}\right)} + c \]
    7. Taylor expanded in c around 0 42.9%

      \[\leadsto \color{blue}{x \cdot \left(y + -0.25 \cdot \frac{a \cdot b}{x}\right)} \]
    8. Taylor expanded in x around 0 38.9%

      \[\leadsto \color{blue}{-0.25 \cdot \left(a \cdot b\right)} \]
    9. Step-by-step derivation
      1. *-commutative38.9%

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot -0.25} \]
      2. *-commutative38.9%

        \[\leadsto \color{blue}{\left(b \cdot a\right)} \cdot -0.25 \]
      3. associate-*r*38.9%

        \[\leadsto \color{blue}{b \cdot \left(a \cdot -0.25\right)} \]
      4. *-commutative38.9%

        \[\leadsto b \cdot \color{blue}{\left(-0.25 \cdot a\right)} \]
    10. Simplified38.9%

      \[\leadsto \color{blue}{b \cdot \left(-0.25 \cdot a\right)} \]

    if -6.5000000000000001e-207 < (*.f64 x y) < 5.5000000000000003e-90

    1. Initial program 97.6%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Step-by-step derivation
      1. associate--l+97.6%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \frac{z \cdot t}{16} - \frac{a \cdot b}{4}\right)} + c \]
      3. associate-/l*97.6%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}} - \frac{a \cdot b}{4}\right) + c \]
      4. fmm-def98.8%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\mathsf{fma}\left(z, \frac{t}{16}, -\frac{a \cdot b}{4}\right)}\right) + c \]
      5. distribute-neg-frac298.8%

        \[\leadsto \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{\frac{a \cdot b}{-4}}\right)\right) + c \]
      6. metadata-eval98.8%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \frac{a \cdot b}{-4}\right)\right) + c} \]
    4. Add Preprocessing
    5. Taylor expanded in c around inf 40.1%

      \[\leadsto \color{blue}{c} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification48.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2.5 \cdot 10^{+111}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -6.5 \cdot 10^{-207}:\\ \;\;\;\;b \cdot \left(a \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 5.5 \cdot 10^{-90}:\\ \;\;\;\;c\\ \mathbf{elif}\;x \cdot y \leq 7.5 \cdot 10^{+172}:\\ \;\;\;\;b \cdot \left(a \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 65.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := c + x \cdot y\\ \mathbf{if}\;x \cdot y \leq -6 \cdot 10^{+103}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq -0.0048:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 3.2 \cdot 10^{+174}:\\ \;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (+ c (* x y))))
   (if (<= (* x y) -6e+103)
     t_1
     (if (<= (* x y) -0.0048)
       (+ c (* a (* b -0.25)))
       (if (<= (* x y) 3.2e+174) (+ c (* z (* t 0.0625))) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = c + (x * y);
	double tmp;
	if ((x * y) <= -6e+103) {
		tmp = t_1;
	} else if ((x * y) <= -0.0048) {
		tmp = c + (a * (b * -0.25));
	} else if ((x * y) <= 3.2e+174) {
		tmp = c + (z * (t * 0.0625));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
    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) :: t_1
    real(8) :: tmp
    t_1 = c + (x * y)
    if ((x * y) <= (-6d+103)) then
        tmp = t_1
    else if ((x * y) <= (-0.0048d0)) then
        tmp = c + (a * (b * (-0.25d0)))
    else if ((x * y) <= 3.2d+174) then
        tmp = c + (z * (t * 0.0625d0))
    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 t_1 = c + (x * y);
	double tmp;
	if ((x * y) <= -6e+103) {
		tmp = t_1;
	} else if ((x * y) <= -0.0048) {
		tmp = c + (a * (b * -0.25));
	} else if ((x * y) <= 3.2e+174) {
		tmp = c + (z * (t * 0.0625));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = c + (x * y)
	tmp = 0
	if (x * y) <= -6e+103:
		tmp = t_1
	elif (x * y) <= -0.0048:
		tmp = c + (a * (b * -0.25))
	elif (x * y) <= 3.2e+174:
		tmp = c + (z * (t * 0.0625))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c)
	t_1 = Float64(c + Float64(x * y))
	tmp = 0.0
	if (Float64(x * y) <= -6e+103)
		tmp = t_1;
	elseif (Float64(x * y) <= -0.0048)
		tmp = Float64(c + Float64(a * Float64(b * -0.25)));
	elseif (Float64(x * y) <= 3.2e+174)
		tmp = Float64(c + Float64(z * Float64(t * 0.0625)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	t_1 = c + (x * y);
	tmp = 0.0;
	if ((x * y) <= -6e+103)
		tmp = t_1;
	elseif ((x * y) <= -0.0048)
		tmp = c + (a * (b * -0.25));
	elseif ((x * y) <= 3.2e+174)
		tmp = c + (z * (t * 0.0625));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -6e+103], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -0.0048], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 3.2e+174], N[(c + N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := c + x \cdot y\\
\mathbf{if}\;x \cdot y \leq -6 \cdot 10^{+103}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \cdot y \leq -0.0048:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\

\mathbf{elif}\;x \cdot y \leq 3.2 \cdot 10^{+174}:\\
\;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -6e103 or 3.2e174 < (*.f64 x y)

    1. Initial program 94.0%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Step-by-step derivation
      1. associate--l+94.0%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \frac{z \cdot t}{16} - \frac{a \cdot b}{4}\right)} + c \]
      3. associate-/l*95.5%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}} - \frac{a \cdot b}{4}\right) + c \]
      4. fmm-def97.0%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\mathsf{fma}\left(z, \frac{t}{16}, -\frac{a \cdot b}{4}\right)}\right) + c \]
      5. distribute-neg-frac297.0%

        \[\leadsto \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{\frac{a \cdot b}{-4}}\right)\right) + c \]
      6. metadata-eval97.0%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \frac{a \cdot b}{-4}\right)\right) + c} \]
    4. Add Preprocessing
    5. Taylor expanded in a around 0 88.1%

      \[\leadsto \color{blue}{c + \left(0.0625 \cdot \left(t \cdot z\right) + x \cdot y\right)} \]
    6. Taylor expanded in t around 0 80.7%

      \[\leadsto c + \color{blue}{x \cdot y} \]

    if -6e103 < (*.f64 x y) < -0.00479999999999999958

    1. Initial program 100.0%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Step-by-step derivation
      1. associate--l+100.0%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \frac{z \cdot t}{16} - \frac{a \cdot b}{4}\right)} + c \]
      3. associate-/l*100.0%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}} - \frac{a \cdot b}{4}\right) + c \]
      4. fmm-def100.0%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\mathsf{fma}\left(z, \frac{t}{16}, -\frac{a \cdot b}{4}\right)}\right) + c \]
      5. distribute-neg-frac2100.0%

        \[\leadsto \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{\frac{a \cdot b}{-4}}\right)\right) + c \]
      6. metadata-eval100.0%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \frac{a \cdot b}{-4}\right)\right) + c} \]
    4. Add Preprocessing
    5. Taylor expanded in a around inf 69.4%

      \[\leadsto \color{blue}{-0.25 \cdot \left(a \cdot b\right)} + c \]
    6. Step-by-step derivation
      1. *-commutative69.4%

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot -0.25} + c \]
      2. associate-*r*69.4%

        \[\leadsto \color{blue}{a \cdot \left(b \cdot -0.25\right)} + c \]
    7. Simplified69.4%

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

    if -0.00479999999999999958 < (*.f64 x y) < 3.2e174

    1. Initial program 98.8%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 88.7%

      \[\leadsto \color{blue}{z \cdot \left(\left(0.0625 \cdot t + \frac{x \cdot y}{z}\right) - 0.25 \cdot \frac{a \cdot b}{z}\right)} + c \]
    4. Taylor expanded in t around inf 69.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -6 \cdot 10^{+103}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -0.0048:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 3.2 \cdot 10^{+174}:\\ \;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{else}:\\ \;\;\;\;c + x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 88.6% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+113}:\\ \;\;\;\;c + \left(x \cdot y - a \cdot \frac{b}{4}\right)\\ \mathbf{elif}\;x \cdot y \leq 10^{+174}:\\ \;\;\;\;c + \left(0.0625 \cdot \left(z \cdot t\right) - \left(a \cdot b\right) \cdot 0.25\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y + -0.25 \cdot \frac{a \cdot b}{x}\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (if (<= (* x y) -4e+113)
   (+ c (- (* x y) (* a (/ b 4.0))))
   (if (<= (* x y) 1e+174)
     (+ c (- (* 0.0625 (* z t)) (* (* a b) 0.25)))
     (* x (+ y (* -0.25 (/ (* a b) x)))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double tmp;
	if ((x * y) <= -4e+113) {
		tmp = c + ((x * y) - (a * (b / 4.0)));
	} else if ((x * y) <= 1e+174) {
		tmp = c + ((0.0625 * (z * t)) - ((a * b) * 0.25));
	} else {
		tmp = x * (y + (-0.25 * ((a * b) / x)));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
    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) :: tmp
    if ((x * y) <= (-4d+113)) then
        tmp = c + ((x * y) - (a * (b / 4.0d0)))
    else if ((x * y) <= 1d+174) then
        tmp = c + ((0.0625d0 * (z * t)) - ((a * b) * 0.25d0))
    else
        tmp = x * (y + ((-0.25d0) * ((a * b) / x)))
    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 tmp;
	if ((x * y) <= -4e+113) {
		tmp = c + ((x * y) - (a * (b / 4.0)));
	} else if ((x * y) <= 1e+174) {
		tmp = c + ((0.0625 * (z * t)) - ((a * b) * 0.25));
	} else {
		tmp = x * (y + (-0.25 * ((a * b) / x)));
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	tmp = 0
	if (x * y) <= -4e+113:
		tmp = c + ((x * y) - (a * (b / 4.0)))
	elif (x * y) <= 1e+174:
		tmp = c + ((0.0625 * (z * t)) - ((a * b) * 0.25))
	else:
		tmp = x * (y + (-0.25 * ((a * b) / x)))
	return tmp
function code(x, y, z, t, a, b, c)
	tmp = 0.0
	if (Float64(x * y) <= -4e+113)
		tmp = Float64(c + Float64(Float64(x * y) - Float64(a * Float64(b / 4.0))));
	elseif (Float64(x * y) <= 1e+174)
		tmp = Float64(c + Float64(Float64(0.0625 * Float64(z * t)) - Float64(Float64(a * b) * 0.25)));
	else
		tmp = Float64(x * Float64(y + Float64(-0.25 * Float64(Float64(a * b) / x))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	tmp = 0.0;
	if ((x * y) <= -4e+113)
		tmp = c + ((x * y) - (a * (b / 4.0)));
	elseif ((x * y) <= 1e+174)
		tmp = c + ((0.0625 * (z * t)) - ((a * b) * 0.25));
	else
		tmp = x * (y + (-0.25 * ((a * b) / x)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(x * y), $MachinePrecision], -4e+113], N[(c + N[(N[(x * y), $MachinePrecision] - N[(a * N[(b / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+174], N[(c + N[(N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(y + N[(-0.25 * N[(N[(a * b), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+113}:\\
\;\;\;\;c + \left(x \cdot y - a \cdot \frac{b}{4}\right)\\

\mathbf{elif}\;x \cdot y \leq 10^{+174}:\\
\;\;\;\;c + \left(0.0625 \cdot \left(z \cdot t\right) - \left(a \cdot b\right) \cdot 0.25\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot \left(y + -0.25 \cdot \frac{a \cdot b}{x}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -4e113

    1. Initial program 97.1%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Step-by-step derivation
      1. associate-+l-97.1%

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

        \[\leadsto \color{blue}{\left(\frac{z \cdot t}{16} + x \cdot y\right)} - \left(\frac{a \cdot b}{4} - c\right) \]
      3. *-commutative97.1%

        \[\leadsto \left(\frac{\color{blue}{t \cdot z}}{16} + x \cdot y\right) - \left(\frac{a \cdot b}{4} - c\right) \]
      4. +-commutative97.1%

        \[\leadsto \color{blue}{\left(x \cdot y + \frac{t \cdot z}{16}\right)} - \left(\frac{a \cdot b}{4} - c\right) \]
      5. associate-+l-97.1%

        \[\leadsto \color{blue}{\left(\left(x \cdot y + \frac{t \cdot z}{16}\right) - \frac{a \cdot b}{4}\right) + c} \]
      6. fma-define97.1%

        \[\leadsto \left(\color{blue}{\mathsf{fma}\left(x, y, \frac{t \cdot z}{16}\right)} - \frac{a \cdot b}{4}\right) + c \]
      7. *-commutative97.1%

        \[\leadsto \left(\mathsf{fma}\left(x, y, \frac{\color{blue}{z \cdot t}}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
      8. associate-/l*97.1%

        \[\leadsto \left(\mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}}\right) - \frac{a \cdot b}{4}\right) + c \]
      9. associate-/l*97.1%

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

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x, y, z \cdot \frac{t}{16}\right) - a \cdot \frac{b}{4}\right) + c} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 92.9%

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

    if -4e113 < (*.f64 x y) < 1.00000000000000007e174

    1. Initial program 98.9%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 93.8%

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

    if 1.00000000000000007e174 < (*.f64 x y)

    1. Initial program 90.9%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Step-by-step derivation
      1. associate-+l-90.9%

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

        \[\leadsto \color{blue}{\left(\frac{z \cdot t}{16} + x \cdot y\right)} - \left(\frac{a \cdot b}{4} - c\right) \]
      3. *-commutative90.9%

        \[\leadsto \left(\frac{\color{blue}{t \cdot z}}{16} + x \cdot y\right) - \left(\frac{a \cdot b}{4} - c\right) \]
      4. +-commutative90.9%

        \[\leadsto \color{blue}{\left(x \cdot y + \frac{t \cdot z}{16}\right)} - \left(\frac{a \cdot b}{4} - c\right) \]
      5. associate-+l-90.9%

        \[\leadsto \color{blue}{\left(\left(x \cdot y + \frac{t \cdot z}{16}\right) - \frac{a \cdot b}{4}\right) + c} \]
      6. fma-define90.9%

        \[\leadsto \left(\color{blue}{\mathsf{fma}\left(x, y, \frac{t \cdot z}{16}\right)} - \frac{a \cdot b}{4}\right) + c \]
      7. *-commutative90.9%

        \[\leadsto \left(\mathsf{fma}\left(x, y, \frac{\color{blue}{z \cdot t}}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
      8. associate-/l*90.9%

        \[\leadsto \left(\mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}}\right) - \frac{a \cdot b}{4}\right) + c \]
      9. associate-/l*90.9%

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

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x, y, z \cdot \frac{t}{16}\right) - a \cdot \frac{b}{4}\right) + c} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 80.1%

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

      \[\leadsto \color{blue}{x \cdot \left(y + -0.25 \cdot \frac{a \cdot b}{x}\right)} + c \]
    7. Taylor expanded in c around 0 86.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+113}:\\ \;\;\;\;c + \left(x \cdot y - a \cdot \frac{b}{4}\right)\\ \mathbf{elif}\;x \cdot y \leq 10^{+174}:\\ \;\;\;\;c + \left(0.0625 \cdot \left(z \cdot t\right) - \left(a \cdot b\right) \cdot 0.25\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y + -0.25 \cdot \frac{a \cdot b}{x}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 87.0% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+255} \lor \neg \left(a \cdot b \leq 2 \cdot 10^{+52}\right):\\ \;\;\;\;c + \left(x \cdot y - a \cdot \frac{b}{4}\right)\\ \mathbf{else}:\\ \;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (if (or (<= (* a b) -5e+255) (not (<= (* a b) 2e+52)))
   (+ c (- (* x y) (* a (/ b 4.0))))
   (+ c (+ (* x y) (* 0.0625 (* z t))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double tmp;
	if (((a * b) <= -5e+255) || !((a * b) <= 2e+52)) {
		tmp = c + ((x * y) - (a * (b / 4.0)));
	} else {
		tmp = c + ((x * y) + (0.0625 * (z * t)));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
    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) :: tmp
    if (((a * b) <= (-5d+255)) .or. (.not. ((a * b) <= 2d+52))) then
        tmp = c + ((x * y) - (a * (b / 4.0d0)))
    else
        tmp = c + ((x * y) + (0.0625d0 * (z * t)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
	double tmp;
	if (((a * b) <= -5e+255) || !((a * b) <= 2e+52)) {
		tmp = c + ((x * y) - (a * (b / 4.0)));
	} else {
		tmp = c + ((x * y) + (0.0625 * (z * t)));
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	tmp = 0
	if ((a * b) <= -5e+255) or not ((a * b) <= 2e+52):
		tmp = c + ((x * y) - (a * (b / 4.0)))
	else:
		tmp = c + ((x * y) + (0.0625 * (z * t)))
	return tmp
function code(x, y, z, t, a, b, c)
	tmp = 0.0
	if ((Float64(a * b) <= -5e+255) || !(Float64(a * b) <= 2e+52))
		tmp = Float64(c + Float64(Float64(x * y) - Float64(a * Float64(b / 4.0))));
	else
		tmp = Float64(c + Float64(Float64(x * y) + Float64(0.0625 * Float64(z * t))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	tmp = 0.0;
	if (((a * b) <= -5e+255) || ~(((a * b) <= 2e+52)))
		tmp = c + ((x * y) - (a * (b / 4.0)));
	else
		tmp = c + ((x * y) + (0.0625 * (z * t)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -5e+255], N[Not[LessEqual[N[(a * b), $MachinePrecision], 2e+52]], $MachinePrecision]], N[(c + N[(N[(x * y), $MachinePrecision] - N[(a * N[(b / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(x * y), $MachinePrecision] + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+255} \lor \neg \left(a \cdot b \leq 2 \cdot 10^{+52}\right):\\
\;\;\;\;c + \left(x \cdot y - a \cdot \frac{b}{4}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -5.0000000000000002e255 or 2e52 < (*.f64 a b)

    1. Initial program 93.8%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Step-by-step derivation
      1. associate-+l-93.8%

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

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

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

        \[\leadsto \color{blue}{\left(x \cdot y + \frac{t \cdot z}{16}\right)} - \left(\frac{a \cdot b}{4} - c\right) \]
      5. associate-+l-93.8%

        \[\leadsto \color{blue}{\left(\left(x \cdot y + \frac{t \cdot z}{16}\right) - \frac{a \cdot b}{4}\right) + c} \]
      6. fma-define93.8%

        \[\leadsto \left(\color{blue}{\mathsf{fma}\left(x, y, \frac{t \cdot z}{16}\right)} - \frac{a \cdot b}{4}\right) + c \]
      7. *-commutative93.8%

        \[\leadsto \left(\mathsf{fma}\left(x, y, \frac{\color{blue}{z \cdot t}}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
      8. associate-/l*93.8%

        \[\leadsto \left(\mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}}\right) - \frac{a \cdot b}{4}\right) + c \]
      9. associate-/l*93.8%

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

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x, y, z \cdot \frac{t}{16}\right) - a \cdot \frac{b}{4}\right) + c} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 87.2%

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

    if -5.0000000000000002e255 < (*.f64 a b) < 2e52

    1. Initial program 99.4%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Step-by-step derivation
      1. associate--l+99.4%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \frac{z \cdot t}{16} - \frac{a \cdot b}{4}\right)} + c \]
      3. associate-/l*99.4%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}} - \frac{a \cdot b}{4}\right) + c \]
      4. fmm-def99.4%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\mathsf{fma}\left(z, \frac{t}{16}, -\frac{a \cdot b}{4}\right)}\right) + c \]
      5. distribute-neg-frac299.4%

        \[\leadsto \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{\frac{a \cdot b}{-4}}\right)\right) + c \]
      6. metadata-eval99.4%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \frac{a \cdot b}{-4}\right)\right) + c} \]
    4. Add Preprocessing
    5. Taylor expanded in a around 0 93.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+255} \lor \neg \left(a \cdot b \leq 2 \cdot 10^{+52}\right):\\ \;\;\;\;c + \left(x \cdot y - a \cdot \frac{b}{4}\right)\\ \mathbf{else}:\\ \;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 85.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+255} \lor \neg \left(a \cdot b \leq 5 \cdot 10^{+103}\right):\\ \;\;\;\;x \cdot y + \left(a \cdot b\right) \cdot -0.25\\ \mathbf{else}:\\ \;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (if (or (<= (* a b) -5e+255) (not (<= (* a b) 5e+103)))
   (+ (* x y) (* (* a b) -0.25))
   (+ c (+ (* x y) (* 0.0625 (* z t))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double tmp;
	if (((a * b) <= -5e+255) || !((a * b) <= 5e+103)) {
		tmp = (x * y) + ((a * b) * -0.25);
	} else {
		tmp = c + ((x * y) + (0.0625 * (z * t)));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
    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) :: tmp
    if (((a * b) <= (-5d+255)) .or. (.not. ((a * b) <= 5d+103))) then
        tmp = (x * y) + ((a * b) * (-0.25d0))
    else
        tmp = c + ((x * y) + (0.0625d0 * (z * t)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
	double tmp;
	if (((a * b) <= -5e+255) || !((a * b) <= 5e+103)) {
		tmp = (x * y) + ((a * b) * -0.25);
	} else {
		tmp = c + ((x * y) + (0.0625 * (z * t)));
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	tmp = 0
	if ((a * b) <= -5e+255) or not ((a * b) <= 5e+103):
		tmp = (x * y) + ((a * b) * -0.25)
	else:
		tmp = c + ((x * y) + (0.0625 * (z * t)))
	return tmp
function code(x, y, z, t, a, b, c)
	tmp = 0.0
	if ((Float64(a * b) <= -5e+255) || !(Float64(a * b) <= 5e+103))
		tmp = Float64(Float64(x * y) + Float64(Float64(a * b) * -0.25));
	else
		tmp = Float64(c + Float64(Float64(x * y) + Float64(0.0625 * Float64(z * t))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	tmp = 0.0;
	if (((a * b) <= -5e+255) || ~(((a * b) <= 5e+103)))
		tmp = (x * y) + ((a * b) * -0.25);
	else
		tmp = c + ((x * y) + (0.0625 * (z * t)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -5e+255], N[Not[LessEqual[N[(a * b), $MachinePrecision], 5e+103]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(x * y), $MachinePrecision] + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+255} \lor \neg \left(a \cdot b \leq 5 \cdot 10^{+103}\right):\\
\;\;\;\;x \cdot y + \left(a \cdot b\right) \cdot -0.25\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -5.0000000000000002e255 or 5e103 < (*.f64 a b)

    1. Initial program 92.5%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Step-by-step derivation
      1. associate-+l-92.5%

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

        \[\leadsto \color{blue}{\left(\frac{z \cdot t}{16} + x \cdot y\right)} - \left(\frac{a \cdot b}{4} - c\right) \]
      3. *-commutative92.5%

        \[\leadsto \left(\frac{\color{blue}{t \cdot z}}{16} + x \cdot y\right) - \left(\frac{a \cdot b}{4} - c\right) \]
      4. +-commutative92.5%

        \[\leadsto \color{blue}{\left(x \cdot y + \frac{t \cdot z}{16}\right)} - \left(\frac{a \cdot b}{4} - c\right) \]
      5. associate-+l-92.5%

        \[\leadsto \color{blue}{\left(\left(x \cdot y + \frac{t \cdot z}{16}\right) - \frac{a \cdot b}{4}\right) + c} \]
      6. fma-define92.5%

        \[\leadsto \left(\color{blue}{\mathsf{fma}\left(x, y, \frac{t \cdot z}{16}\right)} - \frac{a \cdot b}{4}\right) + c \]
      7. *-commutative92.5%

        \[\leadsto \left(\mathsf{fma}\left(x, y, \frac{\color{blue}{z \cdot t}}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
      8. associate-/l*92.5%

        \[\leadsto \left(\mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}}\right) - \frac{a \cdot b}{4}\right) + c \]
      9. associate-/l*92.5%

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

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x, y, z \cdot \frac{t}{16}\right) - a \cdot \frac{b}{4}\right) + c} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 86.1%

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

      \[\leadsto \color{blue}{x \cdot \left(y + -0.25 \cdot \frac{a \cdot b}{x}\right)} + c \]
    7. Taylor expanded in c around 0 72.0%

      \[\leadsto \color{blue}{x \cdot \left(y + -0.25 \cdot \frac{a \cdot b}{x}\right)} \]
    8. Taylor expanded in x around 0 80.3%

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

    if -5.0000000000000002e255 < (*.f64 a b) < 5e103

    1. Initial program 99.5%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Step-by-step derivation
      1. associate--l+99.5%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \frac{z \cdot t}{16} - \frac{a \cdot b}{4}\right)} + c \]
      3. associate-/l*99.5%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}} - \frac{a \cdot b}{4}\right) + c \]
      4. fmm-def99.5%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\mathsf{fma}\left(z, \frac{t}{16}, -\frac{a \cdot b}{4}\right)}\right) + c \]
      5. distribute-neg-frac299.5%

        \[\leadsto \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{\frac{a \cdot b}{-4}}\right)\right) + c \]
      6. metadata-eval99.5%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \frac{a \cdot b}{-4}\right)\right) + c} \]
    4. Add Preprocessing
    5. Taylor expanded in a around 0 92.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+255} \lor \neg \left(a \cdot b \leq 5 \cdot 10^{+103}\right):\\ \;\;\;\;x \cdot y + \left(a \cdot b\right) \cdot -0.25\\ \mathbf{else}:\\ \;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 66.2% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -500000:\\
\;\;\;\;x \cdot y + \left(a \cdot b\right) \cdot -0.25\\

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

\mathbf{else}:\\
\;\;\;\;x \cdot \left(y + -0.25 \cdot \frac{a \cdot b}{x}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -5e5

    1. Initial program 98.1%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Step-by-step derivation
      1. associate-+l-98.1%

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

        \[\leadsto \color{blue}{\left(\frac{z \cdot t}{16} + x \cdot y\right)} - \left(\frac{a \cdot b}{4} - c\right) \]
      3. *-commutative98.1%

        \[\leadsto \left(\frac{\color{blue}{t \cdot z}}{16} + x \cdot y\right) - \left(\frac{a \cdot b}{4} - c\right) \]
      4. +-commutative98.1%

        \[\leadsto \color{blue}{\left(x \cdot y + \frac{t \cdot z}{16}\right)} - \left(\frac{a \cdot b}{4} - c\right) \]
      5. associate-+l-98.1%

        \[\leadsto \color{blue}{\left(\left(x \cdot y + \frac{t \cdot z}{16}\right) - \frac{a \cdot b}{4}\right) + c} \]
      6. fma-define98.1%

        \[\leadsto \left(\color{blue}{\mathsf{fma}\left(x, y, \frac{t \cdot z}{16}\right)} - \frac{a \cdot b}{4}\right) + c \]
      7. *-commutative98.1%

        \[\leadsto \left(\mathsf{fma}\left(x, y, \frac{\color{blue}{z \cdot t}}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
      8. associate-/l*98.1%

        \[\leadsto \left(\mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}}\right) - \frac{a \cdot b}{4}\right) + c \]
      9. associate-/l*98.1%

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

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x, y, z \cdot \frac{t}{16}\right) - a \cdot \frac{b}{4}\right) + c} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 88.0%

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

      \[\leadsto \color{blue}{x \cdot \left(y + -0.25 \cdot \frac{a \cdot b}{x}\right)} + c \]
    7. Taylor expanded in c around 0 73.1%

      \[\leadsto \color{blue}{x \cdot \left(y + -0.25 \cdot \frac{a \cdot b}{x}\right)} \]
    8. Taylor expanded in x around 0 74.9%

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

    if -5e5 < (*.f64 x y) < 1.00000000000000007e174

    1. Initial program 98.8%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 88.7%

      \[\leadsto \color{blue}{z \cdot \left(\left(0.0625 \cdot t + \frac{x \cdot y}{z}\right) - 0.25 \cdot \frac{a \cdot b}{z}\right)} + c \]
    4. Taylor expanded in t around inf 69.3%

      \[\leadsto z \cdot \color{blue}{\left(0.0625 \cdot t\right)} + c \]

    if 1.00000000000000007e174 < (*.f64 x y)

    1. Initial program 90.9%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Step-by-step derivation
      1. associate-+l-90.9%

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

        \[\leadsto \color{blue}{\left(\frac{z \cdot t}{16} + x \cdot y\right)} - \left(\frac{a \cdot b}{4} - c\right) \]
      3. *-commutative90.9%

        \[\leadsto \left(\frac{\color{blue}{t \cdot z}}{16} + x \cdot y\right) - \left(\frac{a \cdot b}{4} - c\right) \]
      4. +-commutative90.9%

        \[\leadsto \color{blue}{\left(x \cdot y + \frac{t \cdot z}{16}\right)} - \left(\frac{a \cdot b}{4} - c\right) \]
      5. associate-+l-90.9%

        \[\leadsto \color{blue}{\left(\left(x \cdot y + \frac{t \cdot z}{16}\right) - \frac{a \cdot b}{4}\right) + c} \]
      6. fma-define90.9%

        \[\leadsto \left(\color{blue}{\mathsf{fma}\left(x, y, \frac{t \cdot z}{16}\right)} - \frac{a \cdot b}{4}\right) + c \]
      7. *-commutative90.9%

        \[\leadsto \left(\mathsf{fma}\left(x, y, \frac{\color{blue}{z \cdot t}}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
      8. associate-/l*90.9%

        \[\leadsto \left(\mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}}\right) - \frac{a \cdot b}{4}\right) + c \]
      9. associate-/l*90.9%

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

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x, y, z \cdot \frac{t}{16}\right) - a \cdot \frac{b}{4}\right) + c} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 80.1%

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

      \[\leadsto \color{blue}{x \cdot \left(y + -0.25 \cdot \frac{a \cdot b}{x}\right)} + c \]
    7. Taylor expanded in c around 0 86.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -500000:\\ \;\;\;\;x \cdot y + \left(a \cdot b\right) \cdot -0.25\\ \mathbf{elif}\;x \cdot y \leq 10^{+174}:\\ \;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y + -0.25 \cdot \frac{a \cdot b}{x}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 66.0% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -500000 \lor \neg \left(x \cdot y \leq 10^{+174}\right):\\ \;\;\;\;x \cdot y + \left(a \cdot b\right) \cdot -0.25\\ \mathbf{else}:\\ \;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (if (or (<= (* x y) -500000.0) (not (<= (* x y) 1e+174)))
   (+ (* x y) (* (* a b) -0.25))
   (+ c (* z (* t 0.0625)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double tmp;
	if (((x * y) <= -500000.0) || !((x * y) <= 1e+174)) {
		tmp = (x * y) + ((a * b) * -0.25);
	} else {
		tmp = c + (z * (t * 0.0625));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
    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) :: tmp
    if (((x * y) <= (-500000.0d0)) .or. (.not. ((x * y) <= 1d+174))) then
        tmp = (x * y) + ((a * b) * (-0.25d0))
    else
        tmp = c + (z * (t * 0.0625d0))
    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 tmp;
	if (((x * y) <= -500000.0) || !((x * y) <= 1e+174)) {
		tmp = (x * y) + ((a * b) * -0.25);
	} else {
		tmp = c + (z * (t * 0.0625));
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	tmp = 0
	if ((x * y) <= -500000.0) or not ((x * y) <= 1e+174):
		tmp = (x * y) + ((a * b) * -0.25)
	else:
		tmp = c + (z * (t * 0.0625))
	return tmp
function code(x, y, z, t, a, b, c)
	tmp = 0.0
	if ((Float64(x * y) <= -500000.0) || !(Float64(x * y) <= 1e+174))
		tmp = Float64(Float64(x * y) + Float64(Float64(a * b) * -0.25));
	else
		tmp = Float64(c + Float64(z * Float64(t * 0.0625)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	tmp = 0.0;
	if (((x * y) <= -500000.0) || ~(((x * y) <= 1e+174)))
		tmp = (x * y) + ((a * b) * -0.25);
	else
		tmp = c + (z * (t * 0.0625));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -500000.0], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1e+174]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision], N[(c + N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -500000 \lor \neg \left(x \cdot y \leq 10^{+174}\right):\\
\;\;\;\;x \cdot y + \left(a \cdot b\right) \cdot -0.25\\

\mathbf{else}:\\
\;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -5e5 or 1.00000000000000007e174 < (*.f64 x y)

    1. Initial program 95.3%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Step-by-step derivation
      1. associate-+l-95.3%

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

        \[\leadsto \color{blue}{\left(\frac{z \cdot t}{16} + x \cdot y\right)} - \left(\frac{a \cdot b}{4} - c\right) \]
      3. *-commutative95.3%

        \[\leadsto \left(\frac{\color{blue}{t \cdot z}}{16} + x \cdot y\right) - \left(\frac{a \cdot b}{4} - c\right) \]
      4. +-commutative95.3%

        \[\leadsto \color{blue}{\left(x \cdot y + \frac{t \cdot z}{16}\right)} - \left(\frac{a \cdot b}{4} - c\right) \]
      5. associate-+l-95.3%

        \[\leadsto \color{blue}{\left(\left(x \cdot y + \frac{t \cdot z}{16}\right) - \frac{a \cdot b}{4}\right) + c} \]
      6. fma-define95.3%

        \[\leadsto \left(\color{blue}{\mathsf{fma}\left(x, y, \frac{t \cdot z}{16}\right)} - \frac{a \cdot b}{4}\right) + c \]
      7. *-commutative95.3%

        \[\leadsto \left(\mathsf{fma}\left(x, y, \frac{\color{blue}{z \cdot t}}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
      8. associate-/l*95.3%

        \[\leadsto \left(\mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}}\right) - \frac{a \cdot b}{4}\right) + c \]
      9. associate-/l*95.3%

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

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x, y, z \cdot \frac{t}{16}\right) - a \cdot \frac{b}{4}\right) + c} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 85.0%

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

      \[\leadsto \color{blue}{x \cdot \left(y + -0.25 \cdot \frac{a \cdot b}{x}\right)} + c \]
    7. Taylor expanded in c around 0 78.1%

      \[\leadsto \color{blue}{x \cdot \left(y + -0.25 \cdot \frac{a \cdot b}{x}\right)} \]
    8. Taylor expanded in x around 0 76.9%

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

    if -5e5 < (*.f64 x y) < 1.00000000000000007e174

    1. Initial program 98.8%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 88.7%

      \[\leadsto \color{blue}{z \cdot \left(\left(0.0625 \cdot t + \frac{x \cdot y}{z}\right) - 0.25 \cdot \frac{a \cdot b}{z}\right)} + c \]
    4. Taylor expanded in t around inf 69.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -500000 \lor \neg \left(x \cdot y \leq 10^{+174}\right):\\ \;\;\;\;x \cdot y + \left(a \cdot b\right) \cdot -0.25\\ \mathbf{else}:\\ \;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 65.3% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2.6 \cdot 10^{+102} \lor \neg \left(x \cdot y \leq 9.5 \cdot 10^{+173}\right):\\ \;\;\;\;c + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (if (or (<= (* x y) -2.6e+102) (not (<= (* x y) 9.5e+173)))
   (+ c (* x y))
   (+ c (* a (* b -0.25)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double tmp;
	if (((x * y) <= -2.6e+102) || !((x * y) <= 9.5e+173)) {
		tmp = c + (x * y);
	} else {
		tmp = c + (a * (b * -0.25));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
    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) :: tmp
    if (((x * y) <= (-2.6d+102)) .or. (.not. ((x * y) <= 9.5d+173))) then
        tmp = c + (x * y)
    else
        tmp = c + (a * (b * (-0.25d0)))
    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 tmp;
	if (((x * y) <= -2.6e+102) || !((x * y) <= 9.5e+173)) {
		tmp = c + (x * y);
	} else {
		tmp = c + (a * (b * -0.25));
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	tmp = 0
	if ((x * y) <= -2.6e+102) or not ((x * y) <= 9.5e+173):
		tmp = c + (x * y)
	else:
		tmp = c + (a * (b * -0.25))
	return tmp
function code(x, y, z, t, a, b, c)
	tmp = 0.0
	if ((Float64(x * y) <= -2.6e+102) || !(Float64(x * y) <= 9.5e+173))
		tmp = Float64(c + Float64(x * y));
	else
		tmp = Float64(c + Float64(a * Float64(b * -0.25)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	tmp = 0.0;
	if (((x * y) <= -2.6e+102) || ~(((x * y) <= 9.5e+173)))
		tmp = c + (x * y);
	else
		tmp = c + (a * (b * -0.25));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -2.6e+102], N[Not[LessEqual[N[(x * y), $MachinePrecision], 9.5e+173]], $MachinePrecision]], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2.6 \cdot 10^{+102} \lor \neg \left(x \cdot y \leq 9.5 \cdot 10^{+173}\right):\\
\;\;\;\;c + x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -2.60000000000000006e102 or 9.5000000000000005e173 < (*.f64 x y)

    1. Initial program 94.0%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Step-by-step derivation
      1. associate--l+94.0%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \frac{z \cdot t}{16} - \frac{a \cdot b}{4}\right)} + c \]
      3. associate-/l*95.5%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}} - \frac{a \cdot b}{4}\right) + c \]
      4. fmm-def97.0%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\mathsf{fma}\left(z, \frac{t}{16}, -\frac{a \cdot b}{4}\right)}\right) + c \]
      5. distribute-neg-frac297.0%

        \[\leadsto \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{\frac{a \cdot b}{-4}}\right)\right) + c \]
      6. metadata-eval97.0%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \frac{a \cdot b}{-4}\right)\right) + c} \]
    4. Add Preprocessing
    5. Taylor expanded in a around 0 88.1%

      \[\leadsto \color{blue}{c + \left(0.0625 \cdot \left(t \cdot z\right) + x \cdot y\right)} \]
    6. Taylor expanded in t around 0 80.7%

      \[\leadsto c + \color{blue}{x \cdot y} \]

    if -2.60000000000000006e102 < (*.f64 x y) < 9.5000000000000005e173

    1. Initial program 98.9%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Step-by-step derivation
      1. associate--l+98.9%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \frac{z \cdot t}{16} - \frac{a \cdot b}{4}\right)} + c \]
      3. associate-/l*98.9%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}} - \frac{a \cdot b}{4}\right) + c \]
      4. fmm-def99.5%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\mathsf{fma}\left(z, \frac{t}{16}, -\frac{a \cdot b}{4}\right)}\right) + c \]
      5. distribute-neg-frac299.5%

        \[\leadsto \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{\frac{a \cdot b}{-4}}\right)\right) + c \]
      6. metadata-eval99.5%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \frac{a \cdot b}{-4}\right)\right) + c} \]
    4. Add Preprocessing
    5. Taylor expanded in a around inf 60.2%

      \[\leadsto \color{blue}{-0.25 \cdot \left(a \cdot b\right)} + c \]
    6. Step-by-step derivation
      1. *-commutative60.2%

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot -0.25} + c \]
      2. associate-*r*60.2%

        \[\leadsto \color{blue}{a \cdot \left(b \cdot -0.25\right)} + c \]
    7. Simplified60.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2.6 \cdot 10^{+102} \lor \neg \left(x \cdot y \leq 9.5 \cdot 10^{+173}\right):\\ \;\;\;\;c + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 40.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -7.6 \cdot 10^{+183} \lor \neg \left(x \cdot y \leq 2.32 \cdot 10^{+173}\right):\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (if (or (<= (* x y) -7.6e+183) (not (<= (* x y) 2.32e+173))) (* x y) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double tmp;
	if (((x * y) <= -7.6e+183) || !((x * y) <= 2.32e+173)) {
		tmp = x * y;
	} else {
		tmp = c;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
    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) :: tmp
    if (((x * y) <= (-7.6d+183)) .or. (.not. ((x * y) <= 2.32d+173))) then
        tmp = x * y
    else
        tmp = 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 tmp;
	if (((x * y) <= -7.6e+183) || !((x * y) <= 2.32e+173)) {
		tmp = x * y;
	} else {
		tmp = c;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	tmp = 0
	if ((x * y) <= -7.6e+183) or not ((x * y) <= 2.32e+173):
		tmp = x * y
	else:
		tmp = c
	return tmp
function code(x, y, z, t, a, b, c)
	tmp = 0.0
	if ((Float64(x * y) <= -7.6e+183) || !(Float64(x * y) <= 2.32e+173))
		tmp = Float64(x * y);
	else
		tmp = c;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	tmp = 0.0;
	if (((x * y) <= -7.6e+183) || ~(((x * y) <= 2.32e+173)))
		tmp = x * y;
	else
		tmp = c;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -7.6e+183], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2.32e+173]], $MachinePrecision]], N[(x * y), $MachinePrecision], c]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -7.6 \cdot 10^{+183} \lor \neg \left(x \cdot y \leq 2.32 \cdot 10^{+173}\right):\\
\;\;\;\;x \cdot y\\

\mathbf{else}:\\
\;\;\;\;c\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -7.60000000000000002e183 or 2.3199999999999999e173 < (*.f64 x y)

    1. Initial program 93.5%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Step-by-step derivation
      1. associate--l+93.5%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \frac{z \cdot t}{16} - \frac{a \cdot b}{4}\right)} + c \]
      3. associate-/l*95.1%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}} - \frac{a \cdot b}{4}\right) + c \]
      4. fmm-def96.7%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\mathsf{fma}\left(z, \frac{t}{16}, -\frac{a \cdot b}{4}\right)}\right) + c \]
      5. distribute-neg-frac296.7%

        \[\leadsto \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{\frac{a \cdot b}{-4}}\right)\right) + c \]
      6. metadata-eval96.7%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \frac{a \cdot b}{-4}\right)\right) + c} \]
    4. Add Preprocessing
    5. Taylor expanded in a around 0 88.7%

      \[\leadsto \color{blue}{c + \left(0.0625 \cdot \left(t \cdot z\right) + x \cdot y\right)} \]
    6. Taylor expanded in t around 0 80.7%

      \[\leadsto c + \color{blue}{x \cdot y} \]
    7. Taylor expanded in c around 0 79.0%

      \[\leadsto \color{blue}{x \cdot y} \]

    if -7.60000000000000002e183 < (*.f64 x y) < 2.3199999999999999e173

    1. Initial program 99.0%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Step-by-step derivation
      1. associate--l+99.0%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \frac{z \cdot t}{16} - \frac{a \cdot b}{4}\right)} + c \]
      3. associate-/l*99.0%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}} - \frac{a \cdot b}{4}\right) + c \]
      4. fmm-def99.5%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\mathsf{fma}\left(z, \frac{t}{16}, -\frac{a \cdot b}{4}\right)}\right) + c \]
      5. distribute-neg-frac299.5%

        \[\leadsto \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{\frac{a \cdot b}{-4}}\right)\right) + c \]
      6. metadata-eval99.5%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \frac{a \cdot b}{-4}\right)\right) + c} \]
    4. Add Preprocessing
    5. Taylor expanded in c around inf 30.7%

      \[\leadsto \color{blue}{c} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification42.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -7.6 \cdot 10^{+183} \lor \neg \left(x \cdot y \leq 2.32 \cdot 10^{+173}\right):\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 53.1% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -1.8 \cdot 10^{+194} \lor \neg \left(a \leq 8.6 \cdot 10^{-36}\right):\\ \;\;\;\;b \cdot \left(a \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;c + x \cdot y\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (if (or (<= a -1.8e+194) (not (<= a 8.6e-36)))
   (* b (* a -0.25))
   (+ c (* x y))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double tmp;
	if ((a <= -1.8e+194) || !(a <= 8.6e-36)) {
		tmp = b * (a * -0.25);
	} else {
		tmp = c + (x * y);
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
    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) :: tmp
    if ((a <= (-1.8d+194)) .or. (.not. (a <= 8.6d-36))) then
        tmp = b * (a * (-0.25d0))
    else
        tmp = c + (x * y)
    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 tmp;
	if ((a <= -1.8e+194) || !(a <= 8.6e-36)) {
		tmp = b * (a * -0.25);
	} else {
		tmp = c + (x * y);
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	tmp = 0
	if (a <= -1.8e+194) or not (a <= 8.6e-36):
		tmp = b * (a * -0.25)
	else:
		tmp = c + (x * y)
	return tmp
function code(x, y, z, t, a, b, c)
	tmp = 0.0
	if ((a <= -1.8e+194) || !(a <= 8.6e-36))
		tmp = Float64(b * Float64(a * -0.25));
	else
		tmp = Float64(c + Float64(x * y));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	tmp = 0.0;
	if ((a <= -1.8e+194) || ~((a <= 8.6e-36)))
		tmp = b * (a * -0.25);
	else
		tmp = c + (x * y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[a, -1.8e+194], N[Not[LessEqual[a, 8.6e-36]], $MachinePrecision]], N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.8 \cdot 10^{+194} \lor \neg \left(a \leq 8.6 \cdot 10^{-36}\right):\\
\;\;\;\;b \cdot \left(a \cdot -0.25\right)\\

\mathbf{else}:\\
\;\;\;\;c + x \cdot y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.8e194 or 8.6000000000000004e-36 < a

    1. Initial program 93.0%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Step-by-step derivation
      1. associate-+l-93.0%

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

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

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

        \[\leadsto \color{blue}{\left(x \cdot y + \frac{t \cdot z}{16}\right)} - \left(\frac{a \cdot b}{4} - c\right) \]
      5. associate-+l-93.0%

        \[\leadsto \color{blue}{\left(\left(x \cdot y + \frac{t \cdot z}{16}\right) - \frac{a \cdot b}{4}\right) + c} \]
      6. fma-define93.0%

        \[\leadsto \left(\color{blue}{\mathsf{fma}\left(x, y, \frac{t \cdot z}{16}\right)} - \frac{a \cdot b}{4}\right) + c \]
      7. *-commutative93.0%

        \[\leadsto \left(\mathsf{fma}\left(x, y, \frac{\color{blue}{z \cdot t}}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
      8. associate-/l*93.0%

        \[\leadsto \left(\mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}}\right) - \frac{a \cdot b}{4}\right) + c \]
      9. associate-/l*93.0%

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

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x, y, z \cdot \frac{t}{16}\right) - a \cdot \frac{b}{4}\right) + c} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 74.6%

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

      \[\leadsto \color{blue}{x \cdot \left(y + -0.25 \cdot \frac{a \cdot b}{x}\right)} + c \]
    7. Taylor expanded in c around 0 57.4%

      \[\leadsto \color{blue}{x \cdot \left(y + -0.25 \cdot \frac{a \cdot b}{x}\right)} \]
    8. Taylor expanded in x around 0 46.6%

      \[\leadsto \color{blue}{-0.25 \cdot \left(a \cdot b\right)} \]
    9. Step-by-step derivation
      1. *-commutative46.6%

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot -0.25} \]
      2. *-commutative46.6%

        \[\leadsto \color{blue}{\left(b \cdot a\right)} \cdot -0.25 \]
      3. associate-*r*46.6%

        \[\leadsto \color{blue}{b \cdot \left(a \cdot -0.25\right)} \]
      4. *-commutative46.6%

        \[\leadsto b \cdot \color{blue}{\left(-0.25 \cdot a\right)} \]
    10. Simplified46.6%

      \[\leadsto \color{blue}{b \cdot \left(-0.25 \cdot a\right)} \]

    if -1.8e194 < a < 8.6000000000000004e-36

    1. Initial program 100.0%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Step-by-step derivation
      1. associate--l+100.0%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \frac{z \cdot t}{16} - \frac{a \cdot b}{4}\right)} + c \]
      3. associate-/l*100.0%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}} - \frac{a \cdot b}{4}\right) + c \]
      4. fmm-def100.0%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\mathsf{fma}\left(z, \frac{t}{16}, -\frac{a \cdot b}{4}\right)}\right) + c \]
      5. distribute-neg-frac2100.0%

        \[\leadsto \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{\frac{a \cdot b}{-4}}\right)\right) + c \]
      6. metadata-eval100.0%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \frac{a \cdot b}{-4}\right)\right) + c} \]
    4. Add Preprocessing
    5. Taylor expanded in a around 0 84.8%

      \[\leadsto \color{blue}{c + \left(0.0625 \cdot \left(t \cdot z\right) + x \cdot y\right)} \]
    6. Taylor expanded in t around 0 53.7%

      \[\leadsto c + \color{blue}{x \cdot y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification51.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.8 \cdot 10^{+194} \lor \neg \left(a \leq 8.6 \cdot 10^{-36}\right):\\ \;\;\;\;b \cdot \left(a \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;c + x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 21.6% accurate, 17.0× speedup?

\[\begin{array}{l} \\ c \end{array} \]
(FPCore (x y z t a b c) :precision binary64 c)
double code(double x, double y, double z, double t, double a, double b, double c) {
	return c;
}
real(8) function code(x, y, z, t, a, b, c)
    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
    code = c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
	return c;
}
def code(x, y, z, t, a, b, c):
	return c
function code(x, y, z, t, a, b, c)
	return c
end
function tmp = code(x, y, z, t, a, b, c)
	tmp = c;
end
code[x_, y_, z_, t_, a_, b_, c_] := c
\begin{array}{l}

\\
c
\end{array}
Derivation
  1. Initial program 97.6%

    \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
  2. Step-by-step derivation
    1. associate--l+97.6%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \frac{z \cdot t}{16} - \frac{a \cdot b}{4}\right)} + c \]
    3. associate-/l*98.0%

      \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}} - \frac{a \cdot b}{4}\right) + c \]
    4. fmm-def98.8%

      \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\mathsf{fma}\left(z, \frac{t}{16}, -\frac{a \cdot b}{4}\right)}\right) + c \]
    5. distribute-neg-frac298.8%

      \[\leadsto \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{\frac{a \cdot b}{-4}}\right)\right) + c \]
    6. metadata-eval98.8%

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \frac{a \cdot b}{-4}\right)\right) + c} \]
  4. Add Preprocessing
  5. Taylor expanded in c around inf 24.0%

    \[\leadsto \color{blue}{c} \]
  6. Add Preprocessing

Reproduce

?
herbie shell --seed 2024170 
(FPCore (x y z t a b c)
  :name "Diagrams.Solve.Polynomial:quartForm  from diagrams-solve-0.1, C"
  :precision binary64
  (+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))