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

Percentage Accurate: 97.7% → 99.0%
Time: 7.1s
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.7% 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: 99.0% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(x, y, \mathsf{fma}\left(\frac{z}{16}, t, \color{blue}{\frac{-a}{\frac{4}{b}}} + c\right)\right) \]
    11. associate-/r/99.6%

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

      \[\leadsto \mathsf{fma}\left(x, y, \mathsf{fma}\left(\frac{z}{16}, t, \color{blue}{\mathsf{fma}\left(\frac{-a}{4}, b, c\right)}\right)\right) \]
    13. neg-mul-199.6%

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

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

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

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

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

    \[\leadsto \mathsf{fma}\left(x, y, \mathsf{fma}\left(\frac{z}{16}, t, \mathsf{fma}\left(\frac{a}{-4}, b, c\right)\right)\right) \]

Alternative 2: 98.1% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{fma}\left(x, y, \frac{t}{\frac{16}{z}}\right) + \left(c - \frac{a}{\frac{4}{b}}\right) \]

Alternative 3: 98.5% 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}:\\ \;\;\;\;\left(c + \left(z \cdot t\right) \cdot 0.0625\right) - \left(a \cdot b\right) \cdot 0.25\\ \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)
     (- (+ c (* (* z t) 0.0625)) (* (* a b) 0.25)))))
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 = (c + ((z * t) * 0.0625)) - ((a * b) * 0.25);
	}
	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 = (c + ((z * t) * 0.0625)) - ((a * b) * 0.25);
	}
	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 = (c + ((z * t) * 0.0625)) - ((a * b) * 0.25)
	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(Float64(c + Float64(Float64(z * t) * 0.0625)) - Float64(Float64(a * b) * 0.25));
	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 = (c + ((z * t) * 0.0625)) - ((a * b) * 0.25);
	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[(N[(c + N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $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}:\\
\;\;\;\;\left(c + \left(z \cdot t\right) \cdot 0.0625\right) - \left(a \cdot b\right) \cdot 0.25\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) 16)) (/.f64 (*.f64 a b) 4)) < +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 \]

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

    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. fma-def50.0%

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

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

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

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

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

      \[\leadsto \color{blue}{\left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - 0.25 \cdot \left(a \cdot b\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}:\\ \;\;\;\;\left(c + \left(z \cdot t\right) \cdot 0.0625\right) - \left(a \cdot b\right) \cdot 0.25\\ \end{array} \]

Alternative 4: 64.6% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_1 := c + \left(z \cdot t\right) \cdot 0.0625\\
t_2 := c + a \cdot \left(b \cdot -0.25\right)\\
t_3 := c + x \cdot y\\
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+78}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;a \cdot b \leq -4 \cdot 10^{-79}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;a \cdot b \leq -2 \cdot 10^{-201}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;a \cdot b \leq 10^{-192}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{-123}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;a \cdot b \leq 10:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -2.00000000000000002e78 or 10 < (*.f64 a b)

    1. Initial program 97.0%

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

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

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

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

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

    if -2.00000000000000002e78 < (*.f64 a b) < -4e-79 or -1.99999999999999989e-201 < (*.f64 a b) < 1.0000000000000001e-192 or 2.0000000000000001e-123 < (*.f64 a b) < 10

    1. Initial program 97.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-97.5%

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

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

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

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

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

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

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

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

    if -4e-79 < (*.f64 a b) < -1.99999999999999989e-201 or 1.0000000000000001e-192 < (*.f64 a b) < 2.0000000000000001e-123

    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. fma-def100.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+78}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;a \cdot b \leq -4 \cdot 10^{-79}:\\ \;\;\;\;c + \left(z \cdot t\right) \cdot 0.0625\\ \mathbf{elif}\;a \cdot b \leq -2 \cdot 10^{-201}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 10^{-192}:\\ \;\;\;\;c + \left(z \cdot t\right) \cdot 0.0625\\ \mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{-123}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 10:\\ \;\;\;\;c + \left(z \cdot t\right) \cdot 0.0625\\ \mathbf{else}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \end{array} \]

Alternative 5: 89.3% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := \left(z \cdot t\right) \cdot 0.0625\\
t_2 := \left(a \cdot b\right) \cdot 0.25\\
t_3 := \left(c + x \cdot y\right) - t_2\\
t_4 := c + \left(x \cdot y + t_1\right)\\
\mathbf{if}\;x \cdot y \leq -3.4 \cdot 10^{+128}:\\
\;\;\;\;t_4\\

\mathbf{elif}\;x \cdot y \leq -4.5 \cdot 10^{+66}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;x \cdot y \leq -0.0053:\\
\;\;\;\;t_4\\

\mathbf{elif}\;x \cdot y \leq 1.65 \cdot 10^{+75}:\\
\;\;\;\;\left(c + t_1\right) - t_2\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -3.3999999999999999e128 or -4.4999999999999998e66 < (*.f64 x y) < -0.00530000000000000002

    1. Initial program 95.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-95.9%

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

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

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

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

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

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

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

    if -3.3999999999999999e128 < (*.f64 x y) < -4.4999999999999998e66 or 1.64999999999999999e75 < (*.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. fma-def98.4%

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

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

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

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

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

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

    if -0.00530000000000000002 < (*.f64 x y) < 1.64999999999999999e75

    1. Initial program 99.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-99.3%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -3.4 \cdot 10^{+128}:\\ \;\;\;\;c + \left(x \cdot y + \left(z \cdot t\right) \cdot 0.0625\right)\\ \mathbf{elif}\;x \cdot y \leq -4.5 \cdot 10^{+66}:\\ \;\;\;\;\left(c + x \cdot y\right) - \left(a \cdot b\right) \cdot 0.25\\ \mathbf{elif}\;x \cdot y \leq -0.0053:\\ \;\;\;\;c + \left(x \cdot y + \left(z \cdot t\right) \cdot 0.0625\right)\\ \mathbf{elif}\;x \cdot y \leq 1.65 \cdot 10^{+75}:\\ \;\;\;\;\left(c + \left(z \cdot t\right) \cdot 0.0625\right) - \left(a \cdot b\right) \cdot 0.25\\ \mathbf{else}:\\ \;\;\;\;\left(c + x \cdot y\right) - \left(a \cdot b\right) \cdot 0.25\\ \end{array} \]

Alternative 6: 64.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -9.5 \cdot 10^{+205} \lor \neg \left(x \cdot y \leq -2.7 \cdot 10^{+130} \lor \neg \left(x \cdot y \leq -6.4 \cdot 10^{+36}\right) \land x \cdot y \leq 8.5 \cdot 10^{+69}\right):\\ \;\;\;\;c + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c + \left(z \cdot t\right) \cdot 0.0625\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (if (or (<= (* x y) -9.5e+205)
         (not
          (or (<= (* x y) -2.7e+130)
              (and (not (<= (* x y) -6.4e+36)) (<= (* x y) 8.5e+69)))))
   (+ c (* x y))
   (+ 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) <= -9.5e+205) || !(((x * y) <= -2.7e+130) || (!((x * y) <= -6.4e+36) && ((x * y) <= 8.5e+69)))) {
		tmp = c + (x * y);
	} 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) <= (-9.5d+205)) .or. (.not. ((x * y) <= (-2.7d+130)) .or. (.not. ((x * y) <= (-6.4d+36))) .and. ((x * y) <= 8.5d+69))) then
        tmp = c + (x * y)
    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) <= -9.5e+205) || !(((x * y) <= -2.7e+130) || (!((x * y) <= -6.4e+36) && ((x * y) <= 8.5e+69)))) {
		tmp = c + (x * y);
	} else {
		tmp = c + ((z * t) * 0.0625);
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	tmp = 0
	if ((x * y) <= -9.5e+205) or not (((x * y) <= -2.7e+130) or (not ((x * y) <= -6.4e+36) and ((x * y) <= 8.5e+69))):
		tmp = c + (x * y)
	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) <= -9.5e+205) || !((Float64(x * y) <= -2.7e+130) || (!(Float64(x * y) <= -6.4e+36) && (Float64(x * y) <= 8.5e+69))))
		tmp = Float64(c + Float64(x * y));
	else
		tmp = Float64(c + Float64(Float64(z * t) * 0.0625));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	tmp = 0.0;
	if (((x * y) <= -9.5e+205) || ~((((x * y) <= -2.7e+130) || (~(((x * y) <= -6.4e+36)) && ((x * y) <= 8.5e+69)))))
		tmp = c + (x * y);
	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], -9.5e+205], N[Not[Or[LessEqual[N[(x * y), $MachinePrecision], -2.7e+130], And[N[Not[LessEqual[N[(x * y), $MachinePrecision], -6.4e+36]], $MachinePrecision], LessEqual[N[(x * y), $MachinePrecision], 8.5e+69]]]], $MachinePrecision]], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -9.5 \cdot 10^{+205} \lor \neg \left(x \cdot y \leq -2.7 \cdot 10^{+130} \lor \neg \left(x \cdot y \leq -6.4 \cdot 10^{+36}\right) \land x \cdot y \leq 8.5 \cdot 10^{+69}\right):\\
\;\;\;\;c + x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -9.4999999999999997e205 or -2.6999999999999998e130 < (*.f64 x y) < -6.3999999999999998e36 or 8.5000000000000002e69 < (*.f64 x y)

    1. Initial program 94.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-94.8%

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

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

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

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

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

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

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

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

    if -9.4999999999999997e205 < (*.f64 x y) < -2.6999999999999998e130 or -6.3999999999999998e36 < (*.f64 x y) < 8.5000000000000002e69

    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 + \frac{z \cdot t}{16}\right) - \left(\frac{a \cdot b}{4} - c\right)} \]
      2. fma-def99.4%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -9.5 \cdot 10^{+205} \lor \neg \left(x \cdot y \leq -2.7 \cdot 10^{+130} \lor \neg \left(x \cdot y \leq -6.4 \cdot 10^{+36}\right) \land x \cdot y \leq 8.5 \cdot 10^{+69}\right):\\ \;\;\;\;c + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c + \left(z \cdot t\right) \cdot 0.0625\\ \end{array} \]

Alternative 7: 88.6% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -1.00000000000000002e100 or 10 < (*.f64 a b)

    1. Initial program 97.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-97.0%

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

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

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

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

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

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

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

    if -1.00000000000000002e100 < (*.f64 a b) < 10

    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. fma-def100.0%

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

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

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

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

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

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

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

Alternative 8: 86.3% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+100}:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\

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

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


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

    1. Initial program 96.2%

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

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

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

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

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

    if -1.00000000000000002e100 < (*.f64 a b) < 1.00000000000000003e139

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

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

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

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

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

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

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

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

    if 1.00000000000000003e139 < (*.f64 a b)

    1. Initial program 94.7%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+100}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;a \cdot b \leq 10^{+139}:\\ \;\;\;\;c + \left(x \cdot y + \left(z \cdot t\right) \cdot 0.0625\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y - \left(a \cdot b\right) \cdot 0.25\\ \end{array} \]

Alternative 9: 60.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot y - \left(a \cdot b\right) \cdot 0.25\\
t_2 := c + \left(z \cdot t\right) \cdot 0.0625\\
\mathbf{if}\;t \leq -3.7 \cdot 10^{-97}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;t \leq 3.7 \cdot 10^{-237}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 2.7 \cdot 10^{-139}:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\

\mathbf{elif}\;t \leq 1.536 \cdot 10^{+84}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -3.69999999999999976e-97 or 1.53599999999999999e84 < t

    1. Initial program 96.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-96.3%

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

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

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

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

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

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

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

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

    if -3.69999999999999976e-97 < t < 3.7000000000000001e-237 or 2.6999999999999998e-139 < t < 1.53599999999999999e84

    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 + \frac{z \cdot t}{16}\right) - \left(\frac{a \cdot b}{4} - c\right)} \]
      2. fma-def99.0%

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

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

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

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

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

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

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

    if 3.7000000000000001e-237 < t < 2.6999999999999998e-139

    1. Initial program 100.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.7 \cdot 10^{-97}:\\ \;\;\;\;c + \left(z \cdot t\right) \cdot 0.0625\\ \mathbf{elif}\;t \leq 3.7 \cdot 10^{-237}:\\ \;\;\;\;x \cdot y - \left(a \cdot b\right) \cdot 0.25\\ \mathbf{elif}\;t \leq 2.7 \cdot 10^{-139}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;t \leq 1.536 \cdot 10^{+84}:\\ \;\;\;\;x \cdot y - \left(a \cdot b\right) \cdot 0.25\\ \mathbf{else}:\\ \;\;\;\;c + \left(z \cdot t\right) \cdot 0.0625\\ \end{array} \]

Alternative 10: 36.7% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \leq -1 \cdot 10^{+118}:\\
\;\;\;\;c\\

\mathbf{elif}\;c \leq -1.4 \cdot 10^{+37}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;c \leq -11500000000:\\
\;\;\;\;c\\

\mathbf{elif}\;c \leq 1.85 \cdot 10^{-223}:\\
\;\;\;\;\left(a \cdot b\right) \cdot -0.25\\

\mathbf{elif}\;c \leq 1.15 \cdot 10^{+47}:\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -9.99999999999999967e117 or -1.3999999999999999e37 < c < -1.15e10 or 1.1499999999999999e47 < c

    1. Initial program 95.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-95.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{c} \]

    if -9.99999999999999967e117 < c < -1.3999999999999999e37 or 1.8499999999999999e-223 < c < 1.1499999999999999e47

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - 0.25 \cdot \left(a \cdot b\right)} \]
    5. Taylor expanded in x around inf 50.6%

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

    if -1.15e10 < c < 1.8499999999999999e-223

    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 + \frac{z \cdot t}{16}\right) - \left(\frac{a \cdot b}{4} - c\right)} \]
      2. fma-def98.9%

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

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

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

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

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

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - 0.25 \cdot \left(a \cdot b\right)} \]
    5. Taylor expanded in a around inf 43.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -1 \cdot 10^{+118}:\\ \;\;\;\;c\\ \mathbf{elif}\;c \leq -1.4 \cdot 10^{+37}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \leq -11500000000:\\ \;\;\;\;c\\ \mathbf{elif}\;c \leq 1.85 \cdot 10^{-223}:\\ \;\;\;\;\left(a \cdot b\right) \cdot -0.25\\ \mathbf{elif}\;c \leq 1.15 \cdot 10^{+47}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c\\ \end{array} \]

Alternative 11: 62.8% accurate, 1.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -1.80000000000000005e169 or 9.0000000000000003e141 < (*.f64 a b)

    1. Initial program 94.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-94.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - 0.25 \cdot \left(a \cdot b\right)} \]
    5. Taylor expanded in a around inf 81.5%

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

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot -0.25} \]
    7. Simplified81.5%

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

    if -1.80000000000000005e169 < (*.f64 a b) < 9.0000000000000003e141

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.8 \cdot 10^{+169} \lor \neg \left(a \cdot b \leq 9 \cdot 10^{+141}\right):\\ \;\;\;\;\left(a \cdot b\right) \cdot -0.25\\ \mathbf{else}:\\ \;\;\;\;c + x \cdot y\\ \end{array} \]

Alternative 12: 37.5% accurate, 2.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -3.1 \cdot 10^{+114}:\\ \;\;\;\;c\\ \mathbf{elif}\;c \leq 1.45 \cdot 10^{+44}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (if (<= c -3.1e+114) c (if (<= c 1.45e+44) (* x y) c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double tmp;
	if (c <= -3.1e+114) {
		tmp = c;
	} else if (c <= 1.45e+44) {
		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 (c <= (-3.1d+114)) then
        tmp = c
    else if (c <= 1.45d+44) 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 (c <= -3.1e+114) {
		tmp = c;
	} else if (c <= 1.45e+44) {
		tmp = x * y;
	} else {
		tmp = c;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	tmp = 0
	if c <= -3.1e+114:
		tmp = c
	elif c <= 1.45e+44:
		tmp = x * y
	else:
		tmp = c
	return tmp
function code(x, y, z, t, a, b, c)
	tmp = 0.0
	if (c <= -3.1e+114)
		tmp = c;
	elseif (c <= 1.45e+44)
		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 (c <= -3.1e+114)
		tmp = c;
	elseif (c <= 1.45e+44)
		tmp = x * y;
	else
		tmp = c;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[c, -3.1e+114], c, If[LessEqual[c, 1.45e+44], N[(x * y), $MachinePrecision], c]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;c \leq -3.1 \cdot 10^{+114}:\\
\;\;\;\;c\\

\mathbf{elif}\;c \leq 1.45 \cdot 10^{+44}:\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -3.1e114 or 1.4500000000000001e44 < c

    1. Initial program 96.7%

      \[\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-96.7%

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

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

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

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

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

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

      \[\leadsto \color{blue}{c} \]

    if -3.1e114 < c < 1.4500000000000001e44

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - 0.25 \cdot \left(a \cdot b\right)} \]
    5. Taylor expanded in x around inf 33.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -3.1 \cdot 10^{+114}:\\ \;\;\;\;c\\ \mathbf{elif}\;c \leq 1.45 \cdot 10^{+44}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c\\ \end{array} \]

Alternative 13: 22.4% 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.7%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{c} \]
  5. Final simplification23.5%

    \[\leadsto c \]

Reproduce

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