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

Percentage Accurate: 97.7% → 98.5%
Time: 13.2s
Alternatives: 15
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 15 alternatives:

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

Initial Program: 97.7% accurate, 1.0× speedup?

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

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

Alternative 1: 98.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\\ \mathbf{if}\;t\_1 \leq \infty:\\ \;\;\;\;c + t\_1\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(t \cdot 0.0625 + \frac{c}{z}\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) (* z (+ (* t 0.0625) (/ c z))))))
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 = z * ((t * 0.0625) + (c / z));
	}
	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 = z * ((t * 0.0625) + (c / z));
	}
	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 = z * ((t * 0.0625) + (c / z))
	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(z * Float64(Float64(t * 0.0625) + Float64(c / z)));
	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 = z * ((t * 0.0625) + (c / z));
	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[(z * N[(N[(t * 0.0625), $MachinePrecision] + N[(c / z), $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}:\\
\;\;\;\;z \cdot \left(t \cdot 0.0625 + \frac{c}{z}\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 x around 0 36.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 z around inf 36.4%

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

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

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

Alternative 2: 98.8% 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 95.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+95.7%

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

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

      \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}} - \frac{a \cdot b}{4}\right) + c \]
    4. fma-neg97.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-frac297.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-eval97.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. Simplified97.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. Add Preprocessing

Alternative 3: 44.0% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.3 \cdot 10^{+106}:\\
\;\;\;\;x \cdot y\\

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

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

\mathbf{elif}\;x \cdot y \leq 6.6 \cdot 10^{+60}:\\
\;\;\;\;c\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 x y) < -1.3000000000000001e106 or 6.5999999999999995e60 < (*.f64 x y)

    1. Initial program 90.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 0 85.3%

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

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

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

    if -1.3000000000000001e106 < (*.f64 x y) < -6.50000000000000024e-203

    1. Initial program 98.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 z around inf 82.0%

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

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

    if -6.50000000000000024e-203 < (*.f64 x y) < 3.3999999999999999e-241

    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 x around 0 100.0%

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

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

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

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

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

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

    if 3.3999999999999999e-241 < (*.f64 x y) < 6.5999999999999995e60

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1.3 \cdot 10^{+106}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -6.5 \cdot 10^{-203}:\\ \;\;\;\;z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{elif}\;x \cdot y \leq 3.4 \cdot 10^{-241}:\\ \;\;\;\;b \cdot \left(a \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 6.6 \cdot 10^{+60}:\\ \;\;\;\;c\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 66.7% accurate, 0.6× speedup?

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

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

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

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


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

    1. Initial program 90.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 88.8%

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

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

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

    if -9.99999999999999966e89 < (*.f64 x y) < -4.99999999999999973e-202

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

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

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

    if -4.99999999999999973e-202 < (*.f64 x y) < 4.9999999999999996e44

    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. fma-neg100.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 73.3%

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

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

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

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

    if 4.9999999999999996e44 < (*.f64 x y)

    1. Initial program 88.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 0 81.6%

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

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

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

Alternative 5: 66.8% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot y - \left(a \cdot b\right) \cdot 0.25\\ \mathbf{if}\;x \cdot y \leq -3.6 \cdot 10^{+83}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq -1.56 \cdot 10^{-202}:\\ \;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq 6 \cdot 10^{+47}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (- (* x y) (* (* a b) 0.25))))
   (if (<= (* x y) -3.6e+83)
     t_1
     (if (<= (* x y) -1.56e-202)
       (+ c (* 0.0625 (* z t)))
       (if (<= (* x y) 6e+47) (+ 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 = (x * y) - ((a * b) * 0.25);
	double tmp;
	if ((x * y) <= -3.6e+83) {
		tmp = t_1;
	} else if ((x * y) <= -1.56e-202) {
		tmp = c + (0.0625 * (z * t));
	} else if ((x * y) <= 6e+47) {
		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 = (x * y) - ((a * b) * 0.25d0)
    if ((x * y) <= (-3.6d+83)) then
        tmp = t_1
    else if ((x * y) <= (-1.56d-202)) then
        tmp = c + (0.0625d0 * (z * t))
    else if ((x * y) <= 6d+47) 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 = (x * y) - ((a * b) * 0.25);
	double tmp;
	if ((x * y) <= -3.6e+83) {
		tmp = t_1;
	} else if ((x * y) <= -1.56e-202) {
		tmp = c + (0.0625 * (z * t));
	} else if ((x * y) <= 6e+47) {
		tmp = c + (a * (b * -0.25));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = (x * y) - ((a * b) * 0.25)
	tmp = 0
	if (x * y) <= -3.6e+83:
		tmp = t_1
	elif (x * y) <= -1.56e-202:
		tmp = c + (0.0625 * (z * t))
	elif (x * y) <= 6e+47:
		tmp = c + (a * (b * -0.25))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c)
	t_1 = Float64(Float64(x * y) - Float64(Float64(a * b) * 0.25))
	tmp = 0.0
	if (Float64(x * y) <= -3.6e+83)
		tmp = t_1;
	elseif (Float64(x * y) <= -1.56e-202)
		tmp = Float64(c + Float64(0.0625 * Float64(z * t)));
	elseif (Float64(x * y) <= 6e+47)
		tmp = Float64(c + Float64(a * Float64(b * -0.25)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	t_1 = (x * y) - ((a * b) * 0.25);
	tmp = 0.0;
	if ((x * y) <= -3.6e+83)
		tmp = t_1;
	elseif ((x * y) <= -1.56e-202)
		tmp = c + (0.0625 * (z * t));
	elseif ((x * y) <= 6e+47)
		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[(N[(x * y), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -3.6e+83], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -1.56e-202], N[(c + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 6e+47], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -3.5999999999999997e83 or 6.0000000000000003e47 < (*.f64 x y)

    1. Initial program 89.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 84.9%

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

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

    if -3.5999999999999997e83 < (*.f64 x y) < -1.56e-202

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

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

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

    if -1.56e-202 < (*.f64 x y) < 6.0000000000000003e47

    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. fma-neg100.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 73.3%

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

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

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

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

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

Alternative 6: 65.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := c + x \cdot y\\ \mathbf{if}\;x \cdot y \leq -1.65 \cdot 10^{+118}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq -2.7 \cdot 10^{-202}:\\ \;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq 6.8 \cdot 10^{+117}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (+ c (* x y))))
   (if (<= (* x y) -1.65e+118)
     t_1
     (if (<= (* x y) -2.7e-202)
       (+ c (* 0.0625 (* z t)))
       (if (<= (* x y) 6.8e+117) (+ 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) <= -1.65e+118) {
		tmp = t_1;
	} else if ((x * y) <= -2.7e-202) {
		tmp = c + (0.0625 * (z * t));
	} else if ((x * y) <= 6.8e+117) {
		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) <= (-1.65d+118)) then
        tmp = t_1
    else if ((x * y) <= (-2.7d-202)) then
        tmp = c + (0.0625d0 * (z * t))
    else if ((x * y) <= 6.8d+117) 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) <= -1.65e+118) {
		tmp = t_1;
	} else if ((x * y) <= -2.7e-202) {
		tmp = c + (0.0625 * (z * t));
	} else if ((x * y) <= 6.8e+117) {
		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) <= -1.65e+118:
		tmp = t_1
	elif (x * y) <= -2.7e-202:
		tmp = c + (0.0625 * (z * t))
	elif (x * y) <= 6.8e+117:
		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) <= -1.65e+118)
		tmp = t_1;
	elseif (Float64(x * y) <= -2.7e-202)
		tmp = Float64(c + Float64(0.0625 * Float64(z * t)));
	elseif (Float64(x * y) <= 6.8e+117)
		tmp = Float64(c + Float64(a * Float64(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) <= -1.65e+118)
		tmp = t_1;
	elseif ((x * y) <= -2.7e-202)
		tmp = c + (0.0625 * (z * t));
	elseif ((x * y) <= 6.8e+117)
		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], -1.65e+118], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -2.7e-202], N[(c + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 6.8e+117], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -1.65e118 or 6.8000000000000002e117 < (*.f64 x y)

    1. Initial program 90.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 81.5%

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

      \[\leadsto \color{blue}{c + x \cdot y} \]
    5. Step-by-step derivation
      1. +-commutative78.3%

        \[\leadsto \color{blue}{x \cdot y + c} \]
    6. Simplified78.3%

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

    if -1.65e118 < (*.f64 x y) < -2.6999999999999999e-202

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

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

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

    if -2.6999999999999999e-202 < (*.f64 x y) < 6.8000000000000002e117

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 89.8% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(a \cdot b\right) \cdot 0.25\\ \mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+82} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{+44}\right):\\ \;\;\;\;\left(c + x \cdot y\right) - t\_1\\ \mathbf{else}:\\ \;\;\;\;\left(c + 0.0625 \cdot \left(z \cdot t\right)\right) - t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (* (* a b) 0.25)))
   (if (or (<= (* x y) -2e+82) (not (<= (* x y) 5e+44)))
     (- (+ c (* x y)) t_1)
     (- (+ c (* 0.0625 (* z t))) 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 (((x * y) <= -2e+82) || !((x * y) <= 5e+44)) {
		tmp = (c + (x * y)) - t_1;
	} else {
		tmp = (c + (0.0625 * (z * t))) - 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 (((x * y) <= (-2d+82)) .or. (.not. ((x * y) <= 5d+44))) then
        tmp = (c + (x * y)) - t_1
    else
        tmp = (c + (0.0625d0 * (z * t))) - 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 (((x * y) <= -2e+82) || !((x * y) <= 5e+44)) {
		tmp = (c + (x * y)) - t_1;
	} else {
		tmp = (c + (0.0625 * (z * t))) - t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = (a * b) * 0.25
	tmp = 0
	if ((x * y) <= -2e+82) or not ((x * y) <= 5e+44):
		tmp = (c + (x * y)) - t_1
	else:
		tmp = (c + (0.0625 * (z * t))) - 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(x * y) <= -2e+82) || !(Float64(x * y) <= 5e+44))
		tmp = Float64(Float64(c + Float64(x * y)) - t_1);
	else
		tmp = Float64(Float64(c + Float64(0.0625 * Float64(z * t))) - 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 (((x * y) <= -2e+82) || ~(((x * y) <= 5e+44)))
		tmp = (c + (x * y)) - t_1;
	else
		tmp = (c + (0.0625 * (z * t))) - 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[Or[LessEqual[N[(x * y), $MachinePrecision], -2e+82], N[Not[LessEqual[N[(x * y), $MachinePrecision], 5e+44]], $MachinePrecision]], N[(N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], N[(N[(c + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(a \cdot b\right) \cdot 0.25\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+82} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{+44}\right):\\
\;\;\;\;\left(c + x \cdot y\right) - t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -1.9999999999999999e82 or 4.9999999999999996e44 < (*.f64 x y)

    1. Initial program 88.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 84.0%

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

    if -1.9999999999999999e82 < (*.f64 x y) < 4.9999999999999996e44

    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 x around 0 95.8%

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

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

Alternative 8: 88.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+123} \lor \neg \left(a \cdot b \leq 40000000000000\right):\\ \;\;\;\;\left(c + x \cdot y\right) - \left(a \cdot b\right) \cdot 0.25\\ \mathbf{else}:\\ \;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (if (or (<= (* a b) -5e+123) (not (<= (* a b) 40000000000000.0)))
   (- (+ 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+123) || !((a * b) <= 40000000000000.0)) {
		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+123)) .or. (.not. ((a * b) <= 40000000000000.0d0))) 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+123) || !((a * b) <= 40000000000000.0)) {
		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+123) or not ((a * b) <= 40000000000000.0):
		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+123) || !(Float64(a * b) <= 40000000000000.0))
		tmp = Float64(Float64(c + 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+123) || ~(((a * b) <= 40000000000000.0)))
		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+123], N[Not[LessEqual[N[(a * b), $MachinePrecision], 40000000000000.0]], $MachinePrecision]], N[(N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(x * y), $MachinePrecision] + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -4.99999999999999974e123 or 4e13 < (*.f64 a b)

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

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

    if -4.99999999999999974e123 < (*.f64 a b) < 4e13

    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}{c + \left(0.0625 \cdot \left(t \cdot z\right) + x \cdot y\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification88.3%

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

Alternative 9: 86.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+192} \lor \neg \left(a \cdot b \leq 10^{+109}\right):\\ \;\;\;\;z \cdot \left(t \cdot 0.0625\right) - \left(a \cdot b\right) \cdot 0.25\\ \mathbf{else}:\\ \;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (if (or (<= (* a b) -2e+192) (not (<= (* a b) 1e+109)))
   (- (* z (* t 0.0625)) (* (* 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) <= -2e+192) || !((a * b) <= 1e+109)) {
		tmp = (z * (t * 0.0625)) - ((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) <= (-2d+192)) .or. (.not. ((a * b) <= 1d+109))) then
        tmp = (z * (t * 0.0625d0)) - ((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) <= -2e+192) || !((a * b) <= 1e+109)) {
		tmp = (z * (t * 0.0625)) - ((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) <= -2e+192) or not ((a * b) <= 1e+109):
		tmp = (z * (t * 0.0625)) - ((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) <= -2e+192) || !(Float64(a * b) <= 1e+109))
		tmp = Float64(Float64(z * Float64(t * 0.0625)) - 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) <= -2e+192) || ~(((a * b) <= 1e+109)))
		tmp = (z * (t * 0.0625)) - ((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], -2e+192], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1e+109]], $MachinePrecision]], N[(N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(x * y), $MachinePrecision] + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+192} \lor \neg \left(a \cdot b \leq 10^{+109}\right):\\
\;\;\;\;z \cdot \left(t \cdot 0.0625\right) - \left(a \cdot b\right) \cdot 0.25\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -2.00000000000000008e192 or 9.99999999999999982e108 < (*.f64 a b)

    1. Initial program 91.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 86.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 z around inf 77.6%

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

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

    if -2.00000000000000008e192 < (*.f64 a b) < 9.99999999999999982e108

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

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

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

Alternative 10: 85.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -4 \cdot 10^{+163}:\\ \;\;\;\;y \cdot \left(x + -0.25 \cdot \frac{a \cdot b}{y}\right)\\ \mathbf{elif}\;a \cdot b \leq 10^{+109}:\\ \;\;\;\;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) -4e+163)
   (* y (+ x (* -0.25 (/ (* a b) y))))
   (if (<= (* a b) 1e+109)
     (+ 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) <= -4e+163) {
		tmp = y * (x + (-0.25 * ((a * b) / y)));
	} else if ((a * b) <= 1e+109) {
		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) <= (-4d+163)) then
        tmp = y * (x + ((-0.25d0) * ((a * b) / y)))
    else if ((a * b) <= 1d+109) 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) <= -4e+163) {
		tmp = y * (x + (-0.25 * ((a * b) / y)));
	} else if ((a * b) <= 1e+109) {
		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) <= -4e+163:
		tmp = y * (x + (-0.25 * ((a * b) / y)))
	elif (a * b) <= 1e+109:
		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) <= -4e+163)
		tmp = Float64(y * Float64(x + Float64(-0.25 * Float64(Float64(a * b) / y))));
	elseif (Float64(a * b) <= 1e+109)
		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) <= -4e+163)
		tmp = y * (x + (-0.25 * ((a * b) / y)));
	elseif ((a * b) <= 1e+109)
		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], -4e+163], N[(y * N[(x + N[(-0.25 * N[(N[(a * b), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+109], 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 -4 \cdot 10^{+163}:\\
\;\;\;\;y \cdot \left(x + -0.25 \cdot \frac{a \cdot b}{y}\right)\\

\mathbf{elif}\;a \cdot b \leq 10^{+109}:\\
\;\;\;\;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) < -3.9999999999999998e163

    1. Initial program 88.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 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 81.9%

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

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

    if -3.9999999999999998e163 < (*.f64 a b) < 9.99999999999999982e108

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

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

    if 9.99999999999999982e108 < (*.f64 a b)

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -4 \cdot 10^{+163}:\\ \;\;\;\;y \cdot \left(x + -0.25 \cdot \frac{a \cdot b}{y}\right)\\ \mathbf{elif}\;a \cdot b \leq 10^{+109}:\\ \;\;\;\;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 11: 43.9% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2.3 \cdot 10^{+146}:\\
\;\;\;\;x \cdot y\\

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

\mathbf{elif}\;x \cdot y \leq 5.4 \cdot 10^{+68}:\\
\;\;\;\;c\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -2.3e146 or 5.39999999999999982e68 < (*.f64 x y)

    1. Initial program 89.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 85.9%

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

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

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

    if -2.3e146 < (*.f64 x y) < 2.0500000000000001e-240

    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 x around 0 96.2%

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

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

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

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

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

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

    if 2.0500000000000001e-240 < (*.f64 x y) < 5.39999999999999982e68

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2.3 \cdot 10^{+146}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq 2.05 \cdot 10^{-240}:\\ \;\;\;\;b \cdot \left(a \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 5.4 \cdot 10^{+68}:\\ \;\;\;\;c\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 65.3% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1.75 \cdot 10^{+114} \lor \neg \left(x \cdot y \leq 8.2 \cdot 10^{+93}\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) -1.75e+114) (not (<= (* x y) 8.2e+93)))
   (+ 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) <= -1.75e+114) || !((x * y) <= 8.2e+93)) {
		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) <= (-1.75d+114)) .or. (.not. ((x * y) <= 8.2d+93))) 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) <= -1.75e+114) || !((x * y) <= 8.2e+93)) {
		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) <= -1.75e+114) or not ((x * y) <= 8.2e+93):
		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) <= -1.75e+114) || !(Float64(x * y) <= 8.2e+93))
		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) <= -1.75e+114) || ~(((x * y) <= 8.2e+93)))
		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], -1.75e+114], N[Not[LessEqual[N[(x * y), $MachinePrecision], 8.2e+93]], $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 -1.75 \cdot 10^{+114} \lor \neg \left(x \cdot y \leq 8.2 \cdot 10^{+93}\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) < -1.75e114 or 8.2000000000000002e93 < (*.f64 x y)

    1. Initial program 90.9%

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

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

      \[\leadsto \color{blue}{c + x \cdot y} \]
    5. Step-by-step derivation
      1. +-commutative76.9%

        \[\leadsto \color{blue}{x \cdot y + c} \]
    6. Simplified76.9%

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

    if -1.75e114 < (*.f64 x y) < 8.2000000000000002e93

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

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

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

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

Alternative 13: 41.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -6 \cdot 10^{+115} \lor \neg \left(x \cdot y \leq 2.4 \cdot 10^{+70}\right):\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -6.0000000000000001e115 or 2.39999999999999987e70 < (*.f64 x y)

    1. Initial program 90.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 0 85.3%

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

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

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

    if -6.0000000000000001e115 < (*.f64 x y) < 2.39999999999999987e70

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

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

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

Alternative 14: 53.9% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.3 \cdot 10^{-25} \lor \neg \left(b \leq 5 \cdot 10^{+156}\right):\\
\;\;\;\;b \cdot \left(a \cdot -0.25\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -2.2999999999999999e-25 or 4.99999999999999992e156 < b

    1. Initial program 93.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 x around 0 81.0%

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

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

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

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

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

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

    if -2.2999999999999999e-25 < b < 4.99999999999999992e156

    1. Initial program 97.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 0 84.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.4%

      \[\leadsto \color{blue}{c + x \cdot y} \]
    5. Step-by-step derivation
      1. +-commutative62.4%

        \[\leadsto \color{blue}{x \cdot y + c} \]
    6. Simplified62.4%

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

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

Alternative 15: 22.4% accurate, 17.0× speedup?

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

\\
c
\end{array}
Derivation
  1. Initial program 95.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 c around inf 23.5%

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

Reproduce

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