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

Percentage Accurate: 97.8% → 98.9%
Time: 11.9s
Alternatives: 16
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 16 alternatives:

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

Initial Program: 97.8% accurate, 1.0× speedup?

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

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

Alternative 1: 98.9% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\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: 44.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := b \cdot \left(a \cdot -0.25\right)\\ t_2 := z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{if}\;x \cdot y \leq -3.65 \cdot 10^{+140}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -3.9 \cdot 10^{+39}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq -860000000:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \cdot y \leq -8.2 \cdot 10^{-64}:\\ \;\;\;\;c\\ \mathbf{elif}\;x \cdot y \leq 280000000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 1.1 \cdot 10^{+202}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (* b (* a -0.25))) (t_2 (* z (* t 0.0625))))
   (if (<= (* x y) -3.65e+140)
     (* x y)
     (if (<= (* x y) -3.9e+39)
       t_1
       (if (<= (* x y) -860000000.0)
         t_2
         (if (<= (* x y) -8.2e-64)
           c
           (if (<= (* x y) 280000000000.0)
             t_1
             (if (<= (* x y) 1.1e+202) t_2 (* x y)))))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = b * (a * -0.25);
	double t_2 = z * (t * 0.0625);
	double tmp;
	if ((x * y) <= -3.65e+140) {
		tmp = x * y;
	} else if ((x * y) <= -3.9e+39) {
		tmp = t_1;
	} else if ((x * y) <= -860000000.0) {
		tmp = t_2;
	} else if ((x * y) <= -8.2e-64) {
		tmp = c;
	} else if ((x * y) <= 280000000000.0) {
		tmp = t_1;
	} else if ((x * y) <= 1.1e+202) {
		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 = b * (a * (-0.25d0))
    t_2 = z * (t * 0.0625d0)
    if ((x * y) <= (-3.65d+140)) then
        tmp = x * y
    else if ((x * y) <= (-3.9d+39)) then
        tmp = t_1
    else if ((x * y) <= (-860000000.0d0)) then
        tmp = t_2
    else if ((x * y) <= (-8.2d-64)) then
        tmp = c
    else if ((x * y) <= 280000000000.0d0) then
        tmp = t_1
    else if ((x * y) <= 1.1d+202) 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 = b * (a * -0.25);
	double t_2 = z * (t * 0.0625);
	double tmp;
	if ((x * y) <= -3.65e+140) {
		tmp = x * y;
	} else if ((x * y) <= -3.9e+39) {
		tmp = t_1;
	} else if ((x * y) <= -860000000.0) {
		tmp = t_2;
	} else if ((x * y) <= -8.2e-64) {
		tmp = c;
	} else if ((x * y) <= 280000000000.0) {
		tmp = t_1;
	} else if ((x * y) <= 1.1e+202) {
		tmp = t_2;
	} else {
		tmp = x * y;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = b * (a * -0.25)
	t_2 = z * (t * 0.0625)
	tmp = 0
	if (x * y) <= -3.65e+140:
		tmp = x * y
	elif (x * y) <= -3.9e+39:
		tmp = t_1
	elif (x * y) <= -860000000.0:
		tmp = t_2
	elif (x * y) <= -8.2e-64:
		tmp = c
	elif (x * y) <= 280000000000.0:
		tmp = t_1
	elif (x * y) <= 1.1e+202:
		tmp = t_2
	else:
		tmp = x * y
	return tmp
function code(x, y, z, t, a, b, c)
	t_1 = Float64(b * Float64(a * -0.25))
	t_2 = Float64(z * Float64(t * 0.0625))
	tmp = 0.0
	if (Float64(x * y) <= -3.65e+140)
		tmp = Float64(x * y);
	elseif (Float64(x * y) <= -3.9e+39)
		tmp = t_1;
	elseif (Float64(x * y) <= -860000000.0)
		tmp = t_2;
	elseif (Float64(x * y) <= -8.2e-64)
		tmp = c;
	elseif (Float64(x * y) <= 280000000000.0)
		tmp = t_1;
	elseif (Float64(x * y) <= 1.1e+202)
		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 = b * (a * -0.25);
	t_2 = z * (t * 0.0625);
	tmp = 0.0;
	if ((x * y) <= -3.65e+140)
		tmp = x * y;
	elseif ((x * y) <= -3.9e+39)
		tmp = t_1;
	elseif ((x * y) <= -860000000.0)
		tmp = t_2;
	elseif ((x * y) <= -8.2e-64)
		tmp = c;
	elseif ((x * y) <= 280000000000.0)
		tmp = t_1;
	elseif ((x * y) <= 1.1e+202)
		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[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -3.65e+140], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -3.9e+39], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -860000000.0], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], -8.2e-64], c, If[LessEqual[N[(x * y), $MachinePrecision], 280000000000.0], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1.1e+202], t$95$2, N[(x * y), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;x \cdot y \leq -860000000:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \cdot y \leq -8.2 \cdot 10^{-64}:\\
\;\;\;\;c\\

\mathbf{elif}\;x \cdot y \leq 280000000000:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 x y) < -3.6500000000000002e140 or 1.09999999999999989e202 < (*.f64 x y)

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

      \[\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 x around inf 70.2%

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

    if -3.6500000000000002e140 < (*.f64 x y) < -3.9000000000000001e39 or -8.2000000000000001e-64 < (*.f64 x y) < 2.8e11

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

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

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

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

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

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

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

    if -3.9000000000000001e39 < (*.f64 x y) < -8.6e8 or 2.8e11 < (*.f64 x y) < 1.09999999999999989e202

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

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

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

    if -8.6e8 < (*.f64 x y) < -8.2000000000000001e-64

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -3.65 \cdot 10^{+140}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -3.9 \cdot 10^{+39}:\\ \;\;\;\;b \cdot \left(a \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq -860000000:\\ \;\;\;\;z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{elif}\;x \cdot y \leq -8.2 \cdot 10^{-64}:\\ \;\;\;\;c\\ \mathbf{elif}\;x \cdot y \leq 280000000000:\\ \;\;\;\;b \cdot \left(a \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 1.1 \cdot 10^{+202}:\\ \;\;\;\;z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 86.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(a \cdot b\right) \cdot 0.25\\ t_2 := 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+137}:\\ \;\;\;\;t\_2 - t\_1\\ \mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{-126} \lor \neg \left(a \cdot b \leq 10^{-23}\right) \land a \cdot b \leq 5 \cdot 10^{+46}:\\ \;\;\;\;c + \left(x \cdot y + t\_2\right)\\ \mathbf{else}:\\ \;\;\;\;\left(c + x \cdot y\right) - t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (* (* a b) 0.25)) (t_2 (* 0.0625 (* z t))))
   (if (<= (* a b) -1e+137)
     (- t_2 t_1)
     (if (or (<= (* a b) 5e-126)
             (and (not (<= (* a b) 1e-23)) (<= (* a b) 5e+46)))
       (+ c (+ (* x y) t_2))
       (- (+ c (* x y)) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = (a * b) * 0.25;
	double t_2 = 0.0625 * (z * t);
	double tmp;
	if ((a * b) <= -1e+137) {
		tmp = t_2 - t_1;
	} else if (((a * b) <= 5e-126) || (!((a * b) <= 1e-23) && ((a * b) <= 5e+46))) {
		tmp = c + ((x * y) + t_2);
	} else {
		tmp = (c + (x * y)) - 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) :: t_2
    real(8) :: tmp
    t_1 = (a * b) * 0.25d0
    t_2 = 0.0625d0 * (z * t)
    if ((a * b) <= (-1d+137)) then
        tmp = t_2 - t_1
    else if (((a * b) <= 5d-126) .or. (.not. ((a * b) <= 1d-23)) .and. ((a * b) <= 5d+46)) then
        tmp = c + ((x * y) + t_2)
    else
        tmp = (c + (x * y)) - 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 t_2 = 0.0625 * (z * t);
	double tmp;
	if ((a * b) <= -1e+137) {
		tmp = t_2 - t_1;
	} else if (((a * b) <= 5e-126) || (!((a * b) <= 1e-23) && ((a * b) <= 5e+46))) {
		tmp = c + ((x * y) + t_2);
	} else {
		tmp = (c + (x * y)) - t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = (a * b) * 0.25
	t_2 = 0.0625 * (z * t)
	tmp = 0
	if (a * b) <= -1e+137:
		tmp = t_2 - t_1
	elif ((a * b) <= 5e-126) or (not ((a * b) <= 1e-23) and ((a * b) <= 5e+46)):
		tmp = c + ((x * y) + t_2)
	else:
		tmp = (c + (x * y)) - t_1
	return tmp
function code(x, y, z, t, a, b, c)
	t_1 = Float64(Float64(a * b) * 0.25)
	t_2 = Float64(0.0625 * Float64(z * t))
	tmp = 0.0
	if (Float64(a * b) <= -1e+137)
		tmp = Float64(t_2 - t_1);
	elseif ((Float64(a * b) <= 5e-126) || (!(Float64(a * b) <= 1e-23) && (Float64(a * b) <= 5e+46)))
		tmp = Float64(c + Float64(Float64(x * y) + t_2));
	else
		tmp = Float64(Float64(c + Float64(x * y)) - t_1);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	t_1 = (a * b) * 0.25;
	t_2 = 0.0625 * (z * t);
	tmp = 0.0;
	if ((a * b) <= -1e+137)
		tmp = t_2 - t_1;
	elseif (((a * b) <= 5e-126) || (~(((a * b) <= 1e-23)) && ((a * b) <= 5e+46)))
		tmp = c + ((x * y) + t_2);
	else
		tmp = (c + (x * y)) - 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]}, Block[{t$95$2 = N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1e+137], N[(t$95$2 - t$95$1), $MachinePrecision], If[Or[LessEqual[N[(a * b), $MachinePrecision], 5e-126], And[N[Not[LessEqual[N[(a * b), $MachinePrecision], 1e-23]], $MachinePrecision], LessEqual[N[(a * b), $MachinePrecision], 5e+46]]], N[(c + N[(N[(x * y), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{-126} \lor \neg \left(a \cdot b \leq 10^{-23}\right) \land a \cdot b \leq 5 \cdot 10^{+46}:\\
\;\;\;\;c + \left(x \cdot y + t\_2\right)\\

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


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

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

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

    if -1e137 < (*.f64 a b) < 5.00000000000000006e-126 or 9.9999999999999996e-24 < (*.f64 a b) < 5.0000000000000002e46

    1. Initial program 97.7%

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

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

    if 5.00000000000000006e-126 < (*.f64 a b) < 9.9999999999999996e-24 or 5.0000000000000002e46 < (*.f64 a b)

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

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

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

Alternative 5: 65.8% accurate, 0.5× 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 -2 \cdot 10^{+132}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 10000000000:\\ \;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 10^{+187}:\\ \;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+290}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \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) -2e+132)
     t_1
     (if (<= (* x y) 10000000000.0)
       (+ c (* b (* a -0.25)))
       (if (<= (* x y) 1e+187)
         (+ c (* 0.0625 (* z t)))
         (if (<= (* x y) 5e+290) t_1 (* x y)))))))
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) <= -2e+132) {
		tmp = t_1;
	} else if ((x * y) <= 10000000000.0) {
		tmp = c + (b * (a * -0.25));
	} else if ((x * y) <= 1e+187) {
		tmp = c + (0.0625 * (z * t));
	} else if ((x * y) <= 5e+290) {
		tmp = t_1;
	} 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) :: tmp
    t_1 = (x * y) - ((a * b) * 0.25d0)
    if ((x * y) <= (-2d+132)) then
        tmp = t_1
    else if ((x * y) <= 10000000000.0d0) then
        tmp = c + (b * (a * (-0.25d0)))
    else if ((x * y) <= 1d+187) then
        tmp = c + (0.0625d0 * (z * t))
    else if ((x * y) <= 5d+290) then
        tmp = t_1
    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 = (x * y) - ((a * b) * 0.25);
	double tmp;
	if ((x * y) <= -2e+132) {
		tmp = t_1;
	} else if ((x * y) <= 10000000000.0) {
		tmp = c + (b * (a * -0.25));
	} else if ((x * y) <= 1e+187) {
		tmp = c + (0.0625 * (z * t));
	} else if ((x * y) <= 5e+290) {
		tmp = t_1;
	} else {
		tmp = x * y;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = (x * y) - ((a * b) * 0.25)
	tmp = 0
	if (x * y) <= -2e+132:
		tmp = t_1
	elif (x * y) <= 10000000000.0:
		tmp = c + (b * (a * -0.25))
	elif (x * y) <= 1e+187:
		tmp = c + (0.0625 * (z * t))
	elif (x * y) <= 5e+290:
		tmp = t_1
	else:
		tmp = x * y
	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) <= -2e+132)
		tmp = t_1;
	elseif (Float64(x * y) <= 10000000000.0)
		tmp = Float64(c + Float64(b * Float64(a * -0.25)));
	elseif (Float64(x * y) <= 1e+187)
		tmp = Float64(c + Float64(0.0625 * Float64(z * t)));
	elseif (Float64(x * y) <= 5e+290)
		tmp = t_1;
	else
		tmp = Float64(x * y);
	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) <= -2e+132)
		tmp = t_1;
	elseif ((x * y) <= 10000000000.0)
		tmp = c + (b * (a * -0.25));
	elseif ((x * y) <= 1e+187)
		tmp = c + (0.0625 * (z * t));
	elseif ((x * y) <= 5e+290)
		tmp = t_1;
	else
		tmp = x * y;
	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], -2e+132], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 10000000000.0], N[(c + N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+187], N[(c + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+290], t$95$1, N[(x * y), $MachinePrecision]]]]]]
\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 -2 \cdot 10^{+132}:\\
\;\;\;\;t\_1\\

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 x y) < -1.99999999999999998e132 or 9.99999999999999907e186 < (*.f64 x y) < 4.9999999999999998e290

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

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

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

    if -1.99999999999999998e132 < (*.f64 x y) < 1e10

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

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

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

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

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

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

    if 1e10 < (*.f64 x y) < 9.99999999999999907e186

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

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

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

    if 4.9999999999999998e290 < (*.f64 x y)

    1. Initial program 85.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 74.9%

      \[\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 x around inf 90.0%

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

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

Alternative 6: 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}:\\ \;\;\;\;0.0625 \cdot \left(z \cdot t\right) - \left(a \cdot b\right) \cdot 0.25\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0))))
   (if (<= t_1 INFINITY) (+ c t_1) (- (* 0.0625 (* z t)) (* (* a b) 0.25)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = ((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0);
	double tmp;
	if (t_1 <= ((double) INFINITY)) {
		tmp = c + t_1;
	} else {
		tmp = (0.0625 * (z * t)) - ((a * b) * 0.25);
	}
	return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = ((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0);
	double tmp;
	if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = c + t_1;
	} else {
		tmp = (0.0625 * (z * t)) - ((a * b) * 0.25);
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = ((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)
	tmp = 0
	if t_1 <= math.inf:
		tmp = c + t_1
	else:
		tmp = (0.0625 * (z * t)) - ((a * b) * 0.25)
	return tmp
function code(x, y, z, t, a, b, c)
	t_1 = Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0))
	tmp = 0.0
	if (t_1 <= Inf)
		tmp = Float64(c + t_1);
	else
		tmp = Float64(Float64(0.0625 * Float64(z * t)) - Float64(Float64(a * b) * 0.25));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	t_1 = ((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0);
	tmp = 0.0;
	if (t_1 <= Inf)
		tmp = c + t_1;
	else
		tmp = (0.0625 * (z * t)) - ((a * b) * 0.25);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], N[(c + t$95$1), $MachinePrecision], N[(N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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


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

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

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

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

Alternative 7: 54.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := c + x \cdot y\\ t_2 := b \cdot \left(a \cdot -0.25\right)\\ \mathbf{if}\;b \leq -1.25 \cdot 10^{+54}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;b \leq 1.55 \cdot 10^{-209}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;b \leq 5.1 \cdot 10^{-40}:\\ \;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;b \leq 2.4 \cdot 10^{+49} \lor \neg \left(b \leq 5 \cdot 10^{+98}\right) \land b \leq 1.4 \cdot 10^{+158}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (+ c (* x y))) (t_2 (* b (* a -0.25))))
   (if (<= b -1.25e+54)
     t_2
     (if (<= b 1.55e-209)
       t_1
       (if (<= b 5.1e-40)
         (+ c (* 0.0625 (* z t)))
         (if (or (<= b 2.4e+49) (and (not (<= b 5e+98)) (<= b 1.4e+158)))
           t_1
           t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = c + (x * y);
	double t_2 = b * (a * -0.25);
	double tmp;
	if (b <= -1.25e+54) {
		tmp = t_2;
	} else if (b <= 1.55e-209) {
		tmp = t_1;
	} else if (b <= 5.1e-40) {
		tmp = c + (0.0625 * (z * t));
	} else if ((b <= 2.4e+49) || (!(b <= 5e+98) && (b <= 1.4e+158))) {
		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 + (x * y)
    t_2 = b * (a * (-0.25d0))
    if (b <= (-1.25d+54)) then
        tmp = t_2
    else if (b <= 1.55d-209) then
        tmp = t_1
    else if (b <= 5.1d-40) then
        tmp = c + (0.0625d0 * (z * t))
    else if ((b <= 2.4d+49) .or. (.not. (b <= 5d+98)) .and. (b <= 1.4d+158)) 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 + (x * y);
	double t_2 = b * (a * -0.25);
	double tmp;
	if (b <= -1.25e+54) {
		tmp = t_2;
	} else if (b <= 1.55e-209) {
		tmp = t_1;
	} else if (b <= 5.1e-40) {
		tmp = c + (0.0625 * (z * t));
	} else if ((b <= 2.4e+49) || (!(b <= 5e+98) && (b <= 1.4e+158))) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = c + (x * y)
	t_2 = b * (a * -0.25)
	tmp = 0
	if b <= -1.25e+54:
		tmp = t_2
	elif b <= 1.55e-209:
		tmp = t_1
	elif b <= 5.1e-40:
		tmp = c + (0.0625 * (z * t))
	elif (b <= 2.4e+49) or (not (b <= 5e+98) and (b <= 1.4e+158)):
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b, c)
	t_1 = Float64(c + Float64(x * y))
	t_2 = Float64(b * Float64(a * -0.25))
	tmp = 0.0
	if (b <= -1.25e+54)
		tmp = t_2;
	elseif (b <= 1.55e-209)
		tmp = t_1;
	elseif (b <= 5.1e-40)
		tmp = Float64(c + Float64(0.0625 * Float64(z * t)));
	elseif ((b <= 2.4e+49) || (!(b <= 5e+98) && (b <= 1.4e+158)))
		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 + (x * y);
	t_2 = b * (a * -0.25);
	tmp = 0.0;
	if (b <= -1.25e+54)
		tmp = t_2;
	elseif (b <= 1.55e-209)
		tmp = t_1;
	elseif (b <= 5.1e-40)
		tmp = c + (0.0625 * (z * t));
	elseif ((b <= 2.4e+49) || (~((b <= 5e+98)) && (b <= 1.4e+158)))
		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[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.25e+54], t$95$2, If[LessEqual[b, 1.55e-209], t$95$1, If[LessEqual[b, 5.1e-40], N[(c + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 2.4e+49], And[N[Not[LessEqual[b, 5e+98]], $MachinePrecision], LessEqual[b, 1.4e+158]]], t$95$1, t$95$2]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;b \leq 1.55 \cdot 10^{-209}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;b \leq 5.1 \cdot 10^{-40}:\\
\;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\

\mathbf{elif}\;b \leq 2.4 \cdot 10^{+49} \lor \neg \left(b \leq 5 \cdot 10^{+98}\right) \land b \leq 1.4 \cdot 10^{+158}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -1.25000000000000001e54 or 2.4e49 < b < 4.9999999999999998e98 or 1.40000000000000001e158 < b

    1. Initial program 94.9%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 75.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 a around inf 63.3%

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

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

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

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

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

    if -1.25000000000000001e54 < b < 1.55e-209 or 5.10000000000000037e-40 < b < 2.4e49 or 4.9999999999999998e98 < b < 1.40000000000000001e158

    1. Initial program 97.5%

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

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

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

    if 1.55e-209 < b < 5.10000000000000037e-40

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.25 \cdot 10^{+54}:\\ \;\;\;\;b \cdot \left(a \cdot -0.25\right)\\ \mathbf{elif}\;b \leq 1.55 \cdot 10^{-209}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{elif}\;b \leq 5.1 \cdot 10^{-40}:\\ \;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;b \leq 2.4 \cdot 10^{+49} \lor \neg \left(b \leq 5 \cdot 10^{+98}\right) \land b \leq 1.4 \cdot 10^{+158}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;b \cdot \left(a \cdot -0.25\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 64.7% accurate, 0.6× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -2e145 or 1.9999999999999998e202 < (*.f64 x y)

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

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

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

    if -2e145 < (*.f64 x y) < 1e10

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

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

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

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

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

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

    if 1e10 < (*.f64 x y) < 1.9999999999999998e202

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

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

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

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

Alternative 9: 54.0% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.5 \cdot 10^{+54} \lor \neg \left(b \leq 3.6 \cdot 10^{+50}\right) \land \left(b \leq 2.7 \cdot 10^{+99} \lor \neg \left(b \leq 4.5 \cdot 10^{+158}\right)\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.5e+54)
         (and (not (<= b 3.6e+50)) (or (<= b 2.7e+99) (not (<= b 4.5e+158)))))
   (* 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.5e+54) || (!(b <= 3.6e+50) && ((b <= 2.7e+99) || !(b <= 4.5e+158)))) {
		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.5d+54)) .or. (.not. (b <= 3.6d+50)) .and. (b <= 2.7d+99) .or. (.not. (b <= 4.5d+158))) 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.5e+54) || (!(b <= 3.6e+50) && ((b <= 2.7e+99) || !(b <= 4.5e+158)))) {
		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.5e+54) or (not (b <= 3.6e+50) and ((b <= 2.7e+99) or not (b <= 4.5e+158))):
		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.5e+54) || (!(b <= 3.6e+50) && ((b <= 2.7e+99) || !(b <= 4.5e+158))))
		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.5e+54) || (~((b <= 3.6e+50)) && ((b <= 2.7e+99) || ~((b <= 4.5e+158)))))
		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.5e+54], And[N[Not[LessEqual[b, 3.6e+50]], $MachinePrecision], Or[LessEqual[b, 2.7e+99], N[Not[LessEqual[b, 4.5e+158]], $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.5 \cdot 10^{+54} \lor \neg \left(b \leq 3.6 \cdot 10^{+50}\right) \land \left(b \leq 2.7 \cdot 10^{+99} \lor \neg \left(b \leq 4.5 \cdot 10^{+158}\right)\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.4999999999999999e54 or 3.59999999999999986e50 < b < 2.69999999999999989e99 or 4.50000000000000046e158 < b

    1. Initial program 94.9%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 75.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 a around inf 63.3%

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

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

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

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

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

    if -1.4999999999999999e54 < b < 3.59999999999999986e50 or 2.69999999999999989e99 < b < 4.50000000000000046e158

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.5 \cdot 10^{+54} \lor \neg \left(b \leq 3.6 \cdot 10^{+50}\right) \land \left(b \leq 2.7 \cdot 10^{+99} \lor \neg \left(b \leq 4.5 \cdot 10^{+158}\right)\right):\\ \;\;\;\;b \cdot \left(a \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;c + x \cdot y\\ \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 -5 \cdot 10^{+158} \lor \neg \left(a \cdot b \leq 5 \cdot 10^{+93}\right):\\ \;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (if (or (<= (* a b) -5e+158) (not (<= (* a b) 5e+93)))
   (+ c (* b (* a -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+158) || !((a * b) <= 5e+93)) {
		tmp = c + (b * (a * -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+158)) .or. (.not. ((a * b) <= 5d+93))) then
        tmp = c + (b * (a * (-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+158) || !((a * b) <= 5e+93)) {
		tmp = c + (b * (a * -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+158) or not ((a * b) <= 5e+93):
		tmp = c + (b * (a * -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+158) || !(Float64(a * b) <= 5e+93))
		tmp = Float64(c + Float64(b * Float64(a * -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+158) || ~(((a * b) <= 5e+93)))
		tmp = c + (b * (a * -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+158], N[Not[LessEqual[N[(a * b), $MachinePrecision], 5e+93]], $MachinePrecision]], N[(c + N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(x * y), $MachinePrecision] + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -4.9999999999999996e158 or 5.0000000000000001e93 < (*.f64 a b)

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

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

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

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

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

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

    if -4.9999999999999996e158 < (*.f64 a b) < 5.0000000000000001e93

    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 0 86.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 simplification85.4%

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

Alternative 11: 85.8% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+93}:\\
\;\;\;\;c + \left(x \cdot y + t\_1\right)\\

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


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

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

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

    if -1e137 < (*.f64 a b) < 5.0000000000000001e93

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

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

    if 5.0000000000000001e93 < (*.f64 a b)

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

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

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

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

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

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

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

Alternative 12: 66.4% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -2e145 or 2e133 < (*.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 a around 0 76.7%

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

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

    if -2e145 < (*.f64 x y) < 2e133

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

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

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

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

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

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

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

Alternative 13: 82.4% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;x \leq 1.6 \cdot 10^{-77}:\\
\;\;\;\;\left(c + t\_2\right) - t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.0999999999999999e179

    1. Initial program 80.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 88.0%

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

    if -2.0999999999999999e179 < x < 1.6e-77

    1. Initial program 98.5%

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

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

    if 1.6e-77 < x

    1. Initial program 98.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.1 \cdot 10^{+179}:\\ \;\;\;\;\left(c + x \cdot y\right) - \left(a \cdot b\right) \cdot 0.25\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{-77}:\\ \;\;\;\;\left(c + 0.0625 \cdot \left(z \cdot t\right)\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 14: 44.2% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -7.5 \cdot 10^{+142} \lor \neg \left(x \cdot y \leq 1.1 \cdot 10^{+202}\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) -7.5e+142) (not (<= (* x y) 1.1e+202)))
   (* 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) <= -7.5e+142) || !((x * y) <= 1.1e+202)) {
		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) <= (-7.5d+142)) .or. (.not. ((x * y) <= 1.1d+202))) 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) <= -7.5e+142) || !((x * y) <= 1.1e+202)) {
		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) <= -7.5e+142) or not ((x * y) <= 1.1e+202):
		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) <= -7.5e+142) || !(Float64(x * y) <= 1.1e+202))
		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) <= -7.5e+142) || ~(((x * y) <= 1.1e+202)))
		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], -7.5e+142], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1.1e+202]], $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 -7.5 \cdot 10^{+142} \lor \neg \left(x \cdot y \leq 1.1 \cdot 10^{+202}\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) < -7.5000000000000002e142 or 1.09999999999999989e202 < (*.f64 x y)

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

      \[\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 x around inf 70.2%

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

    if -7.5000000000000002e142 < (*.f64 x y) < 1.09999999999999989e202

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

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

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

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

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

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

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

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

Alternative 15: 41.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -3.2 \cdot 10^{+135} \lor \neg \left(x \cdot y \leq 1.35 \cdot 10^{+97}\right):\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -3.19999999999999975e135 or 1.34999999999999997e97 < (*.f64 x y)

    1. Initial program 90.0%

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

      \[\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 x around inf 61.4%

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

    if -3.19999999999999975e135 < (*.f64 x y) < 1.34999999999999997e97

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

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

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

Alternative 16: 22.2% accurate, 17.0× speedup?

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

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

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

Reproduce

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