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

Percentage Accurate: 97.7% → 98.9%
Time: 10.1s
Alternatives: 12
Speedup: 0.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 97.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.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-define99.2%

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

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

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

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

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

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

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

Alternative 2: 98.6% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4} \leq \infty:\\ \;\;\;\;c + \left(\mathsf{fma}\left(x, y, z \cdot \frac{t}{16}\right) - a \cdot \frac{b}{4}\right)\\ \mathbf{else}:\\ \;\;\;\;c + \left(0.0625 \cdot \left(z \cdot t\right) - \left(a \cdot b\right) \cdot 0.25\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (if (<= (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) INFINITY)
   (+ c (- (fma x y (* z (/ t 16.0))) (* a (/ b 4.0))))
   (+ c (- (* 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 tmp;
	if ((((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) <= ((double) INFINITY)) {
		tmp = c + (fma(x, y, (z * (t / 16.0))) - (a * (b / 4.0)));
	} else {
		tmp = c + ((0.0625 * (z * t)) - ((a * b) * 0.25));
	}
	return tmp;
}
function code(x, y, z, t, a, b, c)
	tmp = 0.0
	if (Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) <= Inf)
		tmp = Float64(c + Float64(fma(x, y, Float64(z * Float64(t / 16.0))) - Float64(a * Float64(b / 4.0))));
	else
		tmp = Float64(c + Float64(Float64(0.0625 * Float64(z * t)) - Float64(Float64(a * b) * 0.25)));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision], Infinity], 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], N[(c + N[(N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


\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. Step-by-step derivation
      1. associate-+l-100.0%

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

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

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

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

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

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

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

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

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

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

    \[\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(\mathsf{fma}\left(x, y, z \cdot \frac{t}{16}\right) - a \cdot \frac{b}{4}\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 3: 87.6% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;a \cdot b \leq 10^{+21}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+211}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{+247}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -1.9999999999999999e105 or 1e21 < (*.f64 a b) < 4.9999999999999995e211

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

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

    if -1.9999999999999999e105 < (*.f64 a b) < 1e21 or 4.9999999999999995e211 < (*.f64 a b) < 1.9999999999999999e247

    1. Initial program 99.3%

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

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

    if 1.9999999999999999e247 < (*.f64 a b)

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 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}:\\ \;\;\;\;c + \left(0.0625 \cdot \left(z \cdot t\right) - \left(a \cdot b\right) \cdot 0.25\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0))))
   (if (<= t_1 INFINITY)
     (+ c t_1)
     (+ c (- (* 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 = c + ((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 = c + ((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 = c + ((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(c + 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 = c + ((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[(c + N[(N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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


\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 0 75.0%

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

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

Alternative 5: 36.9% accurate, 0.5× 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^{+163}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq -4.95 \cdot 10^{+95}:\\ \;\;\;\;c\\ \mathbf{elif}\;a \leq -1.8 \cdot 10^{+95} \lor \neg \left(a \leq -3.5 \cdot 10^{+64}\right) \land \left(a \leq -3.1 \cdot 10^{+23} \lor \neg \left(a \leq 2.2 \cdot 10^{-25}\right)\right):\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(t \cdot 0.0625\right)\\ \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+163)
     t_1
     (if (<= a -4.95e+95)
       c
       (if (or (<= a -1.8e+95)
               (and (not (<= a -3.5e+64))
                    (or (<= a -3.1e+23) (not (<= a 2.2e-25)))))
         t_1
         (* z (* t 0.0625)))))))
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+163) {
		tmp = t_1;
	} else if (a <= -4.95e+95) {
		tmp = c;
	} else if ((a <= -1.8e+95) || (!(a <= -3.5e+64) && ((a <= -3.1e+23) || !(a <= 2.2e-25)))) {
		tmp = t_1;
	} else {
		tmp = z * (t * 0.0625);
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_1
    real(8) :: tmp
    t_1 = a * (b * (-0.25d0))
    if (a <= (-3.5d+163)) then
        tmp = t_1
    else if (a <= (-4.95d+95)) then
        tmp = c
    else if ((a <= (-1.8d+95)) .or. (.not. (a <= (-3.5d+64))) .and. (a <= (-3.1d+23)) .or. (.not. (a <= 2.2d-25))) then
        tmp = t_1
    else
        tmp = z * (t * 0.0625d0)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = a * (b * -0.25);
	double tmp;
	if (a <= -3.5e+163) {
		tmp = t_1;
	} else if (a <= -4.95e+95) {
		tmp = c;
	} else if ((a <= -1.8e+95) || (!(a <= -3.5e+64) && ((a <= -3.1e+23) || !(a <= 2.2e-25)))) {
		tmp = t_1;
	} else {
		tmp = z * (t * 0.0625);
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = a * (b * -0.25)
	tmp = 0
	if a <= -3.5e+163:
		tmp = t_1
	elif a <= -4.95e+95:
		tmp = c
	elif (a <= -1.8e+95) or (not (a <= -3.5e+64) and ((a <= -3.1e+23) or not (a <= 2.2e-25))):
		tmp = t_1
	else:
		tmp = z * (t * 0.0625)
	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+163)
		tmp = t_1;
	elseif (a <= -4.95e+95)
		tmp = c;
	elseif ((a <= -1.8e+95) || (!(a <= -3.5e+64) && ((a <= -3.1e+23) || !(a <= 2.2e-25))))
		tmp = t_1;
	else
		tmp = Float64(z * Float64(t * 0.0625));
	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+163)
		tmp = t_1;
	elseif (a <= -4.95e+95)
		tmp = c;
	elseif ((a <= -1.8e+95) || (~((a <= -3.5e+64)) && ((a <= -3.1e+23) || ~((a <= 2.2e-25)))))
		tmp = t_1;
	else
		tmp = z * (t * 0.0625);
	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+163], t$95$1, If[LessEqual[a, -4.95e+95], c, If[Or[LessEqual[a, -1.8e+95], And[N[Not[LessEqual[a, -3.5e+64]], $MachinePrecision], Or[LessEqual[a, -3.1e+23], N[Not[LessEqual[a, 2.2e-25]], $MachinePrecision]]]], t$95$1, N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;a \leq -4.95 \cdot 10^{+95}:\\
\;\;\;\;c\\

\mathbf{elif}\;a \leq -1.8 \cdot 10^{+95} \lor \neg \left(a \leq -3.5 \cdot 10^{+64}\right) \land \left(a \leq -3.1 \cdot 10^{+23} \lor \neg \left(a \leq 2.2 \cdot 10^{-25}\right)\right):\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;z \cdot \left(t \cdot 0.0625\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -3.5000000000000003e163 or -4.9499999999999998e95 < a < -1.79999999999999989e95 or -3.4999999999999999e64 < a < -3.09999999999999971e23 or 2.2000000000000002e-25 < a

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

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

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

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

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

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

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

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

        \[\leadsto a \cdot \color{blue}{\left(-0.25 \cdot b\right)} \]
    8. Simplified51.1%

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

    if -3.5000000000000003e163 < a < -4.9499999999999998e95

    1. Initial program 94.0%

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

      \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right)} + c \]
    4. Step-by-step derivation
      1. *-commutative48.3%

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

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

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

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

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

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

    if -1.79999999999999989e95 < a < -3.4999999999999999e64 or -3.09999999999999971e23 < a < 2.2000000000000002e-25

    1. Initial program 99.2%

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

      \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right)} + c \]
    4. Step-by-step derivation
      1. *-commutative50.7%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot \left(0.0625 \cdot t\right)} \]
    8. Simplified27.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -3.5 \cdot 10^{+163}:\\ \;\;\;\;a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;a \leq -4.95 \cdot 10^{+95}:\\ \;\;\;\;c\\ \mathbf{elif}\;a \leq -1.8 \cdot 10^{+95} \lor \neg \left(a \leq -3.5 \cdot 10^{+64}\right) \land \left(a \leq -3.1 \cdot 10^{+23} \lor \neg \left(a \leq 2.2 \cdot 10^{-25}\right)\right):\\ \;\;\;\;a \cdot \left(b \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(t \cdot 0.0625\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 61.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := c + a \cdot \left(b \cdot -0.25\right)\\ t_2 := c + x \cdot y\\ \mathbf{if}\;x \cdot y \leq -7.4 \cdot 10^{+229}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \cdot y \leq -3.5 \cdot 10^{-86}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq -2.8 \cdot 10^{-248}:\\ \;\;\;\;z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{elif}\;x \cdot y \leq 3.15 \cdot 10^{+128}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \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 (* x y))))
   (if (<= (* x y) -7.4e+229)
     t_2
     (if (<= (* x y) -3.5e-86)
       t_1
       (if (<= (* x y) -2.8e-248)
         (* z (* t 0.0625))
         (if (<= (* x y) 3.15e+128) t_1 t_2))))))
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 + (x * y);
	double tmp;
	if ((x * y) <= -7.4e+229) {
		tmp = t_2;
	} else if ((x * y) <= -3.5e-86) {
		tmp = t_1;
	} else if ((x * y) <= -2.8e-248) {
		tmp = z * (t * 0.0625);
	} else if ((x * y) <= 3.15e+128) {
		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 + (a * (b * (-0.25d0)))
    t_2 = c + (x * y)
    if ((x * y) <= (-7.4d+229)) then
        tmp = t_2
    else if ((x * y) <= (-3.5d-86)) then
        tmp = t_1
    else if ((x * y) <= (-2.8d-248)) then
        tmp = z * (t * 0.0625d0)
    else if ((x * y) <= 3.15d+128) 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 + (a * (b * -0.25));
	double t_2 = c + (x * y);
	double tmp;
	if ((x * y) <= -7.4e+229) {
		tmp = t_2;
	} else if ((x * y) <= -3.5e-86) {
		tmp = t_1;
	} else if ((x * y) <= -2.8e-248) {
		tmp = z * (t * 0.0625);
	} else if ((x * y) <= 3.15e+128) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = c + (a * (b * -0.25))
	t_2 = c + (x * y)
	tmp = 0
	if (x * y) <= -7.4e+229:
		tmp = t_2
	elif (x * y) <= -3.5e-86:
		tmp = t_1
	elif (x * y) <= -2.8e-248:
		tmp = z * (t * 0.0625)
	elif (x * y) <= 3.15e+128:
		tmp = t_1
	else:
		tmp = t_2
	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(x * y))
	tmp = 0.0
	if (Float64(x * y) <= -7.4e+229)
		tmp = t_2;
	elseif (Float64(x * y) <= -3.5e-86)
		tmp = t_1;
	elseif (Float64(x * y) <= -2.8e-248)
		tmp = Float64(z * Float64(t * 0.0625));
	elseif (Float64(x * y) <= 3.15e+128)
		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 + (a * (b * -0.25));
	t_2 = c + (x * y);
	tmp = 0.0;
	if ((x * y) <= -7.4e+229)
		tmp = t_2;
	elseif ((x * y) <= -3.5e-86)
		tmp = t_1;
	elseif ((x * y) <= -2.8e-248)
		tmp = z * (t * 0.0625);
	elseif ((x * y) <= 3.15e+128)
		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[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -7.4e+229], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], -3.5e-86], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -2.8e-248], N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 3.15e+128], t$95$1, t$95$2]]]]]]
\begin{array}{l}

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -7.40000000000000005e229 or 3.1499999999999999e128 < (*.f64 x y)

    1. Initial program 90.2%

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

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

    if -7.40000000000000005e229 < (*.f64 x y) < -3.50000000000000021e-86 or -2.8000000000000001e-248 < (*.f64 x y) < 3.1499999999999999e128

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

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

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

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

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

    if -3.50000000000000021e-86 < (*.f64 x y) < -2.8000000000000001e-248

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

      \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right)} + c \]
    4. Step-by-step derivation
      1. *-commutative79.8%

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

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

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

        \[\leadsto z \cdot \color{blue}{\left(0.0625 \cdot t\right)} + c \]
    5. Simplified79.8%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -7.4 \cdot 10^{+229}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -3.5 \cdot 10^{-86}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq -2.8 \cdot 10^{-248}:\\ \;\;\;\;z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{elif}\;x \cdot y \leq 3.15 \cdot 10^{+128}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;c + x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 63.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := c + a \cdot \left(b \cdot -0.25\right)\\ t_2 := c + x \cdot y\\ \mathbf{if}\;x \cdot y \leq -8 \cdot 10^{+229}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \cdot y \leq -2.4 \cdot 10^{+46}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq -2.15 \cdot 10^{-248}:\\ \;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{elif}\;x \cdot y \leq 2.06 \cdot 10^{+129}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \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 (* x y))))
   (if (<= (* x y) -8e+229)
     t_2
     (if (<= (* x y) -2.4e+46)
       t_1
       (if (<= (* x y) -2.15e-248)
         (+ c (* z (* t 0.0625)))
         (if (<= (* x y) 2.06e+129) t_1 t_2))))))
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 + (x * y);
	double tmp;
	if ((x * y) <= -8e+229) {
		tmp = t_2;
	} else if ((x * y) <= -2.4e+46) {
		tmp = t_1;
	} else if ((x * y) <= -2.15e-248) {
		tmp = c + (z * (t * 0.0625));
	} else if ((x * y) <= 2.06e+129) {
		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 + (a * (b * (-0.25d0)))
    t_2 = c + (x * y)
    if ((x * y) <= (-8d+229)) then
        tmp = t_2
    else if ((x * y) <= (-2.4d+46)) then
        tmp = t_1
    else if ((x * y) <= (-2.15d-248)) then
        tmp = c + (z * (t * 0.0625d0))
    else if ((x * y) <= 2.06d+129) 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 + (a * (b * -0.25));
	double t_2 = c + (x * y);
	double tmp;
	if ((x * y) <= -8e+229) {
		tmp = t_2;
	} else if ((x * y) <= -2.4e+46) {
		tmp = t_1;
	} else if ((x * y) <= -2.15e-248) {
		tmp = c + (z * (t * 0.0625));
	} else if ((x * y) <= 2.06e+129) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = c + (a * (b * -0.25))
	t_2 = c + (x * y)
	tmp = 0
	if (x * y) <= -8e+229:
		tmp = t_2
	elif (x * y) <= -2.4e+46:
		tmp = t_1
	elif (x * y) <= -2.15e-248:
		tmp = c + (z * (t * 0.0625))
	elif (x * y) <= 2.06e+129:
		tmp = t_1
	else:
		tmp = t_2
	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(x * y))
	tmp = 0.0
	if (Float64(x * y) <= -8e+229)
		tmp = t_2;
	elseif (Float64(x * y) <= -2.4e+46)
		tmp = t_1;
	elseif (Float64(x * y) <= -2.15e-248)
		tmp = Float64(c + Float64(z * Float64(t * 0.0625)));
	elseif (Float64(x * y) <= 2.06e+129)
		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 + (a * (b * -0.25));
	t_2 = c + (x * y);
	tmp = 0.0;
	if ((x * y) <= -8e+229)
		tmp = t_2;
	elseif ((x * y) <= -2.4e+46)
		tmp = t_1;
	elseif ((x * y) <= -2.15e-248)
		tmp = c + (z * (t * 0.0625));
	elseif ((x * y) <= 2.06e+129)
		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[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -8e+229], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], -2.4e+46], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -2.15e-248], N[(c + N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2.06e+129], t$95$1, t$95$2]]]]]]
\begin{array}{l}

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -7.9999999999999999e229 or 2.06e129 < (*.f64 x y)

    1. Initial program 90.2%

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

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

    if -7.9999999999999999e229 < (*.f64 x y) < -2.40000000000000008e46 or -2.1500000000000002e-248 < (*.f64 x y) < 2.06e129

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

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

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

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

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

    if -2.40000000000000008e46 < (*.f64 x y) < -2.1500000000000002e-248

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

      \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right)} + c \]
    4. Step-by-step derivation
      1. *-commutative81.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -8 \cdot 10^{+229}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -2.4 \cdot 10^{+46}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq -2.15 \cdot 10^{-248}:\\ \;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{elif}\;x \cdot y \leq 2.06 \cdot 10^{+129}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\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\\ t_2 := 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+105}:\\ \;\;\;\;c + \left(x \cdot y - t\_1\right)\\ \mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{+125}:\\ \;\;\;\;c + \left(x \cdot y + t\_2\right)\\ \mathbf{else}:\\ \;\;\;\;c + \left(t\_2 - t\_1\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 (<= (* a b) -2e+105)
     (+ c (- (* x y) t_1))
     (if (<= (* a b) 2e+125) (+ c (+ (* x y) t_2)) (+ c (- t_2 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) <= -2e+105) {
		tmp = c + ((x * y) - t_1);
	} else if ((a * b) <= 2e+125) {
		tmp = c + ((x * y) + t_2);
	} else {
		tmp = c + (t_2 - 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) <= (-2d+105)) then
        tmp = c + ((x * y) - t_1)
    else if ((a * b) <= 2d+125) then
        tmp = c + ((x * y) + t_2)
    else
        tmp = c + (t_2 - 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) <= -2e+105) {
		tmp = c + ((x * y) - t_1);
	} else if ((a * b) <= 2e+125) {
		tmp = c + ((x * y) + t_2);
	} else {
		tmp = c + (t_2 - 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) <= -2e+105:
		tmp = c + ((x * y) - t_1)
	elif (a * b) <= 2e+125:
		tmp = c + ((x * y) + t_2)
	else:
		tmp = c + (t_2 - 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) <= -2e+105)
		tmp = Float64(c + Float64(Float64(x * y) - t_1));
	elseif (Float64(a * b) <= 2e+125)
		tmp = Float64(c + Float64(Float64(x * y) + t_2));
	else
		tmp = Float64(c + Float64(t_2 - 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) <= -2e+105)
		tmp = c + ((x * y) - t_1);
	elseif ((a * b) <= 2e+125)
		tmp = c + ((x * y) + t_2);
	else
		tmp = c + (t_2 - 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], -2e+105], N[(c + N[(N[(x * y), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2e+125], N[(c + N[(N[(x * y), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision], N[(c + N[(t$95$2 - t$95$1), $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}\;a \cdot b \leq -2 \cdot 10^{+105}:\\
\;\;\;\;c + \left(x \cdot y - t\_1\right)\\

\mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{+125}:\\
\;\;\;\;c + \left(x \cdot y + t\_2\right)\\

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


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

    1. Initial program 95.1%

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

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

    if -1.9999999999999999e105 < (*.f64 a b) < 1.9999999999999998e125

    1. Initial program 99.4%

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

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

    if 1.9999999999999998e125 < (*.f64 a b)

    1. Initial program 89.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 88.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 3 regimes into one program.
  4. Final simplification93.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+105}:\\ \;\;\;\;c + \left(x \cdot y - \left(a \cdot b\right) \cdot 0.25\right)\\ \mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{+125}:\\ \;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\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.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -6.4 \cdot 10^{+34} \lor \neg \left(b \leq 7.5 \cdot 10^{+74}\right) \land \left(b \leq 3.8 \cdot 10^{+118} \lor \neg \left(b \leq 2.05 \cdot 10^{+178}\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 (<= b -6.4e+34)
         (and (not (<= b 7.5e+74))
              (or (<= b 3.8e+118) (not (<= b 2.05e+178)))))
   (* 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 ((b <= -6.4e+34) || (!(b <= 7.5e+74) && ((b <= 3.8e+118) || !(b <= 2.05e+178)))) {
		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 ((b <= (-6.4d+34)) .or. (.not. (b <= 7.5d+74)) .and. (b <= 3.8d+118) .or. (.not. (b <= 2.05d+178))) 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 ((b <= -6.4e+34) || (!(b <= 7.5e+74) && ((b <= 3.8e+118) || !(b <= 2.05e+178)))) {
		tmp = a * (b * -0.25);
	} else {
		tmp = c + (x * y);
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	tmp = 0
	if (b <= -6.4e+34) or (not (b <= 7.5e+74) and ((b <= 3.8e+118) or not (b <= 2.05e+178))):
		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 ((b <= -6.4e+34) || (!(b <= 7.5e+74) && ((b <= 3.8e+118) || !(b <= 2.05e+178))))
		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 ((b <= -6.4e+34) || (~((b <= 7.5e+74)) && ((b <= 3.8e+118) || ~((b <= 2.05e+178)))))
		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[b, -6.4e+34], And[N[Not[LessEqual[b, 7.5e+74]], $MachinePrecision], Or[LessEqual[b, 3.8e+118], N[Not[LessEqual[b, 2.05e+178]], $MachinePrecision]]]], N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.4 \cdot 10^{+34} \lor \neg \left(b \leq 7.5 \cdot 10^{+74}\right) \land \left(b \leq 3.8 \cdot 10^{+118} \lor \neg \left(b \leq 2.05 \cdot 10^{+178}\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 b < -6.3999999999999997e34 or 7.5e74 < b < 3.80000000000000016e118 or 2.04999999999999998e178 < b

    1. Initial program 93.0%

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

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

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

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

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

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

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

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

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

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

    if -6.3999999999999997e34 < b < 7.5e74 or 3.80000000000000016e118 < b < 2.04999999999999998e178

    1. Initial program 99.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 inf 61.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -6.4 \cdot 10^{+34} \lor \neg \left(b \leq 7.5 \cdot 10^{+74}\right) \land \left(b \leq 3.8 \cdot 10^{+118} \lor \neg \left(b \leq 2.05 \cdot 10^{+178}\right)\right):\\ \;\;\;\;a \cdot \left(b \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;c + x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 76.9% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1 \cdot 10^{+24} \lor \neg \left(b \leq 2 \cdot 10^{+179}\right):\\ \;\;\;\;c + a \cdot \left(b \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 (<= b -1e+24) (not (<= b 2e+179)))
   (+ c (* 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 ((b <= -1e+24) || !(b <= 2e+179)) {
		tmp = c + (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 ((b <= (-1d+24)) .or. (.not. (b <= 2d+179))) then
        tmp = c + (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 ((b <= -1e+24) || !(b <= 2e+179)) {
		tmp = c + (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 (b <= -1e+24) or not (b <= 2e+179):
		tmp = c + (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 ((b <= -1e+24) || !(b <= 2e+179))
		tmp = Float64(c + Float64(a * Float64(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 ((b <= -1e+24) || ~((b <= 2e+179)))
		tmp = c + (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[b, -1e+24], N[Not[LessEqual[b, 2e+179]], $MachinePrecision]], N[(c + N[(a * N[(b * -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}\;b \leq -1 \cdot 10^{+24} \lor \neg \left(b \leq 2 \cdot 10^{+179}\right):\\
\;\;\;\;c + a \cdot \left(b \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 b < -9.9999999999999998e23 or 1.99999999999999996e179 < b

    1. Initial program 93.3%

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

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

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

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

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

    if -9.9999999999999998e23 < b < 1.99999999999999996e179

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1 \cdot 10^{+24} \lor \neg \left(b \leq 2 \cdot 10^{+179}\right):\\ \;\;\;\;c + a \cdot \left(b \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: 35.9% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{-84} \lor \neg \left(b \leq 8.8 \cdot 10^{+64}\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 b < -2.0000000000000001e-84 or 8.80000000000000007e64 < b

    1. Initial program 94.8%

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

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

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

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

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

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

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

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

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

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

    if -2.0000000000000001e-84 < b < 8.80000000000000007e64

    1. Initial program 99.2%

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

      \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right)} + c \]
    4. Step-by-step derivation
      1. *-commutative55.0%

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

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

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

        \[\leadsto z \cdot \color{blue}{\left(0.0625 \cdot t\right)} + c \]
    5. Simplified55.0%

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

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

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

Alternative 12: 22.4% accurate, 17.0× speedup?

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

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

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

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

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

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

      \[\leadsto z \cdot \color{blue}{\left(0.0625 \cdot t\right)} + c \]
  5. Simplified43.1%

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

    \[\leadsto \color{blue}{c} \]
  7. Final simplification20.1%

    \[\leadsto c \]
  8. Add Preprocessing

Reproduce

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