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

Percentage Accurate: 97.6% → 98.9%
Time: 12.4s
Alternatives: 15
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 15 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.6% 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(\frac{z}{16}, t, \mathsf{fma}\left(\frac{a}{-4}, b, c\right)\right)\right) \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (fma x y (fma (/ z 16.0) t (fma (/ a -4.0) b c))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	return fma(x, y, fma((z / 16.0), t, fma((a / -4.0), b, c)));
}
function code(x, y, z, t, a, b, c)
	return fma(x, y, fma(Float64(z / 16.0), t, fma(Float64(a / -4.0), b, c)))
end
code[x_, y_, z_, t_, a_, b_, c_] := N[(x * y + N[(N[(z / 16.0), $MachinePrecision] * t + N[(N[(a / -4.0), $MachinePrecision] * b + c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(x, y, \mathsf{fma}\left(\frac{z}{16}, t, \color{blue}{\mathsf{fma}\left(\frac{-a}{4}, b, c\right)}\right)\right) \]
    13. neg-mul-198.8%

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

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

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

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

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

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

Alternative 2: 98.1% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(x \cdot y + \mathsf{fma}\left(t, z \cdot 0.0625, \color{blue}{\frac{a}{\frac{-4}{b}}}\right)\right) + c \]
    12. associate-/r/98.0%

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

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

      \[\leadsto \left(x \cdot y + \mathsf{fma}\left(t, z \cdot 0.0625, \left(a \cdot \color{blue}{-0.25}\right) \cdot b\right)\right) + c \]
  4. Applied egg-rr98.0%

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

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

Alternative 3: 66.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := c + z \cdot \left(t \cdot 0.0625\right)\\ t_2 := c + a \cdot \left(b \cdot -0.25\right)\\ t_3 := x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{if}\;x \cdot y \leq -1.3 \cdot 10^{+62}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \cdot y \leq -1.16 \cdot 10^{-157}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot y \leq -8.4 \cdot 10^{-221}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot y \leq -1.3 \cdot 10^{-278}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot y \leq 9.5 \cdot 10^{-166}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot y \leq 4.1 \cdot 10^{+74}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot y \leq 3.3 \cdot 10^{+162}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;x \cdot y - \left(a \cdot b\right) \cdot 0.25\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (+ c (* z (* t 0.0625))))
        (t_2 (+ c (* a (* b -0.25))))
        (t_3 (+ (* x y) (* 0.0625 (* z t)))))
   (if (<= (* x y) -1.3e+62)
     t_3
     (if (<= (* x y) -1.16e-157)
       t_2
       (if (<= (* x y) -8.4e-221)
         t_1
         (if (<= (* x y) -1.3e-278)
           t_2
           (if (<= (* x y) 9.5e-166)
             t_1
             (if (<= (* x y) 4.1e+74)
               t_2
               (if (<= (* x y) 3.3e+162)
                 t_3
                 (- (* x y) (* (* a b) 0.25)))))))))))
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 = c + (a * (b * -0.25));
	double t_3 = (x * y) + (0.0625 * (z * t));
	double tmp;
	if ((x * y) <= -1.3e+62) {
		tmp = t_3;
	} else if ((x * y) <= -1.16e-157) {
		tmp = t_2;
	} else if ((x * y) <= -8.4e-221) {
		tmp = t_1;
	} else if ((x * y) <= -1.3e-278) {
		tmp = t_2;
	} else if ((x * y) <= 9.5e-166) {
		tmp = t_1;
	} else if ((x * y) <= 4.1e+74) {
		tmp = t_2;
	} else if ((x * y) <= 3.3e+162) {
		tmp = t_3;
	} else {
		tmp = (x * y) - ((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) :: t_3
    real(8) :: tmp
    t_1 = c + (z * (t * 0.0625d0))
    t_2 = c + (a * (b * (-0.25d0)))
    t_3 = (x * y) + (0.0625d0 * (z * t))
    if ((x * y) <= (-1.3d+62)) then
        tmp = t_3
    else if ((x * y) <= (-1.16d-157)) then
        tmp = t_2
    else if ((x * y) <= (-8.4d-221)) then
        tmp = t_1
    else if ((x * y) <= (-1.3d-278)) then
        tmp = t_2
    else if ((x * y) <= 9.5d-166) then
        tmp = t_1
    else if ((x * y) <= 4.1d+74) then
        tmp = t_2
    else if ((x * y) <= 3.3d+162) then
        tmp = t_3
    else
        tmp = (x * y) - ((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 + (z * (t * 0.0625));
	double t_2 = c + (a * (b * -0.25));
	double t_3 = (x * y) + (0.0625 * (z * t));
	double tmp;
	if ((x * y) <= -1.3e+62) {
		tmp = t_3;
	} else if ((x * y) <= -1.16e-157) {
		tmp = t_2;
	} else if ((x * y) <= -8.4e-221) {
		tmp = t_1;
	} else if ((x * y) <= -1.3e-278) {
		tmp = t_2;
	} else if ((x * y) <= 9.5e-166) {
		tmp = t_1;
	} else if ((x * y) <= 4.1e+74) {
		tmp = t_2;
	} else if ((x * y) <= 3.3e+162) {
		tmp = t_3;
	} else {
		tmp = (x * y) - ((a * b) * 0.25);
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = c + (z * (t * 0.0625))
	t_2 = c + (a * (b * -0.25))
	t_3 = (x * y) + (0.0625 * (z * t))
	tmp = 0
	if (x * y) <= -1.3e+62:
		tmp = t_3
	elif (x * y) <= -1.16e-157:
		tmp = t_2
	elif (x * y) <= -8.4e-221:
		tmp = t_1
	elif (x * y) <= -1.3e-278:
		tmp = t_2
	elif (x * y) <= 9.5e-166:
		tmp = t_1
	elif (x * y) <= 4.1e+74:
		tmp = t_2
	elif (x * y) <= 3.3e+162:
		tmp = t_3
	else:
		tmp = (x * y) - ((a * b) * 0.25)
	return tmp
function code(x, y, z, t, a, b, c)
	t_1 = Float64(c + Float64(z * Float64(t * 0.0625)))
	t_2 = Float64(c + Float64(a * Float64(b * -0.25)))
	t_3 = Float64(Float64(x * y) + Float64(0.0625 * Float64(z * t)))
	tmp = 0.0
	if (Float64(x * y) <= -1.3e+62)
		tmp = t_3;
	elseif (Float64(x * y) <= -1.16e-157)
		tmp = t_2;
	elseif (Float64(x * y) <= -8.4e-221)
		tmp = t_1;
	elseif (Float64(x * y) <= -1.3e-278)
		tmp = t_2;
	elseif (Float64(x * y) <= 9.5e-166)
		tmp = t_1;
	elseif (Float64(x * y) <= 4.1e+74)
		tmp = t_2;
	elseif (Float64(x * y) <= 3.3e+162)
		tmp = t_3;
	else
		tmp = Float64(Float64(x * y) - Float64(Float64(a * b) * 0.25));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	t_1 = c + (z * (t * 0.0625));
	t_2 = c + (a * (b * -0.25));
	t_3 = (x * y) + (0.0625 * (z * t));
	tmp = 0.0;
	if ((x * y) <= -1.3e+62)
		tmp = t_3;
	elseif ((x * y) <= -1.16e-157)
		tmp = t_2;
	elseif ((x * y) <= -8.4e-221)
		tmp = t_1;
	elseif ((x * y) <= -1.3e-278)
		tmp = t_2;
	elseif ((x * y) <= 9.5e-166)
		tmp = t_1;
	elseif ((x * y) <= 4.1e+74)
		tmp = t_2;
	elseif ((x * y) <= 3.3e+162)
		tmp = t_3;
	else
		tmp = (x * y) - ((a * b) * 0.25);
	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[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x * y), $MachinePrecision] + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -1.3e+62], t$95$3, If[LessEqual[N[(x * y), $MachinePrecision], -1.16e-157], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], -8.4e-221], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -1.3e-278], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 9.5e-166], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 4.1e+74], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 3.3e+162], t$95$3, N[(N[(x * y), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \cdot y \leq -1.16 \cdot 10^{-157}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \cdot y \leq -8.4 \cdot 10^{-221}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \cdot y \leq -1.3 \cdot 10^{-278}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \cdot y \leq 9.5 \cdot 10^{-166}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \cdot y \leq 4.1 \cdot 10^{+74}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \cdot y \leq 3.3 \cdot 10^{+162}:\\
\;\;\;\;t_3\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 x y) < -1.29999999999999992e62 or 4.1e74 < (*.f64 x y) < 3.29999999999999987e162

    1. Initial program 95.9%

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

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

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

    if -1.29999999999999992e62 < (*.f64 x y) < -1.15999999999999992e-157 or -8.4000000000000001e-221 < (*.f64 x y) < -1.2999999999999999e-278 or 9.50000000000000046e-166 < (*.f64 x y) < 4.1e74

    1. Initial program 98.6%

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

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

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

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

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

    if -1.15999999999999992e-157 < (*.f64 x y) < -8.4000000000000001e-221 or -1.2999999999999999e-278 < (*.f64 x y) < 9.50000000000000046e-166

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

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

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

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

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

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

    if 3.29999999999999987e162 < (*.f64 x y)

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1.3 \cdot 10^{+62}:\\ \;\;\;\;x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq -1.16 \cdot 10^{-157}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq -8.4 \cdot 10^{-221}:\\ \;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{elif}\;x \cdot y \leq -1.3 \cdot 10^{-278}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 9.5 \cdot 10^{-166}:\\ \;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{elif}\;x \cdot y \leq 4.1 \cdot 10^{+74}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 3.3 \cdot 10^{+162}:\\ \;\;\;\;x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y - \left(a \cdot b\right) \cdot 0.25\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 66.3% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;x \cdot y \leq -6.8 \cdot 10^{-161}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \cdot y \leq -1.7 \cdot 10^{-221}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \cdot y \leq -5.4 \cdot 10^{-280}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \cdot y \leq 2.1 \cdot 10^{-163}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \cdot y \leq 8.2 \cdot 10^{+73}:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -8.2000000000000007e56 or 8.1999999999999996e73 < (*.f64 x y)

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

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

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

    if -8.2000000000000007e56 < (*.f64 x y) < -6.79999999999999964e-161 or -1.7000000000000001e-221 < (*.f64 x y) < -5.39999999999999967e-280 or 2.09999999999999998e-163 < (*.f64 x y) < 8.1999999999999996e73

    1. Initial program 98.6%

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

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

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

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

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

    if -6.79999999999999964e-161 < (*.f64 x y) < -1.7000000000000001e-221 or -5.39999999999999967e-280 < (*.f64 x y) < 2.09999999999999998e-163

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -8.2 \cdot 10^{+56}:\\ \;\;\;\;x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq -6.8 \cdot 10^{-161}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq -1.7 \cdot 10^{-221}:\\ \;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{elif}\;x \cdot y \leq -5.4 \cdot 10^{-280}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 2.1 \cdot 10^{-163}:\\ \;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{elif}\;x \cdot y \leq 8.2 \cdot 10^{+73}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 42.4% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -9 \cdot 10^{+51}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;x \cdot y \leq 5.2 \cdot 10^{-218}:\\
\;\;\;\;c\\

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

\mathbf{elif}\;x \cdot y \leq 1.24 \cdot 10^{+70}:\\
\;\;\;\;c\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -8.9999999999999999e51 or 1.2399999999999999e70 < (*.f64 x y)

    1. Initial program 95.4%

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

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

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

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

    if -8.9999999999999999e51 < (*.f64 x y) < 5.19999999999999966e-218 or 7.50000000000000041e-88 < (*.f64 x y) < 1.2399999999999999e70

    1. Initial program 98.6%

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

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

    if 5.19999999999999966e-218 < (*.f64 x y) < 7.50000000000000041e-88

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

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

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

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

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

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

      \[\leadsto \color{blue}{c - b \cdot \left(a \cdot 0.25\right)} \]
    7. Taylor expanded in c around 0 48.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -9 \cdot 10^{+51}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq 5.2 \cdot 10^{-218}:\\ \;\;\;\;c\\ \mathbf{elif}\;x \cdot y \leq 7.5 \cdot 10^{-88}:\\ \;\;\;\;-0.25 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;x \cdot y \leq 1.24 \cdot 10^{+70}:\\ \;\;\;\;c\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 64.1% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := c + x \cdot y\\
\mathbf{if}\;x \cdot y \leq -1.55 \cdot 10^{+81}:\\
\;\;\;\;t_1\\

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

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -1.55e81 or 1.24999999999999998e-46 < (*.f64 x y)

    1. Initial program 95.0%

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

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

    if -1.55e81 < (*.f64 x y) < -3.5999999999999997e-279

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

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

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

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

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

    if -3.5999999999999997e-279 < (*.f64 x y) < 1.24999999999999998e-46

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

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

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

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

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

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

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

Alternative 7: 86.5% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 90.9%

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

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

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

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

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

    if -5.0000000000000003e230 < (*.f64 a b) < 5.0000000000000002e221

    1. Initial program 98.6%

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

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

    if 5.0000000000000002e221 < (*.f64 a b)

    1. Initial program 92.3%

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

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

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

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

Alternative 8: 87.7% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 90.9%

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

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

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

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

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

    if -5.0000000000000003e230 < (*.f64 a b) < 2e46

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

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

    if 2e46 < (*.f64 a b)

    1. Initial program 96.1%

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

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

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

Alternative 9: 89.6% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 95.0%

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

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

    if -5.0000000000000002e107 < (*.f64 a b) < 2e46

    1. Initial program 98.3%

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

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

    if 2e46 < (*.f64 a b)

    1. Initial program 96.1%

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

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

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

Alternative 10: 65.1% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -1.44999999999999996e79 or 7.2e66 < (*.f64 x y)

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

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

    if -1.44999999999999996e79 < (*.f64 x y) < 7.2e66

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

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

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

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

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

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

Alternative 11: 63.0% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.3 \cdot 10^{+221} \lor \neg \left(a \cdot b \leq 2.1 \cdot 10^{+183}\right):\\
\;\;\;\;-0.25 \cdot \left(a \cdot b\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -1.30000000000000002e221 or 2.1e183 < (*.f64 a b)

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

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

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

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

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

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

      \[\leadsto \color{blue}{c - b \cdot \left(a \cdot 0.25\right)} \]
    7. Taylor expanded in c around 0 78.7%

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

    if -1.30000000000000002e221 < (*.f64 a b) < 2.1e183

    1. Initial program 98.6%

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

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

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

Alternative 12: 38.7% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{-27}:\\
\;\;\;\;x \cdot y\\

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

\mathbf{elif}\;y \leq 5.4 \cdot 10^{-27}:\\
\;\;\;\;c\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -9.50000000000000037e-27 or 5.39999999999999978e-27 < y

    1. Initial program 96.1%

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

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

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

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

    if -9.50000000000000037e-27 < y < -7.99999999999999944e-272

    1. Initial program 98.5%

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

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

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

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

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

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

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

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

    if -7.99999999999999944e-272 < y < 5.39999999999999978e-27

    1. Initial program 98.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{-27}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq -8 \cdot 10^{-272}:\\ \;\;\;\;t \cdot \left(z \cdot 0.0625\right)\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{-27}:\\ \;\;\;\;c\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 42.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -7.2 \cdot 10^{+51} \lor \neg \left(x \cdot y \leq 1.1 \cdot 10^{+70}\right):\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -7.20000000000000022e51 or 1.1e70 < (*.f64 x y)

    1. Initial program 95.4%

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

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

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

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

    if -7.20000000000000022e51 < (*.f64 x y) < 1.1e70

    1. Initial program 98.7%

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

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

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

Alternative 14: 97.6% 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 97.3%

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

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

Alternative 15: 22.3% accurate, 17.0× speedup?

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

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

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

    \[\leadsto \color{blue}{c} \]
  4. Final simplification25.3%

    \[\leadsto c \]
  5. Add Preprocessing

Reproduce

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