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

Percentage Accurate: 97.8% → 98.9%
Time: 8.3s
Alternatives: 16
Speedup: 0.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 16 alternatives:

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

Initial Program: 97.8% accurate, 1.0× speedup?

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

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

Alternative 1: 98.9% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.8% accurate, 0.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) 16)) (/.f64 (*.f64 a b) 4)) < +inf.0

    1. Initial program 100.0%

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

    if +inf.0 < (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) 16)) (/.f64 (*.f64 a b) 4))

    1. Initial program 0.0%

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

      \[\leadsto \color{blue}{\left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - 0.25 \cdot \left(a \cdot b\right)} \]
    3. Step-by-step derivation
      1. sub-neg20.0%

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

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

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

        \[\leadsto 0.0625 \cdot \color{blue}{\left(z \cdot t\right)} + \left(c + \left(-0.25 \cdot \left(a \cdot b\right)\right)\right) \]
      5. associate-*r*20.0%

        \[\leadsto \color{blue}{\left(0.0625 \cdot z\right) \cdot t} + \left(c + \left(-0.25 \cdot \left(a \cdot b\right)\right)\right) \]
      6. fma-def80.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.0625 \cdot z, t, c + \left(-0.25 \cdot \left(a \cdot b\right)\right)\right)} \]
      7. *-commutative80.0%

        \[\leadsto \mathsf{fma}\left(0.0625 \cdot z, t, c + \left(-\color{blue}{\left(a \cdot b\right) \cdot 0.25}\right)\right) \]
      8. distribute-rgt-neg-in80.0%

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

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

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

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

Alternative 3: 98.5% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) 16)) (/.f64 (*.f64 a b) 4)) < +inf.0

    1. Initial program 100.0%

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

    if +inf.0 < (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) 16)) (/.f64 (*.f64 a b) 4))

    1. Initial program 0.0%

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

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

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

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

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

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

Alternative 4: 65.0% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;b \cdot a \leq -2 \cdot 10^{-86}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;b \cdot a \leq 5 \cdot 10^{-43}:\\
\;\;\;\;t_1\\

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

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 a b) < -1.9999999999999999e45 or 2.0000000000000002e54 < (*.f64 a b)

    1. Initial program 95.1%

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

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

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

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

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

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

    if -1.9999999999999999e45 < (*.f64 a b) < -2.00000000000000017e-86 or -5.0000000000000002e-174 < (*.f64 a b) < 5.00000000000000019e-43

    1. Initial program 100.0%

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

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

    if -2.00000000000000017e-86 < (*.f64 a b) < -5.0000000000000002e-174

    1. Initial program 99.9%

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

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

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

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

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

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

    if 5.00000000000000019e-43 < (*.f64 a b) < 2.0000000000000002e54

    1. Initial program 100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \cdot a \leq -2 \cdot 10^{+45}:\\ \;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\ \mathbf{elif}\;b \cdot a \leq -2 \cdot 10^{-86}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{elif}\;b \cdot a \leq -5 \cdot 10^{-174}:\\ \;\;\;\;c + t \cdot \left(z \cdot 0.0625\right)\\ \mathbf{elif}\;b \cdot a \leq 5 \cdot 10^{-43}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{elif}\;b \cdot a \leq 2 \cdot 10^{+54}:\\ \;\;\;\;0.0625 \cdot \left(t \cdot z\right) + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\ \end{array} \]

Alternative 5: 89.4% accurate, 0.7× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -4.9999999999999997e162 or 2.0000000000000002e54 < (*.f64 a b)

    1. Initial program 94.2%

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

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

    if -4.9999999999999997e162 < (*.f64 a b) < -1.9999999999999999e45

    1. Initial program 100.0%

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

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

    if -1.9999999999999999e45 < (*.f64 a b) < 2.0000000000000002e54

    1. Initial program 100.0%

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

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

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

Alternative 6: 64.6% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;b \cdot a \leq -2 \cdot 10^{-86}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;b \cdot a \leq 2 \cdot 10^{+54}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


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

    1. Initial program 95.1%

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

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

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

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

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

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

    if -1.9999999999999999e45 < (*.f64 a b) < -2.00000000000000017e-86 or -1.99999999999999992e-164 < (*.f64 a b) < 2.0000000000000002e54

    1. Initial program 100.0%

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

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

    if -2.00000000000000017e-86 < (*.f64 a b) < -1.99999999999999992e-164

    1. Initial program 99.9%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \cdot a \leq -2 \cdot 10^{+45}:\\ \;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\ \mathbf{elif}\;b \cdot a \leq -2 \cdot 10^{-86}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{elif}\;b \cdot a \leq -2 \cdot 10^{-164}:\\ \;\;\;\;c + t \cdot \left(z \cdot 0.0625\right)\\ \mathbf{elif}\;b \cdot a \leq 2 \cdot 10^{+54}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\ \end{array} \]

Alternative 7: 88.4% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;b \cdot a \leq -2 \cdot 10^{+45} \lor \neg \left(b \cdot a \leq 2 \cdot 10^{+28}\right):\\
\;\;\;\;\left(c + x \cdot y\right) - t_1\\

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


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

    1. Initial program 92.9%

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

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

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

    if -4.9999999999999997e162 < (*.f64 a b) < -1.9999999999999999e45 or 1.99999999999999992e28 < (*.f64 a b)

    1. Initial program 96.9%

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

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

    if -1.9999999999999999e45 < (*.f64 a b) < 1.99999999999999992e28

    1. Initial program 100.0%

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

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

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

Alternative 8: 44.0% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;b \cdot a \leq -7.5 \cdot 10^{-87}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;b \cdot a \leq -4.4 \cdot 10^{-185}:\\
\;\;\;\;c\\

\mathbf{elif}\;b \cdot a \leq 4.6 \cdot 10^{+55}:\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -9.8000000000000004e42 or 4.59999999999999975e55 < (*.f64 a b)

    1. Initial program 95.1%

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

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

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

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

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

    if -9.8000000000000004e42 < (*.f64 a b) < -7.5000000000000002e-87 or -4.4000000000000001e-185 < (*.f64 a b) < 4.59999999999999975e55

    1. Initial program 100.0%

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

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

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

    if -7.5000000000000002e-87 < (*.f64 a b) < -4.4000000000000001e-185

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \cdot a \leq -9.8 \cdot 10^{+42}:\\ \;\;\;\;\left(b \cdot a\right) \cdot -0.25\\ \mathbf{elif}\;b \cdot a \leq -7.5 \cdot 10^{-87}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;b \cdot a \leq -4.4 \cdot 10^{-185}:\\ \;\;\;\;c\\ \mathbf{elif}\;b \cdot a \leq 4.6 \cdot 10^{+55}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot a\right) \cdot -0.25\\ \end{array} \]

Alternative 9: 84.1% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \cdot a \leq -2 \cdot 10^{+45}:\\
\;\;\;\;x \cdot y - \left(b \cdot a\right) \cdot 0.25\\

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

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


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

    1. Initial program 94.8%

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

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

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

    if -1.9999999999999999e45 < (*.f64 a b) < 2.0000000000000002e54

    1. Initial program 100.0%

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

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

    if 2.0000000000000002e54 < (*.f64 a b)

    1. Initial program 95.5%

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

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

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

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

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

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

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

Alternative 10: 85.7% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 92.7%

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

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

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

    if -9.9999999999999993e167 < (*.f64 a b) < 2.0000000000000002e54

    1. Initial program 100.0%

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

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

    if 2.0000000000000002e54 < (*.f64 a b)

    1. Initial program 95.5%

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

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

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

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

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

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

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

Alternative 11: 60.4% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1 \cdot 10^{+75}:\\
\;\;\;\;x \cdot y - \left(b \cdot a\right) \cdot 0.25\\

\mathbf{elif}\;a \leq -1 \cdot 10^{-18}:\\
\;\;\;\;c + t \cdot \left(z \cdot 0.0625\right)\\

\mathbf{elif}\;a \leq -7.5 \cdot 10^{-138}:\\
\;\;\;\;0.0625 \cdot \left(t \cdot z\right) + x \cdot y\\

\mathbf{elif}\;a \leq 1.9 \cdot 10^{-68}:\\
\;\;\;\;c + x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if a < -9.99999999999999927e74

    1. Initial program 94.3%

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

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

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

    if -9.99999999999999927e74 < a < -1.0000000000000001e-18

    1. Initial program 100.0%

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

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

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

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

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

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

    if -1.0000000000000001e-18 < a < -7.4999999999999995e-138

    1. Initial program 100.0%

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

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

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

    if -7.4999999999999995e-138 < a < 1.90000000000000019e-68

    1. Initial program 100.0%

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

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

    if 1.90000000000000019e-68 < a

    1. Initial program 96.6%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1 \cdot 10^{+75}:\\ \;\;\;\;x \cdot y - \left(b \cdot a\right) \cdot 0.25\\ \mathbf{elif}\;a \leq -1 \cdot 10^{-18}:\\ \;\;\;\;c + t \cdot \left(z \cdot 0.0625\right)\\ \mathbf{elif}\;a \leq -7.5 \cdot 10^{-138}:\\ \;\;\;\;0.0625 \cdot \left(t \cdot z\right) + x \cdot y\\ \mathbf{elif}\;a \leq 1.9 \cdot 10^{-68}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\ \end{array} \]

Alternative 12: 64.9% accurate, 1.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -1.9999999999999999e45 or 2.0000000000000002e54 < (*.f64 a b)

    1. Initial program 95.1%

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

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

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

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

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

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

    if -1.9999999999999999e45 < (*.f64 a b) < 2.0000000000000002e54

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \cdot a \leq -2 \cdot 10^{+45} \lor \neg \left(b \cdot a \leq 2 \cdot 10^{+54}\right):\\ \;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;c + x \cdot y\\ \end{array} \]

Alternative 13: 37.9% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;z \leq -1.2 \cdot 10^{-99}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;z \leq -4.4 \cdot 10^{-304}:\\
\;\;\;\;c\\

\mathbf{elif}\;z \leq 2 \cdot 10^{-85}:\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.59999999999999995e119 or 2e-85 < z

    1. Initial program 95.4%

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

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

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

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

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

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

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

    if -1.59999999999999995e119 < z < -1.2e-99 or -4.4e-304 < z < 2e-85

    1. Initial program 100.0%

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

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

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

    if -1.2e-99 < z < -4.4e-304

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.6 \cdot 10^{+119}:\\ \;\;\;\;0.0625 \cdot \left(t \cdot z\right)\\ \mathbf{elif}\;z \leq -1.2 \cdot 10^{-99}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;z \leq -4.4 \cdot 10^{-304}:\\ \;\;\;\;c\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-85}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;0.0625 \cdot \left(t \cdot z\right)\\ \end{array} \]

Alternative 14: 63.1% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \cdot a \leq -1 \cdot 10^{+162} \lor \neg \left(b \cdot a \leq 1.2 \cdot 10^{+109}\right):\\
\;\;\;\;\left(b \cdot a\right) \cdot -0.25\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -9.9999999999999994e161 or 1.19999999999999994e109 < (*.f64 a b)

    1. Initial program 93.6%

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

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

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

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

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

    if -9.9999999999999994e161 < (*.f64 a b) < 1.19999999999999994e109

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \cdot a \leq -1 \cdot 10^{+162} \lor \neg \left(b \cdot a \leq 1.2 \cdot 10^{+109}\right):\\ \;\;\;\;\left(b \cdot a\right) \cdot -0.25\\ \mathbf{else}:\\ \;\;\;\;c + x \cdot y\\ \end{array} \]

Alternative 15: 36.2% accurate, 2.4× speedup?

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

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

\mathbf{elif}\;x \leq 3.4 \cdot 10^{-124}:\\
\;\;\;\;c\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.01e62 or 3.4000000000000001e-124 < x

    1. Initial program 98.5%

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

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

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

    if -1.01e62 < x < 3.4000000000000001e-124

    1. Initial program 97.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.01 \cdot 10^{+62}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \leq 3.4 \cdot 10^{-124}:\\ \;\;\;\;c\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]

Alternative 16: 21.7% 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.0%

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

    \[\leadsto \color{blue}{c} \]
  3. Final simplification22.7%

    \[\leadsto c \]

Reproduce

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