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

Percentage Accurate: 97.7% → 98.6%
Time: 11.0s
Alternatives: 13
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 13 alternatives:

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

Initial Program: 97.7% accurate, 1.0× speedup?

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

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

Alternative 1: 98.6% accurate, 0.5× speedup?

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

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

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


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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4} \leq \infty:\\ \;\;\;\;c + \left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right)\\ \mathbf{else}:\\ \;\;\;\;c + x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 98.8% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

    \[\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 3: 98.1% 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.5%

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

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

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

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

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

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

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

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

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

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

Alternative 4: 66.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := c + a \cdot \left(b \cdot -0.25\right)\\ t_2 := 0.0625 \cdot \left(z \cdot t\right)\\ t_3 := c + t\_2\\ t_4 := x \cdot y + t\_2\\ \mathbf{if}\;x \cdot y \leq -3.2 \cdot 10^{+135}:\\ \;\;\;\;t\_4\\ \mathbf{elif}\;x \cdot y \leq -2.1 \cdot 10^{-33}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq -3.6 \cdot 10^{-56}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;x \cdot y \leq 8.2 \cdot 10^{-178}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 1.4 \cdot 10^{-66}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;x \cdot y \leq 6.8 \cdot 10^{+92}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_4\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (+ c (* a (* b -0.25))))
        (t_2 (* 0.0625 (* z t)))
        (t_3 (+ c t_2))
        (t_4 (+ (* x y) t_2)))
   (if (<= (* x y) -3.2e+135)
     t_4
     (if (<= (* x y) -2.1e-33)
       t_1
       (if (<= (* x y) -3.6e-56)
         t_3
         (if (<= (* x y) 8.2e-178)
           t_1
           (if (<= (* x y) 1.4e-66)
             t_3
             (if (<= (* x y) 6.8e+92) t_1 t_4))))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = c + (a * (b * -0.25));
	double t_2 = 0.0625 * (z * t);
	double t_3 = c + t_2;
	double t_4 = (x * y) + t_2;
	double tmp;
	if ((x * y) <= -3.2e+135) {
		tmp = t_4;
	} else if ((x * y) <= -2.1e-33) {
		tmp = t_1;
	} else if ((x * y) <= -3.6e-56) {
		tmp = t_3;
	} else if ((x * y) <= 8.2e-178) {
		tmp = t_1;
	} else if ((x * y) <= 1.4e-66) {
		tmp = t_3;
	} else if ((x * y) <= 6.8e+92) {
		tmp = t_1;
	} else {
		tmp = t_4;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_1 = c + (a * (b * (-0.25d0)))
    t_2 = 0.0625d0 * (z * t)
    t_3 = c + t_2
    t_4 = (x * y) + t_2
    if ((x * y) <= (-3.2d+135)) then
        tmp = t_4
    else if ((x * y) <= (-2.1d-33)) then
        tmp = t_1
    else if ((x * y) <= (-3.6d-56)) then
        tmp = t_3
    else if ((x * y) <= 8.2d-178) then
        tmp = t_1
    else if ((x * y) <= 1.4d-66) then
        tmp = t_3
    else if ((x * y) <= 6.8d+92) then
        tmp = t_1
    else
        tmp = t_4
    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 + (a * (b * -0.25));
	double t_2 = 0.0625 * (z * t);
	double t_3 = c + t_2;
	double t_4 = (x * y) + t_2;
	double tmp;
	if ((x * y) <= -3.2e+135) {
		tmp = t_4;
	} else if ((x * y) <= -2.1e-33) {
		tmp = t_1;
	} else if ((x * y) <= -3.6e-56) {
		tmp = t_3;
	} else if ((x * y) <= 8.2e-178) {
		tmp = t_1;
	} else if ((x * y) <= 1.4e-66) {
		tmp = t_3;
	} else if ((x * y) <= 6.8e+92) {
		tmp = t_1;
	} else {
		tmp = t_4;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = c + (a * (b * -0.25))
	t_2 = 0.0625 * (z * t)
	t_3 = c + t_2
	t_4 = (x * y) + t_2
	tmp = 0
	if (x * y) <= -3.2e+135:
		tmp = t_4
	elif (x * y) <= -2.1e-33:
		tmp = t_1
	elif (x * y) <= -3.6e-56:
		tmp = t_3
	elif (x * y) <= 8.2e-178:
		tmp = t_1
	elif (x * y) <= 1.4e-66:
		tmp = t_3
	elif (x * y) <= 6.8e+92:
		tmp = t_1
	else:
		tmp = t_4
	return tmp
function code(x, y, z, t, a, b, c)
	t_1 = Float64(c + Float64(a * Float64(b * -0.25)))
	t_2 = Float64(0.0625 * Float64(z * t))
	t_3 = Float64(c + t_2)
	t_4 = Float64(Float64(x * y) + t_2)
	tmp = 0.0
	if (Float64(x * y) <= -3.2e+135)
		tmp = t_4;
	elseif (Float64(x * y) <= -2.1e-33)
		tmp = t_1;
	elseif (Float64(x * y) <= -3.6e-56)
		tmp = t_3;
	elseif (Float64(x * y) <= 8.2e-178)
		tmp = t_1;
	elseif (Float64(x * y) <= 1.4e-66)
		tmp = t_3;
	elseif (Float64(x * y) <= 6.8e+92)
		tmp = t_1;
	else
		tmp = t_4;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	t_1 = c + (a * (b * -0.25));
	t_2 = 0.0625 * (z * t);
	t_3 = c + t_2;
	t_4 = (x * y) + t_2;
	tmp = 0.0;
	if ((x * y) <= -3.2e+135)
		tmp = t_4;
	elseif ((x * y) <= -2.1e-33)
		tmp = t_1;
	elseif ((x * y) <= -3.6e-56)
		tmp = t_3;
	elseif ((x * y) <= 8.2e-178)
		tmp = t_1;
	elseif ((x * y) <= 1.4e-66)
		tmp = t_3;
	elseif ((x * y) <= 6.8e+92)
		tmp = t_1;
	else
		tmp = t_4;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(c + t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(N[(x * y), $MachinePrecision] + t$95$2), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -3.2e+135], t$95$4, If[LessEqual[N[(x * y), $MachinePrecision], -2.1e-33], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -3.6e-56], t$95$3, If[LessEqual[N[(x * y), $MachinePrecision], 8.2e-178], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1.4e-66], t$95$3, If[LessEqual[N[(x * y), $MachinePrecision], 6.8e+92], t$95$1, t$95$4]]]]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;x \cdot y \leq -3.6 \cdot 10^{-56}:\\
\;\;\;\;t\_3\\

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

\mathbf{elif}\;x \cdot y \leq 1.4 \cdot 10^{-66}:\\
\;\;\;\;t\_3\\

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

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


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

    1. Initial program 92.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 80.9%

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

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

    if -3.19999999999999975e135 < (*.f64 x y) < -2.1e-33 or -3.59999999999999978e-56 < (*.f64 x y) < 8.1999999999999998e-178 or 1.4e-66 < (*.f64 x y) < 6.7999999999999996e92

    1. Initial program 98.6%

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

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

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

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

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

    if -2.1e-33 < (*.f64 x y) < -3.59999999999999978e-56 or 8.1999999999999998e-178 < (*.f64 x y) < 1.4e-66

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -3.2 \cdot 10^{+135}:\\ \;\;\;\;x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq -2.1 \cdot 10^{-33}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq -3.6 \cdot 10^{-56}:\\ \;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq 8.2 \cdot 10^{-178}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 1.4 \cdot 10^{-66}:\\ \;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq 6.8 \cdot 10^{+92}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 64.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := c + a \cdot \left(b \cdot -0.25\right)\\ t_2 := c + 0.0625 \cdot \left(z \cdot t\right)\\ t_3 := c + x \cdot y\\ \mathbf{if}\;x \cdot y \leq -2.42 \cdot 10^{+182}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;x \cdot y \leq -1.36 \cdot 10^{-33}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq -4.9 \cdot 10^{-54}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \cdot y \leq 8 \cdot 10^{-183}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 2.6 \cdot 10^{-65}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \cdot y \leq 5.2 \cdot 10^{+116}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (+ c (* a (* b -0.25))))
        (t_2 (+ c (* 0.0625 (* z t))))
        (t_3 (+ c (* x y))))
   (if (<= (* x y) -2.42e+182)
     t_3
     (if (<= (* x y) -1.36e-33)
       t_1
       (if (<= (* x y) -4.9e-54)
         t_2
         (if (<= (* x y) 8e-183)
           t_1
           (if (<= (* x y) 2.6e-65)
             t_2
             (if (<= (* x y) 5.2e+116) t_1 t_3))))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = c + (a * (b * -0.25));
	double t_2 = c + (0.0625 * (z * t));
	double t_3 = c + (x * y);
	double tmp;
	if ((x * y) <= -2.42e+182) {
		tmp = t_3;
	} else if ((x * y) <= -1.36e-33) {
		tmp = t_1;
	} else if ((x * y) <= -4.9e-54) {
		tmp = t_2;
	} else if ((x * y) <= 8e-183) {
		tmp = t_1;
	} else if ((x * y) <= 2.6e-65) {
		tmp = t_2;
	} else if ((x * y) <= 5.2e+116) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = c + (a * (b * (-0.25d0)))
    t_2 = c + (0.0625d0 * (z * t))
    t_3 = c + (x * y)
    if ((x * y) <= (-2.42d+182)) then
        tmp = t_3
    else if ((x * y) <= (-1.36d-33)) then
        tmp = t_1
    else if ((x * y) <= (-4.9d-54)) then
        tmp = t_2
    else if ((x * y) <= 8d-183) then
        tmp = t_1
    else if ((x * y) <= 2.6d-65) then
        tmp = t_2
    else if ((x * y) <= 5.2d+116) then
        tmp = t_1
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = c + (a * (b * -0.25));
	double t_2 = c + (0.0625 * (z * t));
	double t_3 = c + (x * y);
	double tmp;
	if ((x * y) <= -2.42e+182) {
		tmp = t_3;
	} else if ((x * y) <= -1.36e-33) {
		tmp = t_1;
	} else if ((x * y) <= -4.9e-54) {
		tmp = t_2;
	} else if ((x * y) <= 8e-183) {
		tmp = t_1;
	} else if ((x * y) <= 2.6e-65) {
		tmp = t_2;
	} else if ((x * y) <= 5.2e+116) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = c + (a * (b * -0.25))
	t_2 = c + (0.0625 * (z * t))
	t_3 = c + (x * y)
	tmp = 0
	if (x * y) <= -2.42e+182:
		tmp = t_3
	elif (x * y) <= -1.36e-33:
		tmp = t_1
	elif (x * y) <= -4.9e-54:
		tmp = t_2
	elif (x * y) <= 8e-183:
		tmp = t_1
	elif (x * y) <= 2.6e-65:
		tmp = t_2
	elif (x * y) <= 5.2e+116:
		tmp = t_1
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t, a, b, c)
	t_1 = Float64(c + Float64(a * Float64(b * -0.25)))
	t_2 = Float64(c + Float64(0.0625 * Float64(z * t)))
	t_3 = Float64(c + Float64(x * y))
	tmp = 0.0
	if (Float64(x * y) <= -2.42e+182)
		tmp = t_3;
	elseif (Float64(x * y) <= -1.36e-33)
		tmp = t_1;
	elseif (Float64(x * y) <= -4.9e-54)
		tmp = t_2;
	elseif (Float64(x * y) <= 8e-183)
		tmp = t_1;
	elseif (Float64(x * y) <= 2.6e-65)
		tmp = t_2;
	elseif (Float64(x * y) <= 5.2e+116)
		tmp = t_1;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	t_1 = c + (a * (b * -0.25));
	t_2 = c + (0.0625 * (z * t));
	t_3 = c + (x * y);
	tmp = 0.0;
	if ((x * y) <= -2.42e+182)
		tmp = t_3;
	elseif ((x * y) <= -1.36e-33)
		tmp = t_1;
	elseif ((x * y) <= -4.9e-54)
		tmp = t_2;
	elseif ((x * y) <= 8e-183)
		tmp = t_1;
	elseif ((x * y) <= 2.6e-65)
		tmp = t_2;
	elseif ((x * y) <= 5.2e+116)
		tmp = t_1;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2.42e+182], t$95$3, If[LessEqual[N[(x * y), $MachinePrecision], -1.36e-33], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -4.9e-54], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 8e-183], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2.6e-65], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 5.2e+116], t$95$1, t$95$3]]]]]]]]]
\begin{array}{l}

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

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -2.42000000000000005e182 or 5.19999999999999973e116 < (*.f64 x y)

    1. Initial program 92.1%

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

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

    if -2.42000000000000005e182 < (*.f64 x y) < -1.36e-33 or -4.90000000000000021e-54 < (*.f64 x y) < 8.00000000000000004e-183 or 2.6000000000000001e-65 < (*.f64 x y) < 5.19999999999999973e116

    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.3%

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

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

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

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

    if -1.36e-33 < (*.f64 x y) < -4.90000000000000021e-54 or 8.00000000000000004e-183 < (*.f64 x y) < 2.6000000000000001e-65

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2.42 \cdot 10^{+182}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -1.36 \cdot 10^{-33}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq -4.9 \cdot 10^{-54}:\\ \;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq 8 \cdot 10^{-183}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 2.6 \cdot 10^{-65}:\\ \;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq 5.2 \cdot 10^{+116}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;c + x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 88.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+114} \lor \neg \left(a \cdot b \leq 5 \cdot 10^{-20} \lor \neg \left(a \cdot b \leq 0.001\right) \land a \cdot b \leq 10^{+160}\right):\\ \;\;\;\;c + \left(x \cdot y - \left(a \cdot b\right) \cdot 0.25\right)\\ \mathbf{else}:\\ \;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (if (or (<= (* a b) -2e+114)
         (not
          (or (<= (* a b) 5e-20)
              (and (not (<= (* a b) 0.001)) (<= (* a b) 1e+160)))))
   (+ 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) <= -2e+114) || !(((a * b) <= 5e-20) || (!((a * b) <= 0.001) && ((a * b) <= 1e+160)))) {
		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) <= (-2d+114)) .or. (.not. ((a * b) <= 5d-20) .or. (.not. ((a * b) <= 0.001d0)) .and. ((a * b) <= 1d+160))) 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) <= -2e+114) || !(((a * b) <= 5e-20) || (!((a * b) <= 0.001) && ((a * b) <= 1e+160)))) {
		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) <= -2e+114) or not (((a * b) <= 5e-20) or (not ((a * b) <= 0.001) and ((a * b) <= 1e+160))):
		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) <= -2e+114) || !((Float64(a * b) <= 5e-20) || (!(Float64(a * b) <= 0.001) && (Float64(a * b) <= 1e+160))))
		tmp = Float64(c + Float64(Float64(x * y) - Float64(Float64(a * b) * 0.25)));
	else
		tmp = Float64(c + Float64(Float64(x * y) + Float64(0.0625 * Float64(z * t))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	tmp = 0.0;
	if (((a * b) <= -2e+114) || ~((((a * b) <= 5e-20) || (~(((a * b) <= 0.001)) && ((a * b) <= 1e+160)))))
		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], -2e+114], N[Not[Or[LessEqual[N[(a * b), $MachinePrecision], 5e-20], And[N[Not[LessEqual[N[(a * b), $MachinePrecision], 0.001]], $MachinePrecision], LessEqual[N[(a * b), $MachinePrecision], 1e+160]]]], $MachinePrecision]], N[(c + N[(N[(x * y), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(x * y), $MachinePrecision] + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+114} \lor \neg \left(a \cdot b \leq 5 \cdot 10^{-20} \lor \neg \left(a \cdot b \leq 0.001\right) \land a \cdot b \leq 10^{+160}\right):\\
\;\;\;\;c + \left(x \cdot y - \left(a \cdot b\right) \cdot 0.25\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -2e114 or 4.9999999999999999e-20 < (*.f64 a b) < 1e-3 or 1.00000000000000001e160 < (*.f64 a b)

    1. Initial program 92.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 90.9%

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

    if -2e114 < (*.f64 a b) < 4.9999999999999999e-20 or 1e-3 < (*.f64 a b) < 1.00000000000000001e160

    1. Initial program 98.8%

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

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

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

Alternative 7: 64.6% accurate, 0.5× speedup?

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -2.0999999999999999e74 or 3.59999999999999971e116 < (*.f64 x y)

    1. Initial program 92.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 x around inf 70.3%

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

    if -2.0999999999999999e74 < (*.f64 x y) < -1.8999999999999999e-251 or -5.4999999999999995e-284 < (*.f64 x y) < 3.59999999999999971e116

    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 z around inf 65.2%

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

    if -1.8999999999999999e-251 < (*.f64 x y) < -5.4999999999999995e-284

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2.1 \cdot 10^{+74}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -1.9 \cdot 10^{-251}:\\ \;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq -5.5 \cdot 10^{-284}:\\ \;\;\;\;a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 3.6 \cdot 10^{+116}:\\ \;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;c + x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 89.3% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -6.4999999999999998e75 or 4.9999999999999999e119 < (*.f64 x y)

    1. Initial program 92.4%

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

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

    if -6.4999999999999998e75 < (*.f64 x y) < 4.9999999999999999e119

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

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

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

Alternative 9: 54.6% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.6 \cdot 10^{+178} \lor \neg \left(a \leq -2.2 \cdot 10^{+137}\right) \land \left(a \leq -1.75 \cdot 10^{+102} \lor \neg \left(a \leq 2.45 \cdot 10^{+38}\right)\right):\\
\;\;\;\;a \cdot \left(b \cdot -0.25\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.6e178 or -2.20000000000000015e137 < a < -1.75000000000000005e102 or 2.45000000000000001e38 < a

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

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

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

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

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

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

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

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

    if -1.6e178 < a < -2.20000000000000015e137 or -1.75000000000000005e102 < a < 2.45000000000000001e38

    1. Initial program 96.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.6 \cdot 10^{+178} \lor \neg \left(a \leq -2.2 \cdot 10^{+137}\right) \land \left(a \leq -1.75 \cdot 10^{+102} \lor \neg \left(a \leq 2.45 \cdot 10^{+38}\right)\right):\\ \;\;\;\;a \cdot \left(b \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;c + x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 36.3% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;a \leq -2.02 \cdot 10^{-280}:\\
\;\;\;\;c\\

\mathbf{elif}\;a \leq 6.2 \cdot 10^{-222}:\\
\;\;\;\;z \cdot \left(t \cdot 0.0625\right)\\

\mathbf{elif}\;a \leq 1.15 \cdot 10^{-97}:\\
\;\;\;\;c\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -3.49999999999999986e92 or 1.14999999999999997e-97 < a

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

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

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

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

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

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

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

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

    if -3.49999999999999986e92 < a < -2.0199999999999999e-280 or 6.19999999999999959e-222 < a < 1.14999999999999997e-97

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

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

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

    if -2.0199999999999999e-280 < a < 6.19999999999999959e-222

    1. Initial program 94.7%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -3.5 \cdot 10^{+92}:\\ \;\;\;\;a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;a \leq -2.02 \cdot 10^{-280}:\\ \;\;\;\;c\\ \mathbf{elif}\;a \leq 6.2 \cdot 10^{-222}:\\ \;\;\;\;z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{elif}\;a \leq 1.15 \cdot 10^{-97}:\\ \;\;\;\;c\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(b \cdot -0.25\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 75.9% accurate, 0.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -7.99999999999999996e89

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

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

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

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

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

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

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

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

    if -7.99999999999999996e89 < b < 2.09999999999999998e150

    1. Initial program 98.8%

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

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

    if 2.09999999999999998e150 < b

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

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

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

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

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

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

Alternative 12: 35.9% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.5 \cdot 10^{+92} \lor \neg \left(a \leq 4 \cdot 10^{-97}\right):\\
\;\;\;\;a \cdot \left(b \cdot -0.25\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -3.49999999999999986e92 or 4.00000000000000014e-97 < a

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

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

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

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

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

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

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

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

    if -3.49999999999999986e92 < a < 4.00000000000000014e-97

    1. Initial program 97.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -3.5 \cdot 10^{+92} \lor \neg \left(a \leq 4 \cdot 10^{-97}\right):\\ \;\;\;\;a \cdot \left(b \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;c\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 21.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.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 inf 49.9%

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

    \[\leadsto \color{blue}{c} \]
  5. Final simplification24.8%

    \[\leadsto c \]
  6. Add Preprocessing

Reproduce

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