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

Percentage Accurate: 97.8% → 98.9%
Time: 10.7s
Alternatives: 12
Speedup: 1.0×

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 12 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.8% 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.9% 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-def98.5%

      \[\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/98.8%

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

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

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

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

      \[\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*98.8%

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

      \[\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/98.8%

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

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

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

      \[\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*98.8%

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

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

    \[\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. Add Preprocessing
  5. Final simplification98.8%

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

Alternative 2: 98.3% accurate, 0.1× speedup?

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

\\
\mathsf{fma}\left(x, y, \frac{z}{16} \cdot t\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. sub-neg97.7%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 64.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := c + 0.0625 \cdot \left(z \cdot t\right)\\ t_2 := c + a \cdot \left(b \cdot -0.25\right)\\ t_3 := c + x \cdot y\\ \mathbf{if}\;x \cdot y \leq -8.4 \cdot 10^{+173}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;x \cdot y \leq -1.08 \cdot 10^{-60}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq -4 \cdot 10^{-321}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \cdot y \leq 3.1 \cdot 10^{-49}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 6.2 \cdot 10^{+20}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \cdot y \leq 2.6 \cdot 10^{+90}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (+ c (* 0.0625 (* z t))))
        (t_2 (+ c (* a (* b -0.25))))
        (t_3 (+ c (* x y))))
   (if (<= (* x y) -8.4e+173)
     t_3
     (if (<= (* x y) -1.08e-60)
       t_1
       (if (<= (* x y) -4e-321)
         t_2
         (if (<= (* x y) 3.1e-49)
           t_1
           (if (<= (* x y) 6.2e+20)
             t_2
             (if (<= (* x y) 2.6e+90) t_1 t_3))))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = c + (0.0625 * (z * t));
	double t_2 = c + (a * (b * -0.25));
	double t_3 = c + (x * y);
	double tmp;
	if ((x * y) <= -8.4e+173) {
		tmp = t_3;
	} else if ((x * y) <= -1.08e-60) {
		tmp = t_1;
	} else if ((x * y) <= -4e-321) {
		tmp = t_2;
	} else if ((x * y) <= 3.1e-49) {
		tmp = t_1;
	} else if ((x * y) <= 6.2e+20) {
		tmp = t_2;
	} else if ((x * y) <= 2.6e+90) {
		tmp = t_1;
	} 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) :: tmp
    t_1 = c + (0.0625d0 * (z * t))
    t_2 = c + (a * (b * (-0.25d0)))
    t_3 = c + (x * y)
    if ((x * y) <= (-8.4d+173)) then
        tmp = t_3
    else if ((x * y) <= (-1.08d-60)) then
        tmp = t_1
    else if ((x * y) <= (-4d-321)) then
        tmp = t_2
    else if ((x * y) <= 3.1d-49) then
        tmp = t_1
    else if ((x * y) <= 6.2d+20) then
        tmp = t_2
    else if ((x * y) <= 2.6d+90) then
        tmp = t_1
    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 = c + (0.0625 * (z * t));
	double t_2 = c + (a * (b * -0.25));
	double t_3 = c + (x * y);
	double tmp;
	if ((x * y) <= -8.4e+173) {
		tmp = t_3;
	} else if ((x * y) <= -1.08e-60) {
		tmp = t_1;
	} else if ((x * y) <= -4e-321) {
		tmp = t_2;
	} else if ((x * y) <= 3.1e-49) {
		tmp = t_1;
	} else if ((x * y) <= 6.2e+20) {
		tmp = t_2;
	} else if ((x * y) <= 2.6e+90) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = c + (0.0625 * (z * t))
	t_2 = c + (a * (b * -0.25))
	t_3 = c + (x * y)
	tmp = 0
	if (x * y) <= -8.4e+173:
		tmp = t_3
	elif (x * y) <= -1.08e-60:
		tmp = t_1
	elif (x * y) <= -4e-321:
		tmp = t_2
	elif (x * y) <= 3.1e-49:
		tmp = t_1
	elif (x * y) <= 6.2e+20:
		tmp = t_2
	elif (x * y) <= 2.6e+90:
		tmp = t_1
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t, a, b, c)
	t_1 = Float64(c + Float64(0.0625 * Float64(z * t)))
	t_2 = Float64(c + Float64(a * Float64(b * -0.25)))
	t_3 = Float64(c + Float64(x * y))
	tmp = 0.0
	if (Float64(x * y) <= -8.4e+173)
		tmp = t_3;
	elseif (Float64(x * y) <= -1.08e-60)
		tmp = t_1;
	elseif (Float64(x * y) <= -4e-321)
		tmp = t_2;
	elseif (Float64(x * y) <= 3.1e-49)
		tmp = t_1;
	elseif (Float64(x * y) <= 6.2e+20)
		tmp = t_2;
	elseif (Float64(x * y) <= 2.6e+90)
		tmp = t_1;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	t_1 = c + (0.0625 * (z * t));
	t_2 = c + (a * (b * -0.25));
	t_3 = c + (x * y);
	tmp = 0.0;
	if ((x * y) <= -8.4e+173)
		tmp = t_3;
	elseif ((x * y) <= -1.08e-60)
		tmp = t_1;
	elseif ((x * y) <= -4e-321)
		tmp = t_2;
	elseif ((x * y) <= 3.1e-49)
		tmp = t_1;
	elseif ((x * y) <= 6.2e+20)
		tmp = t_2;
	elseif ((x * y) <= 2.6e+90)
		tmp = t_1;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(c + N[(0.0625 * N[(z * t), $MachinePrecision]), $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[(x * y), $MachinePrecision], -8.4e+173], t$95$3, If[LessEqual[N[(x * y), $MachinePrecision], -1.08e-60], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -4e-321], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 3.1e-49], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 6.2e+20], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 2.6e+90], t$95$1, t$95$3]]]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;x \cdot y \leq -4 \cdot 10^{-321}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;x \cdot y \leq 6.2 \cdot 10^{+20}:\\
\;\;\;\;t\_2\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -8.40000000000000001e173 or 2.5999999999999998e90 < (*.f64 x y)

    1. Initial program 96.3%

      \[\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 inf 79.6%

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

    if -8.40000000000000001e173 < (*.f64 x y) < -1.07999999999999997e-60 or -4.00193e-321 < (*.f64 x y) < 3.1e-49 or 6.2e20 < (*.f64 x y) < 2.5999999999999998e90

    1. Initial program 99.2%

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

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

    if -1.07999999999999997e-60 < (*.f64 x y) < -4.00193e-321 or 3.1e-49 < (*.f64 x y) < 6.2e20

    1. Initial program 96.4%

      \[\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 a around inf 76.4%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -8.4 \cdot 10^{+173}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -1.08 \cdot 10^{-60}:\\ \;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq -4 \cdot 10^{-321}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 3.1 \cdot 10^{-49}:\\ \;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq 6.2 \cdot 10^{+20}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 2.6 \cdot 10^{+90}:\\ \;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;c + x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 64.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := c + 0.0625 \cdot \left(z \cdot t\right)\\ t_2 := c + a \cdot \left(b \cdot -0.25\right)\\ t_3 := c + x \cdot y\\ \mathbf{if}\;x \cdot y \leq -8.5 \cdot 10^{+173}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;x \cdot y \leq -1.15 \cdot 10^{-125}:\\ \;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{elif}\;x \cdot y \leq -4 \cdot 10^{-321}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \cdot y \leq 3.4 \cdot 10^{-47}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 1.05 \cdot 10^{+22}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \cdot y \leq 3.8 \cdot 10^{+87}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (+ c (* 0.0625 (* z t))))
        (t_2 (+ c (* a (* b -0.25))))
        (t_3 (+ c (* x y))))
   (if (<= (* x y) -8.5e+173)
     t_3
     (if (<= (* x y) -1.15e-125)
       (+ c (* z (* t 0.0625)))
       (if (<= (* x y) -4e-321)
         t_2
         (if (<= (* x y) 3.4e-47)
           t_1
           (if (<= (* x y) 1.05e+22)
             t_2
             (if (<= (* x y) 3.8e+87) t_1 t_3))))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = c + (0.0625 * (z * t));
	double t_2 = c + (a * (b * -0.25));
	double t_3 = c + (x * y);
	double tmp;
	if ((x * y) <= -8.5e+173) {
		tmp = t_3;
	} else if ((x * y) <= -1.15e-125) {
		tmp = c + (z * (t * 0.0625));
	} else if ((x * y) <= -4e-321) {
		tmp = t_2;
	} else if ((x * y) <= 3.4e-47) {
		tmp = t_1;
	} else if ((x * y) <= 1.05e+22) {
		tmp = t_2;
	} else if ((x * y) <= 3.8e+87) {
		tmp = t_1;
	} 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) :: tmp
    t_1 = c + (0.0625d0 * (z * t))
    t_2 = c + (a * (b * (-0.25d0)))
    t_3 = c + (x * y)
    if ((x * y) <= (-8.5d+173)) then
        tmp = t_3
    else if ((x * y) <= (-1.15d-125)) then
        tmp = c + (z * (t * 0.0625d0))
    else if ((x * y) <= (-4d-321)) then
        tmp = t_2
    else if ((x * y) <= 3.4d-47) then
        tmp = t_1
    else if ((x * y) <= 1.05d+22) then
        tmp = t_2
    else if ((x * y) <= 3.8d+87) then
        tmp = t_1
    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 = c + (0.0625 * (z * t));
	double t_2 = c + (a * (b * -0.25));
	double t_3 = c + (x * y);
	double tmp;
	if ((x * y) <= -8.5e+173) {
		tmp = t_3;
	} else if ((x * y) <= -1.15e-125) {
		tmp = c + (z * (t * 0.0625));
	} else if ((x * y) <= -4e-321) {
		tmp = t_2;
	} else if ((x * y) <= 3.4e-47) {
		tmp = t_1;
	} else if ((x * y) <= 1.05e+22) {
		tmp = t_2;
	} else if ((x * y) <= 3.8e+87) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = c + (0.0625 * (z * t))
	t_2 = c + (a * (b * -0.25))
	t_3 = c + (x * y)
	tmp = 0
	if (x * y) <= -8.5e+173:
		tmp = t_3
	elif (x * y) <= -1.15e-125:
		tmp = c + (z * (t * 0.0625))
	elif (x * y) <= -4e-321:
		tmp = t_2
	elif (x * y) <= 3.4e-47:
		tmp = t_1
	elif (x * y) <= 1.05e+22:
		tmp = t_2
	elif (x * y) <= 3.8e+87:
		tmp = t_1
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t, a, b, c)
	t_1 = Float64(c + Float64(0.0625 * Float64(z * t)))
	t_2 = Float64(c + Float64(a * Float64(b * -0.25)))
	t_3 = Float64(c + Float64(x * y))
	tmp = 0.0
	if (Float64(x * y) <= -8.5e+173)
		tmp = t_3;
	elseif (Float64(x * y) <= -1.15e-125)
		tmp = Float64(c + Float64(z * Float64(t * 0.0625)));
	elseif (Float64(x * y) <= -4e-321)
		tmp = t_2;
	elseif (Float64(x * y) <= 3.4e-47)
		tmp = t_1;
	elseif (Float64(x * y) <= 1.05e+22)
		tmp = t_2;
	elseif (Float64(x * y) <= 3.8e+87)
		tmp = t_1;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	t_1 = c + (0.0625 * (z * t));
	t_2 = c + (a * (b * -0.25));
	t_3 = c + (x * y);
	tmp = 0.0;
	if ((x * y) <= -8.5e+173)
		tmp = t_3;
	elseif ((x * y) <= -1.15e-125)
		tmp = c + (z * (t * 0.0625));
	elseif ((x * y) <= -4e-321)
		tmp = t_2;
	elseif ((x * y) <= 3.4e-47)
		tmp = t_1;
	elseif ((x * y) <= 1.05e+22)
		tmp = t_2;
	elseif ((x * y) <= 3.8e+87)
		tmp = t_1;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(c + N[(0.0625 * N[(z * t), $MachinePrecision]), $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[(x * y), $MachinePrecision], -8.5e+173], t$95$3, If[LessEqual[N[(x * y), $MachinePrecision], -1.15e-125], N[(c + N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -4e-321], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 3.4e-47], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1.05e+22], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 3.8e+87], t$95$1, t$95$3]]]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;x \cdot y \leq -4 \cdot 10^{-321}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;x \cdot y \leq 1.05 \cdot 10^{+22}:\\
\;\;\;\;t\_2\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 x y) < -8.5000000000000003e173 or 3.80000000000000011e87 < (*.f64 x y)

    1. Initial program 96.3%

      \[\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 inf 79.6%

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

    if -8.5000000000000003e173 < (*.f64 x y) < -1.15e-125

    1. Initial program 98.5%

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

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

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

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

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

      \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right)} + c \]
    6. Step-by-step derivation
      1. associate-*r*65.9%

        \[\leadsto \color{blue}{\left(0.0625 \cdot t\right) \cdot z} + c \]
      2. *-commutative65.9%

        \[\leadsto \color{blue}{z \cdot \left(0.0625 \cdot t\right)} + c \]
    7. Simplified65.9%

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

    if -1.15e-125 < (*.f64 x y) < -4.00193e-321 or 3.4000000000000002e-47 < (*.f64 x y) < 1.0499999999999999e22

    1. Initial program 97.2%

      \[\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 a around inf 82.4%

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

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

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

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

    if -4.00193e-321 < (*.f64 x y) < 3.4000000000000002e-47 or 1.0499999999999999e22 < (*.f64 x y) < 3.80000000000000011e87

    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 68.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -8.5 \cdot 10^{+173}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -1.15 \cdot 10^{-125}:\\ \;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{elif}\;x \cdot y \leq -4 \cdot 10^{-321}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 3.4 \cdot 10^{-47}:\\ \;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq 1.05 \cdot 10^{+22}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 3.8 \cdot 10^{+87}:\\ \;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;c + x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 60.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot y - \left(a \cdot b\right) \cdot 0.25\\ t_2 := c + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{if}\;z \leq -7 \cdot 10^{+50}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \leq -5.3 \cdot 10^{-146}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -3 \cdot 10^{-175}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \leq 8.8 \cdot 10^{-95}:\\ \;\;\;\;t\_1\\ \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
 (let* ((t_1 (- (* x y) (* (* a b) 0.25))) (t_2 (+ c (* 0.0625 (* z t)))))
   (if (<= z -7e+50)
     t_2
     (if (<= z -5.3e-146)
       t_1
       (if (<= z -3e-175)
         t_2
         (if (<= z 8.8e-95) t_1 (+ c (* z (* t 0.0625)))))))))
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 + (0.0625 * (z * t));
	double tmp;
	if (z <= -7e+50) {
		tmp = t_2;
	} else if (z <= -5.3e-146) {
		tmp = t_1;
	} else if (z <= -3e-175) {
		tmp = t_2;
	} else if (z <= 8.8e-95) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (x * y) - ((a * b) * 0.25d0)
    t_2 = c + (0.0625d0 * (z * t))
    if (z <= (-7d+50)) then
        tmp = t_2
    else if (z <= (-5.3d-146)) then
        tmp = t_1
    else if (z <= (-3d-175)) then
        tmp = t_2
    else if (z <= 8.8d-95) then
        tmp = t_1
    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 t_1 = (x * y) - ((a * b) * 0.25);
	double t_2 = c + (0.0625 * (z * t));
	double tmp;
	if (z <= -7e+50) {
		tmp = t_2;
	} else if (z <= -5.3e-146) {
		tmp = t_1;
	} else if (z <= -3e-175) {
		tmp = t_2;
	} else if (z <= 8.8e-95) {
		tmp = t_1;
	} else {
		tmp = c + (z * (t * 0.0625));
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = (x * y) - ((a * b) * 0.25)
	t_2 = c + (0.0625 * (z * t))
	tmp = 0
	if z <= -7e+50:
		tmp = t_2
	elif z <= -5.3e-146:
		tmp = t_1
	elif z <= -3e-175:
		tmp = t_2
	elif z <= 8.8e-95:
		tmp = t_1
	else:
		tmp = c + (z * (t * 0.0625))
	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(0.0625 * Float64(z * t)))
	tmp = 0.0
	if (z <= -7e+50)
		tmp = t_2;
	elseif (z <= -5.3e-146)
		tmp = t_1;
	elseif (z <= -3e-175)
		tmp = t_2;
	elseif (z <= 8.8e-95)
		tmp = t_1;
	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)
	t_1 = (x * y) - ((a * b) * 0.25);
	t_2 = c + (0.0625 * (z * t));
	tmp = 0.0;
	if (z <= -7e+50)
		tmp = t_2;
	elseif (z <= -5.3e-146)
		tmp = t_1;
	elseif (z <= -3e-175)
		tmp = t_2;
	elseif (z <= 8.8e-95)
		tmp = t_1;
	else
		tmp = c + (z * (t * 0.0625));
	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[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7e+50], t$95$2, If[LessEqual[z, -5.3e-146], t$95$1, If[LessEqual[z, -3e-175], t$95$2, If[LessEqual[z, 8.8e-95], t$95$1, N[(c + N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -5.3 \cdot 10^{-146}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -3 \cdot 10^{-175}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;z \leq 8.8 \cdot 10^{-95}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -7.00000000000000012e50 or -5.29999999999999982e-146 < z < -3e-175

    1. Initial program 98.2%

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

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

    if -7.00000000000000012e50 < z < -5.29999999999999982e-146 or -3e-175 < z < 8.7999999999999995e-95

    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
    3. Taylor expanded in z around 0 91.7%

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

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

    if 8.7999999999999995e-95 < z

    1. Initial program 94.9%

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

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

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

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

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

      \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right)} + c \]
    6. Step-by-step derivation
      1. associate-*r*59.7%

        \[\leadsto \color{blue}{\left(0.0625 \cdot t\right) \cdot z} + c \]
      2. *-commutative59.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7 \cdot 10^{+50}:\\ \;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;z \leq -5.3 \cdot 10^{-146}:\\ \;\;\;\;x \cdot y - \left(a \cdot b\right) \cdot 0.25\\ \mathbf{elif}\;z \leq -3 \cdot 10^{-175}:\\ \;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;z \leq 8.8 \cdot 10^{-95}:\\ \;\;\;\;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 6: 89.0% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := 0.0625 \cdot \left(z \cdot t\right)\\
\mathbf{if}\;x \cdot y \leq -8.4 \cdot 10^{+173} \lor \neg \left(x \cdot y \leq 9.5 \cdot 10^{+22}\right):\\
\;\;\;\;c + \left(x \cdot y + t\_1\right)\\

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


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

    1. Initial program 96.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 a around 0 91.0%

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

    if -8.40000000000000001e173 < (*.f64 x y) < 9.49999999999999937e22

    1. Initial program 98.2%

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

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

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

Alternative 7: 89.2% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+114} \lor \neg \left(a \cdot b \leq 5 \cdot 10^{+153}\right):\\ \;\;\;\;c + \left(x \cdot y - \left(a \cdot b\right) \cdot 0.25\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+114) (not (<= (* a b) 5e+153)))
   (+ c (- (* 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+114) || !((a * b) <= 5e+153)) {
		tmp = c + ((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+114)) .or. (.not. ((a * b) <= 5d+153))) then
        tmp = c + ((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+114) || !((a * b) <= 5e+153)) {
		tmp = c + ((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+114) or not ((a * b) <= 5e+153):
		tmp = c + ((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+114) || !(Float64(a * b) <= 5e+153))
		tmp = Float64(c + 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+114) || ~(((a * b) <= 5e+153)))
		tmp = c + ((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+114], N[Not[LessEqual[N[(a * b), $MachinePrecision], 5e+153]], $MachinePrecision]], N[(c + N[(N[(x * y), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $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^{+114} \lor \neg \left(a \cdot b \leq 5 \cdot 10^{+153}\right):\\
\;\;\;\;c + \left(x \cdot y - \left(a \cdot b\right) \cdot 0.25\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.0000000000000001e114 or 5.00000000000000018e153 < (*.f64 a b)

    1. Initial program 93.6%

      \[\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 0 83.4%

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

    if -5.0000000000000001e114 < (*.f64 a b) < 5.00000000000000018e153

    1. Initial program 99.5%

      \[\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 a around 0 94.1%

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

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

Alternative 8: 85.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+114}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;a \cdot b \leq 10^{+253}:\\ \;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\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) -5e+114)
   (+ c (* a (* b -0.25)))
   (if (<= (* a b) 1e+253)
     (+ c (+ (* x y) (* 0.0625 (* z t))))
     (- (* 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) <= -5e+114) {
		tmp = c + (a * (b * -0.25));
	} else if ((a * b) <= 1e+253) {
		tmp = c + ((x * y) + (0.0625 * (z * t)));
	} 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) <= (-5d+114)) then
        tmp = c + (a * (b * (-0.25d0)))
    else if ((a * b) <= 1d+253) then
        tmp = c + ((x * y) + (0.0625d0 * (z * t)))
    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) <= -5e+114) {
		tmp = c + (a * (b * -0.25));
	} else if ((a * b) <= 1e+253) {
		tmp = c + ((x * y) + (0.0625 * (z * t)));
	} else {
		tmp = (x * y) - ((a * b) * 0.25);
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	tmp = 0
	if (a * b) <= -5e+114:
		tmp = c + (a * (b * -0.25))
	elif (a * b) <= 1e+253:
		tmp = c + ((x * y) + (0.0625 * (z * t)))
	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) <= -5e+114)
		tmp = Float64(c + Float64(a * Float64(b * -0.25)));
	elseif (Float64(a * b) <= 1e+253)
		tmp = Float64(c + Float64(Float64(x * y) + Float64(0.0625 * Float64(z * t))));
	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) <= -5e+114)
		tmp = c + (a * (b * -0.25));
	elseif ((a * b) <= 1e+253)
		tmp = c + ((x * y) + (0.0625 * (z * t)));
	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], -5e+114], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+253], N[(c + N[(N[(x * y), $MachinePrecision] + N[(0.0625 * N[(z * t), $MachinePrecision]), $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 -5 \cdot 10^{+114}:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\

\mathbf{elif}\;a \cdot b \leq 10^{+253}:\\
\;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\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) < -5.0000000000000001e114

    1. Initial program 95.1%

      \[\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 a around inf 80.0%

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

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

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

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

    if -5.0000000000000001e114 < (*.f64 a b) < 9.9999999999999994e252

    1. Initial program 99.1%

      \[\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 a around 0 92.0%

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

    if 9.9999999999999994e252 < (*.f64 a b)

    1. Initial program 90.0%

      \[\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 0 85.6%

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

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

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

Alternative 9: 64.9% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -3.6 \cdot 10^{+174} \lor \neg \left(x \cdot y \leq 1.8 \cdot 10^{+87}\right):\\
\;\;\;\;c + x \cdot y\\

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


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

    1. Initial program 96.3%

      \[\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 inf 79.6%

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

    if -3.6000000000000002e174 < (*.f64 x y) < 1.79999999999999997e87

    1. Initial program 98.4%

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

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

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

Alternative 10: 97.9% accurate, 1.0× speedup?

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

\\
c + \left(\left(x \cdot y + t \cdot \left(z \cdot 0.0625\right)\right) - \frac{a \cdot b}{4}\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. Add Preprocessing
  3. Step-by-step derivation
    1. associate-*l/98.0%

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

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

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

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

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

Alternative 11: 48.2% accurate, 3.4× speedup?

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

\\
c + x \cdot y
\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. Add Preprocessing
  3. Taylor expanded in x around inf 48.9%

    \[\leadsto \color{blue}{x \cdot y} + c \]
  4. Final simplification48.9%

    \[\leadsto c + x \cdot y \]
  5. Add Preprocessing

Alternative 12: 22.3% 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. sub-neg97.7%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto c \]
  7. Add Preprocessing

Reproduce

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