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

Percentage Accurate: 97.8% → 99.1%
Time: 11.3s
Alternatives: 12
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 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: 99.1% 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}:\\ \;\;\;\;c + t \cdot \left(x \cdot \frac{y}{t} - z \cdot -0.0625\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0))))
   (if (<= t_1 INFINITY)
     (+ c t_1)
     (+ c (* t (- (* x (/ y t)) (* z -0.0625)))))))
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 + (t * ((x * (y / t)) - (z * -0.0625)));
	}
	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 + (t * ((x * (y / t)) - (z * -0.0625)));
	}
	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 + (t * ((x * (y / t)) - (z * -0.0625)))
	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(c + Float64(t * Float64(Float64(x * Float64(y / t)) - Float64(z * -0.0625))));
	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 + (t * ((x * (y / t)) - (z * -0.0625)));
	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[(c + N[(t * N[(N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision] - N[(z * -0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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


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

    1. Initial program 100.0%

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

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

    1. Initial program 0.0%

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

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

      \[\leadsto c + \color{blue}{-1 \cdot \left(t \cdot \left(-1 \cdot \frac{x \cdot y}{t} + -0.0625 \cdot z\right)\right)} \]
    5. Step-by-step derivation
      1. mul-1-neg57.1%

        \[\leadsto c + \color{blue}{\left(-t \cdot \left(-1 \cdot \frac{x \cdot y}{t} + -0.0625 \cdot z\right)\right)} \]
      2. *-commutative57.1%

        \[\leadsto c + \left(-\color{blue}{\left(-1 \cdot \frac{x \cdot y}{t} + -0.0625 \cdot z\right) \cdot t}\right) \]
      3. +-commutative57.1%

        \[\leadsto c + \left(-\color{blue}{\left(-0.0625 \cdot z + -1 \cdot \frac{x \cdot y}{t}\right)} \cdot t\right) \]
      4. mul-1-neg57.1%

        \[\leadsto c + \left(-\left(-0.0625 \cdot z + \color{blue}{\left(-\frac{x \cdot y}{t}\right)}\right) \cdot t\right) \]
      5. sub-neg57.1%

        \[\leadsto c + \left(-\color{blue}{\left(-0.0625 \cdot z - \frac{x \cdot y}{t}\right)} \cdot t\right) \]
      6. *-commutative57.1%

        \[\leadsto c + \left(-\left(\color{blue}{z \cdot -0.0625} - \frac{x \cdot y}{t}\right) \cdot t\right) \]
      7. associate-*r/85.7%

        \[\leadsto c + \left(-\left(z \cdot -0.0625 - \color{blue}{x \cdot \frac{y}{t}}\right) \cdot t\right) \]
      8. distribute-rgt-neg-in85.7%

        \[\leadsto c + \color{blue}{\left(z \cdot -0.0625 - x \cdot \frac{y}{t}\right) \cdot \left(-t\right)} \]
      9. *-commutative85.7%

        \[\leadsto c + \left(\color{blue}{-0.0625 \cdot z} - x \cdot \frac{y}{t}\right) \cdot \left(-t\right) \]
    6. Simplified85.7%

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

    \[\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}:\\ \;\;\;\;c + t \cdot \left(x \cdot \frac{y}{t} - z \cdot -0.0625\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 98.9% accurate, 0.1× speedup?

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

\\
\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \frac{a \cdot b}{-4}\right)\right) + c
\end{array}
Derivation
  1. Initial program 97.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+97.3%

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

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

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

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

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

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

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

Alternative 3: 66.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot y - \left(a \cdot b\right) \cdot 0.25\\ t_2 := c + z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+38}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-156}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \cdot t \leq 10000000:\\ \;\;\;\;c + \left(a \cdot b\right) \cdot -0.25\\ \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+168}:\\ \;\;\;\;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 (<= (* z t) -2e+38)
     t_2
     (if (<= (* z t) 5e-156)
       t_1
       (if (<= (* z t) 10000000.0)
         (+ c (* (* a b) -0.25))
         (if (<= (* z t) 5e+168) 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 ((z * t) <= -2e+38) {
		tmp = t_2;
	} else if ((z * t) <= 5e-156) {
		tmp = t_1;
	} else if ((z * t) <= 10000000.0) {
		tmp = c + ((a * b) * -0.25);
	} else if ((z * t) <= 5e+168) {
		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 ((z * t) <= (-2d+38)) then
        tmp = t_2
    else if ((z * t) <= 5d-156) then
        tmp = t_1
    else if ((z * t) <= 10000000.0d0) then
        tmp = c + ((a * b) * (-0.25d0))
    else if ((z * t) <= 5d+168) 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 ((z * t) <= -2e+38) {
		tmp = t_2;
	} else if ((z * t) <= 5e-156) {
		tmp = t_1;
	} else if ((z * t) <= 10000000.0) {
		tmp = c + ((a * b) * -0.25);
	} else if ((z * t) <= 5e+168) {
		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 (z * t) <= -2e+38:
		tmp = t_2
	elif (z * t) <= 5e-156:
		tmp = t_1
	elif (z * t) <= 10000000.0:
		tmp = c + ((a * b) * -0.25)
	elif (z * t) <= 5e+168:
		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(z * Float64(t * 0.0625)))
	tmp = 0.0
	if (Float64(z * t) <= -2e+38)
		tmp = t_2;
	elseif (Float64(z * t) <= 5e-156)
		tmp = t_1;
	elseif (Float64(z * t) <= 10000000.0)
		tmp = Float64(c + Float64(Float64(a * b) * -0.25));
	elseif (Float64(z * t) <= 5e+168)
		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 ((z * t) <= -2e+38)
		tmp = t_2;
	elseif ((z * t) <= 5e-156)
		tmp = t_1;
	elseif ((z * t) <= 10000000.0)
		tmp = c + ((a * b) * -0.25);
	elseif ((z * t) <= 5e+168)
		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[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -2e+38], t$95$2, If[LessEqual[N[(z * t), $MachinePrecision], 5e-156], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 10000000.0], N[(c + N[(N[(a * b), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+168], 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 + z \cdot \left(t \cdot 0.0625\right)\\
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+38}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-156}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \cdot t \leq 10000000:\\
\;\;\;\;c + \left(a \cdot b\right) \cdot -0.25\\

\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+168}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z t) < -1.99999999999999995e38 or 4.99999999999999967e168 < (*.f64 z t)

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

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

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

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

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

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

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

    if -1.99999999999999995e38 < (*.f64 z t) < 5.00000000000000007e-156 or 1e7 < (*.f64 z t) < 4.99999999999999967e168

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

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

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

    if 5.00000000000000007e-156 < (*.f64 z t) < 1e7

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+38}:\\ \;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-156}:\\ \;\;\;\;x \cdot y - \left(a \cdot b\right) \cdot 0.25\\ \mathbf{elif}\;z \cdot t \leq 10000000:\\ \;\;\;\;c + \left(a \cdot b\right) \cdot -0.25\\ \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+168}:\\ \;\;\;\;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 4: 43.9% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{-272}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;a \cdot b \leq 10^{-45}:\\
\;\;\;\;c\\

\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+129}:\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -9.9999999999999998e184 or 5.0000000000000003e129 < (*.f64 a b)

    1. Initial program 93.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 0 87.9%

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

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

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

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

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

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

    if -9.9999999999999998e184 < (*.f64 a b) < 4.99999999999999982e-272 or 9.99999999999999984e-46 < (*.f64 a b) < 5.0000000000000003e129

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

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

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

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

    if 4.99999999999999982e-272 < (*.f64 a b) < 9.99999999999999984e-46

    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 c around inf 46.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+185}:\\ \;\;\;\;\left(a \cdot b\right) \cdot -0.25\\ \mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{-272}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 10^{-45}:\\ \;\;\;\;c\\ \mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+129}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot b\right) \cdot -0.25\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 64.4% accurate, 0.6× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -100 or 1.00000000000000002e151 < (*.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. Add Preprocessing
    3. Taylor expanded in a around 0 83.6%

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

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

    if -100 < (*.f64 x y) < 1.00000000000000005e-230

    1. Initial program 98.9%

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

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

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

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

        \[\leadsto c + \color{blue}{z \cdot \left(0.0625 \cdot t\right)} \]
      3. *-commutative73.4%

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

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

    if 1.00000000000000005e-230 < (*.f64 x y) < 1.00000000000000002e151

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

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

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

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

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

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

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

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

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

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

Alternative 6: 89.0% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+38} \lor \neg \left(z \cdot t \leq 10^{+152}\right):\\
\;\;\;\;c + t \cdot \left(x \cdot \frac{y}{t} - z \cdot -0.0625\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -1.99999999999999995e38 or 1e152 < (*.f64 z t)

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

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

      \[\leadsto c + \color{blue}{-1 \cdot \left(t \cdot \left(-1 \cdot \frac{x \cdot y}{t} + -0.0625 \cdot z\right)\right)} \]
    5. Step-by-step derivation
      1. mul-1-neg90.0%

        \[\leadsto c + \color{blue}{\left(-t \cdot \left(-1 \cdot \frac{x \cdot y}{t} + -0.0625 \cdot z\right)\right)} \]
      2. *-commutative90.0%

        \[\leadsto c + \left(-\color{blue}{\left(-1 \cdot \frac{x \cdot y}{t} + -0.0625 \cdot z\right) \cdot t}\right) \]
      3. +-commutative90.0%

        \[\leadsto c + \left(-\color{blue}{\left(-0.0625 \cdot z + -1 \cdot \frac{x \cdot y}{t}\right)} \cdot t\right) \]
      4. mul-1-neg90.0%

        \[\leadsto c + \left(-\left(-0.0625 \cdot z + \color{blue}{\left(-\frac{x \cdot y}{t}\right)}\right) \cdot t\right) \]
      5. sub-neg90.0%

        \[\leadsto c + \left(-\color{blue}{\left(-0.0625 \cdot z - \frac{x \cdot y}{t}\right)} \cdot t\right) \]
      6. *-commutative90.0%

        \[\leadsto c + \left(-\left(\color{blue}{z \cdot -0.0625} - \frac{x \cdot y}{t}\right) \cdot t\right) \]
      7. associate-*r/91.2%

        \[\leadsto c + \left(-\left(z \cdot -0.0625 - \color{blue}{x \cdot \frac{y}{t}}\right) \cdot t\right) \]
      8. distribute-rgt-neg-in91.2%

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

        \[\leadsto c + \left(\color{blue}{-0.0625 \cdot z} - x \cdot \frac{y}{t}\right) \cdot \left(-t\right) \]
    6. Simplified91.2%

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

    if -1.99999999999999995e38 < (*.f64 z t) < 1e152

    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 0 92.3%

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

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

Alternative 7: 88.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+38} \lor \neg \left(z \cdot t \leq 10^{+152}\right):\\
\;\;\;\;c + \left(x \cdot y + \left(z \cdot t\right) \cdot 0.0625\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -1.99999999999999995e38 or 1e152 < (*.f64 z t)

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

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

    if -1.99999999999999995e38 < (*.f64 z t) < 1e152

    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 0 92.3%

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

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

Alternative 8: 86.4% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+185} \lor \neg \left(a \cdot b \leq 2 \cdot 10^{+232}\right):\\ \;\;\;\;x \cdot y - \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+185) (not (<= (* a b) 2e+232)))
   (- (* 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+185) || !((a * b) <= 2e+232)) {
		tmp = (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+185)) .or. (.not. ((a * b) <= 2d+232))) then
        tmp = (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+185) || !((a * b) <= 2e+232)) {
		tmp = (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+185) or not ((a * b) <= 2e+232):
		tmp = (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+185) || !(Float64(a * b) <= 2e+232))
		tmp = Float64(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+185) || ~(((a * b) <= 2e+232)))
		tmp = (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+185], N[Not[LessEqual[N[(a * b), $MachinePrecision], 2e+232]], $MachinePrecision]], N[(N[(x * y), $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^{+185} \lor \neg \left(a \cdot b \leq 2 \cdot 10^{+232}\right):\\
\;\;\;\;x \cdot y - \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) < -9.9999999999999998e184 or 2.00000000000000011e232 < (*.f64 a b)

    1. Initial program 91.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 z around 0 84.2%

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

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

    if -9.9999999999999998e184 < (*.f64 a b) < 2.00000000000000011e232

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+185} \lor \neg \left(a \cdot b \leq 2 \cdot 10^{+232}\right):\\ \;\;\;\;x \cdot y - \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} \]
  5. Add Preprocessing

Alternative 9: 64.3% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+38} \lor \neg \left(z \cdot t \leq 5 \cdot 10^{+168}\right):\\
\;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -1.99999999999999995e38 or 4.99999999999999967e168 < (*.f64 z t)

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

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

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

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

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

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

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

    if -1.99999999999999995e38 < (*.f64 z t) < 4.99999999999999967e168

    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 a around 0 68.6%

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

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

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

Alternative 10: 62.9% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+185} \lor \neg \left(a \cdot b \leq 2 \cdot 10^{+232}\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) -1e+185) (not (<= (* a b) 2e+232)))
   (* (* 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) <= -1e+185) || !((a * b) <= 2e+232)) {
		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) <= (-1d+185)) .or. (.not. ((a * b) <= 2d+232))) 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) <= -1e+185) || !((a * b) <= 2e+232)) {
		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) <= -1e+185) or not ((a * b) <= 2e+232):
		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) <= -1e+185) || !(Float64(a * b) <= 2e+232))
		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) <= -1e+185) || ~(((a * b) <= 2e+232)))
		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], -1e+185], N[Not[LessEqual[N[(a * b), $MachinePrecision], 2e+232]], $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 \cdot 10^{+185} \lor \neg \left(a \cdot b \leq 2 \cdot 10^{+232}\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) < -9.9999999999999998e184 or 2.00000000000000011e232 < (*.f64 a b)

    1. Initial program 91.9%

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

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

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

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

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

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

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

    if -9.9999999999999998e184 < (*.f64 a b) < 2.00000000000000011e232

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

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

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

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

Alternative 11: 36.9% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;c \leq 0.00095:\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -5.0999999999999996e130 or 9.49999999999999998e-4 < c

    1. Initial program 97.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 c around inf 50.9%

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

    if -5.0999999999999996e130 < c < 9.49999999999999998e-4

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

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

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

      \[\leadsto \color{blue}{x \cdot y} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 12: 22.2% 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.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 c around inf 21.4%

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

Reproduce

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