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

Percentage Accurate: 97.9% → 98.9%
Time: 11.6s
Alternatives: 14
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 14 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.9% accurate, 1.0× speedup?

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

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

Alternative 1: 98.9% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(x, y, \mathsf{fma}\left(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 98.4%

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

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

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

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

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

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

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

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

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

Alternative 2: 98.3% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 43.9% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;x \cdot y \leq -5.7 \cdot 10^{+51}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{-179}:\\
\;\;\;\;c\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 x y) < -2.49999999999999985e165 or 4.20000000000000011e66 < (*.f64 x y)

    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 z around 0 83.5%

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

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

    if -2.49999999999999985e165 < (*.f64 x y) < -5.7000000000000002e51 or -1e-179 < (*.f64 x y) < 4.5000000000000001e-168

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

      \[\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 c around 0 76.7%

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

      \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right)} \]
    6. Step-by-step derivation
      1. *-commutative44.5%

        \[\leadsto \color{blue}{\left(t \cdot z\right) \cdot 0.0625} \]
      2. associate-*r*44.5%

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

        \[\leadsto t \cdot \color{blue}{\left(0.0625 \cdot z\right)} \]
    7. Simplified44.5%

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

    if -5.7000000000000002e51 < (*.f64 x y) < -4.19999999999999979e-29 or 4.5000000000000001e-168 < (*.f64 x y) < 4.20000000000000011e66

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

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

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

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

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

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

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

    if -4.19999999999999979e-29 < (*.f64 x y) < -1e-179

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2.5 \cdot 10^{+165}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -5.7 \cdot 10^{+51}:\\ \;\;\;\;t \cdot \left(z \cdot 0.0625\right)\\ \mathbf{elif}\;x \cdot y \leq -4.2 \cdot 10^{-29}:\\ \;\;\;\;b \cdot \left(a \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{-179}:\\ \;\;\;\;c\\ \mathbf{elif}\;x \cdot y \leq 4.5 \cdot 10^{-168}:\\ \;\;\;\;t \cdot \left(z \cdot 0.0625\right)\\ \mathbf{elif}\;x \cdot y \leq 4.2 \cdot 10^{+66}:\\ \;\;\;\;b \cdot \left(a \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 64.3% accurate, 0.5× speedup?

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -8.19999999999999996e160 or 1.25000000000000001e54 < (*.f64 x y)

    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 x around inf 75.7%

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

    if -8.19999999999999996e160 < (*.f64 x y) < -3.8999999999999999e-244 or 1.94999999999999999e-200 < (*.f64 x y) < 1.25000000000000001e54

    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 inf 66.9%

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

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

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

    if -3.8999999999999999e-244 < (*.f64 x y) < 1.94999999999999999e-200

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -8.2 \cdot 10^{+160}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -3.9 \cdot 10^{-244}:\\ \;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 1.95 \cdot 10^{-200}:\\ \;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq 1.25 \cdot 10^{+54}:\\ \;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;c + x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 65.9% accurate, 0.5× speedup?

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

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

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

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

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

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


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

    1. Initial program 96.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 z around 0 76.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 73.3%

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

    if -6.20000000000000011e48 < (*.f64 x y) < -5.09999999999999981e-244 or 4.20000000000000024e-201 < (*.f64 x y) < 3.99999999999999989e59

    1. Initial program 98.1%

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

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

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

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

    if -5.09999999999999981e-244 < (*.f64 x y) < 4.20000000000000024e-201

    1. Initial program 100.0%

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

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

    if 3.99999999999999989e59 < (*.f64 x y)

    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 inf 77.3%

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

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

Alternative 6: 88.3% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := 0.0625 \cdot \left(z \cdot t\right)\\
\mathbf{if}\;x \cdot y \leq -6.5 \cdot 10^{+164} \lor \neg \left(x \cdot y \leq 2.3 \cdot 10^{+34}\right):\\
\;\;\;\;c + \left(x \cdot y + t\_1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -6.5000000000000003e164 or 2.2999999999999998e34 < (*.f64 x y)

    1. Initial program 97.9%

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

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

    if -6.5000000000000003e164 < (*.f64 x y) < 2.2999999999999998e34

    1. Initial program 98.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -6.5 \cdot 10^{+164} \lor \neg \left(x \cdot y \leq 2.3 \cdot 10^{+34}\right):\\ \;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\ \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 7: 87.2% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 94.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)} \]
    4. Taylor expanded in c around 0 89.1%

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

    if -1.00000000000000001e78 < (*.f64 a b) < 1e152

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

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

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

Alternative 8: 89.6% accurate, 0.7× speedup?

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

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

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

    if -1.00000000000000001e78 < (*.f64 a b) < 1.99999999999999989e66

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+78} \lor \neg \left(a \cdot b \leq 2 \cdot 10^{+66}\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: 44.5% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -8.2 \cdot 10^{+160} \lor \neg \left(x \cdot y \leq 1.8 \cdot 10^{+72}\right):\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -8.19999999999999996e160 or 1.80000000000000017e72 < (*.f64 x y)

    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 z around 0 81.7%

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

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

    if -8.19999999999999996e160 < (*.f64 x y) < 1.80000000000000017e72

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

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

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

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

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

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

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

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

Alternative 10: 42.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -6.2 \cdot 10^{+38} \lor \neg \left(x \cdot y \leq 2.8 \cdot 10^{+73}\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) -6.2e+38) (not (<= (* x y) 2.8e+73))) (* x y) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double tmp;
	if (((x * y) <= -6.2e+38) || !((x * y) <= 2.8e+73)) {
		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) <= (-6.2d+38)) .or. (.not. ((x * y) <= 2.8d+73))) 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) <= -6.2e+38) || !((x * y) <= 2.8e+73)) {
		tmp = x * y;
	} else {
		tmp = c;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	tmp = 0
	if ((x * y) <= -6.2e+38) or not ((x * y) <= 2.8e+73):
		tmp = x * y
	else:
		tmp = c
	return tmp
function code(x, y, z, t, a, b, c)
	tmp = 0.0
	if ((Float64(x * y) <= -6.2e+38) || !(Float64(x * y) <= 2.8e+73))
		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) <= -6.2e+38) || ~(((x * y) <= 2.8e+73)))
		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], -6.2e+38], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2.8e+73]], $MachinePrecision]], N[(x * y), $MachinePrecision], c]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -6.2 \cdot 10^{+38} \lor \neg \left(x \cdot y \leq 2.8 \cdot 10^{+73}\right):\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -6.20000000000000035e38 or 2.80000000000000008e73 < (*.f64 x y)

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

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

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

    if -6.20000000000000035e38 < (*.f64 x y) < 2.80000000000000008e73

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

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

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

Alternative 11: 59.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.68 \lor \neg \left(x \leq 1.55 \cdot 10^{-49}\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 -0.68) (not (<= x 1.55e-49)))
   (+ 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 <= -0.68) || !(x <= 1.55e-49)) {
		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 <= (-0.68d0)) .or. (.not. (x <= 1.55d-49))) 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 <= -0.68) || !(x <= 1.55e-49)) {
		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 <= -0.68) or not (x <= 1.55e-49):
		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 ((x <= -0.68) || !(x <= 1.55e-49))
		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 <= -0.68) || ~((x <= 1.55e-49)))
		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[x, -0.68], N[Not[LessEqual[x, 1.55e-49]], $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 \leq -0.68 \lor \neg \left(x \leq 1.55 \cdot 10^{-49}\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 x < -0.680000000000000049 or 1.55e-49 < x

    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 x around inf 62.6%

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

    if -0.680000000000000049 < x < 1.55e-49

    1. Initial program 99.2%

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

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

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

Alternative 12: 97.9% accurate, 1.0× speedup?

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

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

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

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

Alternative 13: 54.9% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.12 \cdot 10^{+39} \lor \neg \left(b \leq 9 \cdot 10^{+203}\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 -1.12e+39) (not (<= b 9e+203)))
   (* 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 <= -1.12e+39) || !(b <= 9e+203)) {
		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 <= (-1.12d+39)) .or. (.not. (b <= 9d+203))) 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 <= -1.12e+39) || !(b <= 9e+203)) {
		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 <= -1.12e+39) or not (b <= 9e+203):
		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 <= -1.12e+39) || !(b <= 9e+203))
		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 <= -1.12e+39) || ~((b <= 9e+203)))
		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, -1.12e+39], N[Not[LessEqual[b, 9e+203]], $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 -1.12 \cdot 10^{+39} \lor \neg \left(b \leq 9 \cdot 10^{+203}\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 < -1.12e39 or 9.0000000000000006e203 < b

    1. Initial program 95.0%

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

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

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

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

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

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

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

    if -1.12e39 < b < 9.0000000000000006e203

    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 inf 56.7%

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

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

Alternative 14: 22.3% accurate, 17.0× speedup?

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

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

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

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

    \[\leadsto c \]
  5. Add Preprocessing

Reproduce

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