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

Percentage Accurate: 97.7% → 99.0%
Time: 13.5s
Alternatives: 13
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 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: 99.0% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

    \[\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.2% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 66.0% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := c + z \cdot \left(t \cdot 0.0625\right)\\ t_2 := \left(a \cdot b\right) \cdot 0.25\\ t_3 := 0.0625 \cdot \left(z \cdot t\right) - t\_2\\ t_4 := c + x \cdot y\\ \mathbf{if}\;x \cdot y \leq -1.85 \cdot 10^{+146}:\\ \;\;\;\;t\_4\\ \mathbf{elif}\;x \cdot y \leq -6.1 \cdot 10^{-164}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{-316}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 6.2 \cdot 10^{-49}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;x \cdot y \leq 17000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 2.6 \cdot 10^{+32}:\\ \;\;\;\;x \cdot y - t\_2\\ \mathbf{elif}\;x \cdot y \leq 10^{+67}:\\ \;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{+114}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_4\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (+ c (* z (* t 0.0625))))
        (t_2 (* (* a b) 0.25))
        (t_3 (- (* 0.0625 (* z t)) t_2))
        (t_4 (+ c (* x y))))
   (if (<= (* x y) -1.85e+146)
     t_4
     (if (<= (* x y) -6.1e-164)
       t_3
       (if (<= (* x y) -1e-316)
         t_1
         (if (<= (* x y) 6.2e-49)
           t_3
           (if (<= (* x y) 17000.0)
             t_1
             (if (<= (* x y) 2.6e+32)
               (- (* x y) t_2)
               (if (<= (* x y) 1e+67)
                 (+ c (* b (* a -0.25)))
                 (if (<= (* x y) 4e+114) t_1 t_4))))))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = c + (z * (t * 0.0625));
	double t_2 = (a * b) * 0.25;
	double t_3 = (0.0625 * (z * t)) - t_2;
	double t_4 = c + (x * y);
	double tmp;
	if ((x * y) <= -1.85e+146) {
		tmp = t_4;
	} else if ((x * y) <= -6.1e-164) {
		tmp = t_3;
	} else if ((x * y) <= -1e-316) {
		tmp = t_1;
	} else if ((x * y) <= 6.2e-49) {
		tmp = t_3;
	} else if ((x * y) <= 17000.0) {
		tmp = t_1;
	} else if ((x * y) <= 2.6e+32) {
		tmp = (x * y) - t_2;
	} else if ((x * y) <= 1e+67) {
		tmp = c + (b * (a * -0.25));
	} else if ((x * y) <= 4e+114) {
		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 + (z * (t * 0.0625d0))
    t_2 = (a * b) * 0.25d0
    t_3 = (0.0625d0 * (z * t)) - t_2
    t_4 = c + (x * y)
    if ((x * y) <= (-1.85d+146)) then
        tmp = t_4
    else if ((x * y) <= (-6.1d-164)) then
        tmp = t_3
    else if ((x * y) <= (-1d-316)) then
        tmp = t_1
    else if ((x * y) <= 6.2d-49) then
        tmp = t_3
    else if ((x * y) <= 17000.0d0) then
        tmp = t_1
    else if ((x * y) <= 2.6d+32) then
        tmp = (x * y) - t_2
    else if ((x * y) <= 1d+67) then
        tmp = c + (b * (a * (-0.25d0)))
    else if ((x * y) <= 4d+114) 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 + (z * (t * 0.0625));
	double t_2 = (a * b) * 0.25;
	double t_3 = (0.0625 * (z * t)) - t_2;
	double t_4 = c + (x * y);
	double tmp;
	if ((x * y) <= -1.85e+146) {
		tmp = t_4;
	} else if ((x * y) <= -6.1e-164) {
		tmp = t_3;
	} else if ((x * y) <= -1e-316) {
		tmp = t_1;
	} else if ((x * y) <= 6.2e-49) {
		tmp = t_3;
	} else if ((x * y) <= 17000.0) {
		tmp = t_1;
	} else if ((x * y) <= 2.6e+32) {
		tmp = (x * y) - t_2;
	} else if ((x * y) <= 1e+67) {
		tmp = c + (b * (a * -0.25));
	} else if ((x * y) <= 4e+114) {
		tmp = t_1;
	} else {
		tmp = t_4;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = c + (z * (t * 0.0625))
	t_2 = (a * b) * 0.25
	t_3 = (0.0625 * (z * t)) - t_2
	t_4 = c + (x * y)
	tmp = 0
	if (x * y) <= -1.85e+146:
		tmp = t_4
	elif (x * y) <= -6.1e-164:
		tmp = t_3
	elif (x * y) <= -1e-316:
		tmp = t_1
	elif (x * y) <= 6.2e-49:
		tmp = t_3
	elif (x * y) <= 17000.0:
		tmp = t_1
	elif (x * y) <= 2.6e+32:
		tmp = (x * y) - t_2
	elif (x * y) <= 1e+67:
		tmp = c + (b * (a * -0.25))
	elif (x * y) <= 4e+114:
		tmp = t_1
	else:
		tmp = t_4
	return tmp
function code(x, y, z, t, a, b, c)
	t_1 = Float64(c + Float64(z * Float64(t * 0.0625)))
	t_2 = Float64(Float64(a * b) * 0.25)
	t_3 = Float64(Float64(0.0625 * Float64(z * t)) - t_2)
	t_4 = Float64(c + Float64(x * y))
	tmp = 0.0
	if (Float64(x * y) <= -1.85e+146)
		tmp = t_4;
	elseif (Float64(x * y) <= -6.1e-164)
		tmp = t_3;
	elseif (Float64(x * y) <= -1e-316)
		tmp = t_1;
	elseif (Float64(x * y) <= 6.2e-49)
		tmp = t_3;
	elseif (Float64(x * y) <= 17000.0)
		tmp = t_1;
	elseif (Float64(x * y) <= 2.6e+32)
		tmp = Float64(Float64(x * y) - t_2);
	elseif (Float64(x * y) <= 1e+67)
		tmp = Float64(c + Float64(b * Float64(a * -0.25)));
	elseif (Float64(x * y) <= 4e+114)
		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 + (z * (t * 0.0625));
	t_2 = (a * b) * 0.25;
	t_3 = (0.0625 * (z * t)) - t_2;
	t_4 = c + (x * y);
	tmp = 0.0;
	if ((x * y) <= -1.85e+146)
		tmp = t_4;
	elseif ((x * y) <= -6.1e-164)
		tmp = t_3;
	elseif ((x * y) <= -1e-316)
		tmp = t_1;
	elseif ((x * y) <= 6.2e-49)
		tmp = t_3;
	elseif ((x * y) <= 17000.0)
		tmp = t_1;
	elseif ((x * y) <= 2.6e+32)
		tmp = (x * y) - t_2;
	elseif ((x * y) <= 1e+67)
		tmp = c + (b * (a * -0.25));
	elseif ((x * y) <= 4e+114)
		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[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]}, Block[{t$95$3 = N[(N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -1.85e+146], t$95$4, If[LessEqual[N[(x * y), $MachinePrecision], -6.1e-164], t$95$3, If[LessEqual[N[(x * y), $MachinePrecision], -1e-316], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 6.2e-49], t$95$3, If[LessEqual[N[(x * y), $MachinePrecision], 17000.0], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2.6e+32], N[(N[(x * y), $MachinePrecision] - t$95$2), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+67], N[(c + N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 4e+114], t$95$1, t$95$4]]]]]]]]]]]]
\begin{array}{l}

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

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

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

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if (*.f64 x y) < -1.85000000000000002e146 or 4e114 < (*.f64 x y)

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

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

    if -1.85000000000000002e146 < (*.f64 x y) < -6.10000000000000013e-164 or -9.999999837e-317 < (*.f64 x y) < 6.2e-49

    1. Initial program 100.0%

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

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

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

    if -6.10000000000000013e-164 < (*.f64 x y) < -9.999999837e-317 or 6.2e-49 < (*.f64 x y) < 17000 or 9.99999999999999983e66 < (*.f64 x y) < 4e114

    1. Initial program 97.5%

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

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

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

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

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

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

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

    if 17000 < (*.f64 x y) < 2.6000000000000002e32

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

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

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

    if 2.6000000000000002e32 < (*.f64 x y) < 9.99999999999999983e66

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1.85 \cdot 10^{+146}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -6.1 \cdot 10^{-164}:\\ \;\;\;\;0.0625 \cdot \left(z \cdot t\right) - \left(a \cdot b\right) \cdot 0.25\\ \mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{-316}:\\ \;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{elif}\;x \cdot y \leq 6.2 \cdot 10^{-49}:\\ \;\;\;\;0.0625 \cdot \left(z \cdot t\right) - \left(a \cdot b\right) \cdot 0.25\\ \mathbf{elif}\;x \cdot y \leq 17000:\\ \;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{elif}\;x \cdot y \leq 2.6 \cdot 10^{+32}:\\ \;\;\;\;x \cdot y - \left(a \cdot b\right) \cdot 0.25\\ \mathbf{elif}\;x \cdot y \leq 10^{+67}:\\ \;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{+114}:\\ \;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{else}:\\ \;\;\;\;c + x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 44.6% accurate, 0.3× speedup?

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

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

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

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 x y) < -2.60000000000000003e145 or 4.09999999999999989e123 < (*.f64 x y)

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, -0.25 \cdot \left(a \cdot b\right)\right)} + c \]
      2. distribute-lft-neg-in90.7%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\left(-0.25\right) \cdot \left(a \cdot b\right)}\right) + c \]
      3. metadata-eval90.7%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{-0.25} \cdot \left(a \cdot b\right)\right) + c \]
      4. associate-*r*90.7%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\left(-0.25 \cdot a\right) \cdot b}\right) + c \]
    5. Simplified90.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \left(-0.25 \cdot a\right) \cdot b\right)} + c \]
    6. Step-by-step derivation
      1. +-commutative90.7%

        \[\leadsto \color{blue}{c + \mathsf{fma}\left(x, y, \left(-0.25 \cdot a\right) \cdot b\right)} \]
      2. fma-undefine90.7%

        \[\leadsto c + \color{blue}{\left(x \cdot y + \left(-0.25 \cdot a\right) \cdot b\right)} \]
      3. associate-+r+90.7%

        \[\leadsto \color{blue}{\left(c + x \cdot y\right) + \left(-0.25 \cdot a\right) \cdot b} \]
      4. *-commutative90.7%

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

        \[\leadsto \left(c + x \cdot y\right) + \color{blue}{a \cdot \left(-0.25 \cdot b\right)} \]
      6. *-commutative90.7%

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

        \[\leadsto \color{blue}{a \cdot \left(b \cdot -0.25\right) + \left(c + x \cdot y\right)} \]
      8. *-commutative90.7%

        \[\leadsto \color{blue}{\left(b \cdot -0.25\right) \cdot a} + \left(c + x \cdot y\right) \]
      9. fma-define91.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(b \cdot -0.25, a, c + x \cdot y\right)} \]
      10. *-commutative91.7%

        \[\leadsto \mathsf{fma}\left(\color{blue}{-0.25 \cdot b}, a, c + x \cdot y\right) \]
      11. +-commutative91.7%

        \[\leadsto \mathsf{fma}\left(-0.25 \cdot b, a, \color{blue}{x \cdot y + c}\right) \]
      12. fma-undefine91.7%

        \[\leadsto \mathsf{fma}\left(-0.25 \cdot b, a, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right) \]
    7. Applied egg-rr91.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.25 \cdot b, a, \mathsf{fma}\left(x, y, c\right)\right)} \]
    8. Taylor expanded in x around inf 78.6%

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

    if -2.60000000000000003e145 < (*.f64 x y) < -3.1000000000000001e-164 or -9.999999837e-317 < (*.f64 x y) < 7.6000000000000001e-169 or 5.3000000000000001e-15 < (*.f64 x y) < 9.50000000000000051e66

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, -0.25 \cdot \left(a \cdot b\right)\right)} + c \]
      2. distribute-lft-neg-in75.4%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\left(-0.25\right) \cdot \left(a \cdot b\right)}\right) + c \]
      3. metadata-eval75.4%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{-0.25} \cdot \left(a \cdot b\right)\right) + c \]
      4. associate-*r*75.4%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\left(-0.25 \cdot a\right) \cdot b}\right) + c \]
    5. Simplified75.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \left(-0.25 \cdot a\right) \cdot b\right)} + c \]
    6. Step-by-step derivation
      1. +-commutative75.4%

        \[\leadsto \color{blue}{c + \mathsf{fma}\left(x, y, \left(-0.25 \cdot a\right) \cdot b\right)} \]
      2. fma-undefine75.4%

        \[\leadsto c + \color{blue}{\left(x \cdot y + \left(-0.25 \cdot a\right) \cdot b\right)} \]
      3. associate-+r+75.4%

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

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

        \[\leadsto \left(c + x \cdot y\right) + \color{blue}{a \cdot \left(-0.25 \cdot b\right)} \]
      6. *-commutative75.4%

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

        \[\leadsto \color{blue}{a \cdot \left(b \cdot -0.25\right) + \left(c + x \cdot y\right)} \]
      8. *-commutative75.4%

        \[\leadsto \color{blue}{\left(b \cdot -0.25\right) \cdot a} + \left(c + x \cdot y\right) \]
      9. fma-define75.4%

        \[\leadsto \color{blue}{\mathsf{fma}\left(b \cdot -0.25, a, c + x \cdot y\right)} \]
      10. *-commutative75.4%

        \[\leadsto \mathsf{fma}\left(\color{blue}{-0.25 \cdot b}, a, c + x \cdot y\right) \]
      11. +-commutative75.4%

        \[\leadsto \mathsf{fma}\left(-0.25 \cdot b, a, \color{blue}{x \cdot y + c}\right) \]
      12. fma-undefine75.4%

        \[\leadsto \mathsf{fma}\left(-0.25 \cdot b, a, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right) \]
    7. Applied egg-rr75.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.25 \cdot b, a, \mathsf{fma}\left(x, y, c\right)\right)} \]
    8. Taylor expanded in b around inf 43.5%

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

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

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

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

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

    if -3.1000000000000001e-164 < (*.f64 x y) < -9.999999837e-317

    1. Initial program 99.9%

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

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

    if 7.6000000000000001e-169 < (*.f64 x y) < 5.3000000000000001e-15 or 9.50000000000000051e66 < (*.f64 x y) < 4.09999999999999989e123

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2.6 \cdot 10^{+145}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -3.1 \cdot 10^{-164}:\\ \;\;\;\;a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{-316}:\\ \;\;\;\;c\\ \mathbf{elif}\;x \cdot y \leq 7.6 \cdot 10^{-169}:\\ \;\;\;\;a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 5.3 \cdot 10^{-15}:\\ \;\;\;\;0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq 9.5 \cdot 10^{+66}:\\ \;\;\;\;a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 4.1 \cdot 10^{+123}:\\ \;\;\;\;0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 43.3% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_1 := 0.0625 \cdot \left(z \cdot t\right)\\
\mathbf{if}\;x \cdot y \leq -1.45 \cdot 10^{+135}:\\
\;\;\;\;x \cdot y\\

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

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

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

\mathbf{elif}\;x \cdot y \leq 1.05 \cdot 10^{+64}:\\
\;\;\;\;c\\

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

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


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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, -0.25 \cdot \left(a \cdot b\right)\right)} + c \]
      2. distribute-lft-neg-in90.9%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\left(-0.25\right) \cdot \left(a \cdot b\right)}\right) + c \]
      3. metadata-eval90.9%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{-0.25} \cdot \left(a \cdot b\right)\right) + c \]
      4. associate-*r*90.9%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\left(-0.25 \cdot a\right) \cdot b}\right) + c \]
    5. Simplified90.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \left(-0.25 \cdot a\right) \cdot b\right)} + c \]
    6. Step-by-step derivation
      1. +-commutative90.9%

        \[\leadsto \color{blue}{c + \mathsf{fma}\left(x, y, \left(-0.25 \cdot a\right) \cdot b\right)} \]
      2. fma-undefine90.9%

        \[\leadsto c + \color{blue}{\left(x \cdot y + \left(-0.25 \cdot a\right) \cdot b\right)} \]
      3. associate-+r+90.9%

        \[\leadsto \color{blue}{\left(c + x \cdot y\right) + \left(-0.25 \cdot a\right) \cdot b} \]
      4. *-commutative90.9%

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

        \[\leadsto \left(c + x \cdot y\right) + \color{blue}{a \cdot \left(-0.25 \cdot b\right)} \]
      6. *-commutative90.9%

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

        \[\leadsto \color{blue}{a \cdot \left(b \cdot -0.25\right) + \left(c + x \cdot y\right)} \]
      8. *-commutative90.9%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(b \cdot -0.25, a, c + x \cdot y\right)} \]
      10. *-commutative91.9%

        \[\leadsto \mathsf{fma}\left(\color{blue}{-0.25 \cdot b}, a, c + x \cdot y\right) \]
      11. +-commutative91.9%

        \[\leadsto \mathsf{fma}\left(-0.25 \cdot b, a, \color{blue}{x \cdot y + c}\right) \]
      12. fma-undefine91.9%

        \[\leadsto \mathsf{fma}\left(-0.25 \cdot b, a, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right) \]
    7. Applied egg-rr91.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.25 \cdot b, a, \mathsf{fma}\left(x, y, c\right)\right)} \]
    8. Taylor expanded in x around inf 77.1%

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

    if -1.4499999999999999e135 < (*.f64 x y) < -1.8999999999999999e-81 or -9.999999837e-317 < (*.f64 x y) < 5.19999999999999973e-30 or 1.05e64 < (*.f64 x y) < 5.80000000000000019e123

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

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

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

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

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

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

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

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

    if -1.8999999999999999e-81 < (*.f64 x y) < -9.999999837e-317 or 5.19999999999999973e-30 < (*.f64 x y) < 1.05e64

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1.45 \cdot 10^{+135}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -1.9 \cdot 10^{-81}:\\ \;\;\;\;0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{-316}:\\ \;\;\;\;c\\ \mathbf{elif}\;x \cdot y \leq 5.2 \cdot 10^{-30}:\\ \;\;\;\;0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq 1.05 \cdot 10^{+64}:\\ \;\;\;\;c\\ \mathbf{elif}\;x \cdot y \leq 5.8 \cdot 10^{+123}:\\ \;\;\;\;0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 66.1% accurate, 0.4× speedup?

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

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

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

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

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

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

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


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

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

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

    if -1.9499999999999999e145 < (*.f64 x y) < 1.51999999999999995e-171 or 2.3e12 < (*.f64 x y) < 9.99999999999999983e66

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

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

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

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

    if 1.51999999999999995e-171 < (*.f64 x y) < 2.3e12 or 9.99999999999999983e66 < (*.f64 x y) < 1.2999999999999999e120

    1. Initial program 97.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 inf 77.8%

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

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

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

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

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

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

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

Alternative 7: 89.2% accurate, 0.6× speedup?

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

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

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


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

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

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

    if -2.60000000000000003e145 < (*.f64 x y) < 7.50000000000000003e118

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

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

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

Alternative 8: 54.1% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;t \leq 6.5 \cdot 10^{-270}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 1.5 \cdot 10^{-234}:\\
\;\;\;\;a \cdot \left(b \cdot -0.25\right)\\

\mathbf{elif}\;t \leq 5 \cdot 10^{+154}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -6.3999999999999997e38 or 5.00000000000000004e154 < t

    1. Initial program 97.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 inf 64.6%

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

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

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

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

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

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

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

    if -6.3999999999999997e38 < t < 6.5000000000000001e-270 or 1.49999999999999994e-234 < t < 5.00000000000000004e154

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

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

    if 6.5000000000000001e-270 < t < 1.49999999999999994e-234

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, -0.25 \cdot \left(a \cdot b\right)\right)} + c \]
      2. distribute-lft-neg-in94.1%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\left(-0.25\right) \cdot \left(a \cdot b\right)}\right) + c \]
      3. metadata-eval94.1%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{-0.25} \cdot \left(a \cdot b\right)\right) + c \]
      4. associate-*r*94.1%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\left(-0.25 \cdot a\right) \cdot b}\right) + c \]
    5. Simplified94.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \left(-0.25 \cdot a\right) \cdot b\right)} + c \]
    6. Step-by-step derivation
      1. +-commutative94.1%

        \[\leadsto \color{blue}{c + \mathsf{fma}\left(x, y, \left(-0.25 \cdot a\right) \cdot b\right)} \]
      2. fma-undefine94.1%

        \[\leadsto c + \color{blue}{\left(x \cdot y + \left(-0.25 \cdot a\right) \cdot b\right)} \]
      3. associate-+r+94.1%

        \[\leadsto \color{blue}{\left(c + x \cdot y\right) + \left(-0.25 \cdot a\right) \cdot b} \]
      4. *-commutative94.1%

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

        \[\leadsto \left(c + x \cdot y\right) + \color{blue}{a \cdot \left(-0.25 \cdot b\right)} \]
      6. *-commutative94.1%

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

        \[\leadsto \color{blue}{a \cdot \left(b \cdot -0.25\right) + \left(c + x \cdot y\right)} \]
      8. *-commutative94.1%

        \[\leadsto \color{blue}{\left(b \cdot -0.25\right) \cdot a} + \left(c + x \cdot y\right) \]
      9. fma-define94.1%

        \[\leadsto \color{blue}{\mathsf{fma}\left(b \cdot -0.25, a, c + x \cdot y\right)} \]
      10. *-commutative94.1%

        \[\leadsto \mathsf{fma}\left(\color{blue}{-0.25 \cdot b}, a, c + x \cdot y\right) \]
      11. +-commutative94.1%

        \[\leadsto \mathsf{fma}\left(-0.25 \cdot b, a, \color{blue}{x \cdot y + c}\right) \]
      12. fma-undefine94.1%

        \[\leadsto \mathsf{fma}\left(-0.25 \cdot b, a, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right) \]
    7. Applied egg-rr94.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.25 \cdot b, a, \mathsf{fma}\left(x, y, c\right)\right)} \]
    8. Taylor expanded in b around inf 65.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -6.4 \cdot 10^{+38}:\\ \;\;\;\;0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;t \leq 6.5 \cdot 10^{-270}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{elif}\;t \leq 1.5 \cdot 10^{-234}:\\ \;\;\;\;a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;t \leq 5 \cdot 10^{+154}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;0.0625 \cdot \left(z \cdot t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 65.3% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.45 \cdot 10^{+135} \lor \neg \left(x \cdot y \leq 4.8 \cdot 10^{+117}\right):\\
\;\;\;\;c + x \cdot y\\

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


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

    1. Initial program 97.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 85.2%

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

    if -1.4499999999999999e135 < (*.f64 x y) < 4.7999999999999998e117

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

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

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

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

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

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

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

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

Alternative 10: 75.0% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.4 \cdot 10^{+38}:\\
\;\;\;\;0.0625 \cdot \left(z \cdot t\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -6.3999999999999997e38

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

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

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

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

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

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

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

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

    if -6.3999999999999997e38 < t < 1.9499999999999999e174

    1. Initial program 98.9%

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

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

    if 1.9499999999999999e174 < t

    1. Initial program 91.3%

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

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

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

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

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

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

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

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

Alternative 11: 42.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -3.7 \cdot 10^{+90} \lor \neg \left(x \cdot y \leq 1.28 \cdot 10^{+138}\right):\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -3.7e90 or 1.28000000000000008e138 < (*.f64 x y)

    1. Initial program 97.2%

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

      \[\leadsto \color{blue}{\left(x \cdot y - 0.25 \cdot \left(a \cdot b\right)\right)} + c \]
    4. Step-by-step derivation
      1. fma-neg89.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, -0.25 \cdot \left(a \cdot b\right)\right)} + c \]
      2. distribute-lft-neg-in89.6%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\left(-0.25\right) \cdot \left(a \cdot b\right)}\right) + c \]
      3. metadata-eval89.6%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{-0.25} \cdot \left(a \cdot b\right)\right) + c \]
      4. associate-*r*89.6%

        \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\left(-0.25 \cdot a\right) \cdot b}\right) + c \]
    5. Simplified89.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \left(-0.25 \cdot a\right) \cdot b\right)} + c \]
    6. Step-by-step derivation
      1. +-commutative89.6%

        \[\leadsto \color{blue}{c + \mathsf{fma}\left(x, y, \left(-0.25 \cdot a\right) \cdot b\right)} \]
      2. fma-undefine89.6%

        \[\leadsto c + \color{blue}{\left(x \cdot y + \left(-0.25 \cdot a\right) \cdot b\right)} \]
      3. associate-+r+89.6%

        \[\leadsto \color{blue}{\left(c + x \cdot y\right) + \left(-0.25 \cdot a\right) \cdot b} \]
      4. *-commutative89.6%

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

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

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

        \[\leadsto \color{blue}{a \cdot \left(b \cdot -0.25\right) + \left(c + x \cdot y\right)} \]
      8. *-commutative89.6%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(b \cdot -0.25, a, c + x \cdot y\right)} \]
      10. *-commutative90.5%

        \[\leadsto \mathsf{fma}\left(\color{blue}{-0.25 \cdot b}, a, c + x \cdot y\right) \]
      11. +-commutative90.5%

        \[\leadsto \mathsf{fma}\left(-0.25 \cdot b, a, \color{blue}{x \cdot y + c}\right) \]
      12. fma-undefine90.5%

        \[\leadsto \mathsf{fma}\left(-0.25 \cdot b, a, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right) \]
    7. Applied egg-rr90.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.25 \cdot b, a, \mathsf{fma}\left(x, y, c\right)\right)} \]
    8. Taylor expanded in x around inf 72.4%

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

    if -3.7e90 < (*.f64 x y) < 1.28000000000000008e138

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

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

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

Alternative 12: 97.7% accurate, 1.0× speedup?

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

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

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

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

Alternative 13: 22.9% accurate, 17.0× speedup?

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

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

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

    \[\leadsto \color{blue}{c} \]
  4. Final simplification21.6%

    \[\leadsto c \]
  5. Add Preprocessing

Reproduce

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