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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.2% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 65.3% accurate, 0.4× speedup?

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -2e176 or 2.0000000000000002e44 < (*.f64 x y)

    1. Initial program 95.5%

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

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

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

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

    if -2e176 < (*.f64 x y) < -1.99999999999999988e-98 or 1.9999999999999998e-198 < (*.f64 x y) < 2.0000000000000002e44

    1. Initial program 100.0%

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

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

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

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

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

    if -1.99999999999999988e-98 < (*.f64 x y) < 1.9999999999999998e-198

    1. Initial program 100.0%

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

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

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

Alternative 4: 65.7% accurate, 0.5× speedup?

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

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

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

\mathbf{elif}\;x \cdot y \leq 1.46 \cdot 10^{-198}:\\
\;\;\;\;c + t\_2\\

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

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


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

    1. Initial program 95.5%

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

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

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

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

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

    if -1.89999999999999995e150 < (*.f64 x y) < -1.85e-103 or 1.46e-198 < (*.f64 x y) < 6.7999999999999996e47

    1. Initial program 100.0%

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

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

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

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

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

    if -1.85e-103 < (*.f64 x y) < 1.46e-198

    1. Initial program 100.0%

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

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

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

Alternative 5: 64.3% accurate, 0.5× speedup?

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -6.1000000000000001e178 or 2.2000000000000001e39 < (*.f64 x y)

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

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

    if -6.1000000000000001e178 < (*.f64 x y) < -7.00000000000000057e-104 or 1.5000000000000001e-198 < (*.f64 x y) < 2.2000000000000001e39

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

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

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

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

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

    if -7.00000000000000057e-104 < (*.f64 x y) < 1.5000000000000001e-198

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -6.1 \cdot 10^{+178}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -7 \cdot 10^{-104}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 1.5 \cdot 10^{-198}:\\ \;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;x \cdot y \leq 2.2 \cdot 10^{+39}:\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;c + x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 75.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.1 \cdot 10^{+222} \lor \neg \left(a \leq -2.9 \cdot 10^{+153}\right) \land \left(a \leq -7.5 \cdot 10^{+133} \lor \neg \left(a \leq 1.1 \cdot 10^{-15}\right)\right):\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.1000000000000001e222 or -2.90000000000000002e153 < a < -7.49999999999999992e133 or 1.09999999999999993e-15 < a

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

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

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

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

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

    if -1.1000000000000001e222 < a < -2.90000000000000002e153 or -7.49999999999999992e133 < a < 1.09999999999999993e-15

    1. Initial program 98.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 a around 0 82.8%

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

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

Alternative 7: 86.9% accurate, 0.6× speedup?

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

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

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

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


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

    1. Initial program 94.6%

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

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

    if -5.0000000000000002e147 < (*.f64 a b) < 1e-84

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

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

    if 1e-84 < (*.f64 a b)

    1. Initial program 100.0%

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

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

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

Alternative 8: 88.9% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+147} \lor \neg \left(a \cdot b \leq 6 \cdot 10^{+102}\right):\\
\;\;\;\;c + \left(x \cdot y - \left(a \cdot b\right) \cdot 0.25\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -5.0000000000000002e147 or 5.9999999999999996e102 < (*.f64 a b)

    1. Initial program 97.4%

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

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

    if -5.0000000000000002e147 < (*.f64 a b) < 5.9999999999999996e102

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

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

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

Alternative 9: 64.8% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2.8 \cdot 10^{+176} \lor \neg \left(x \cdot y \leq 1.35 \cdot 10^{+39}\right):\\
\;\;\;\;c + x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -2.8000000000000002e176 or 1.35000000000000002e39 < (*.f64 x y)

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

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

    if -2.8000000000000002e176 < (*.f64 x y) < 1.35000000000000002e39

    1. Initial program 100.0%

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

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

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

Alternative 10: 44.2% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2.8 \cdot 10^{+176} \lor \neg \left(x \cdot y \leq 4.15 \cdot 10^{+43}\right):\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -2.8000000000000002e176 or 4.14999999999999979e43 < (*.f64 x y)

    1. Initial program 95.5%

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

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

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

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

    if -2.8000000000000002e176 < (*.f64 x y) < 4.14999999999999979e43

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

Alternative 11: 41.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2.8 \cdot 10^{+176} \lor \neg \left(x \cdot y \leq 9 \cdot 10^{+46}\right):\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -2.8000000000000002e176 or 9.00000000000000019e46 < (*.f64 x y)

    1. Initial program 95.5%

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

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

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

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

    if -2.8000000000000002e176 < (*.f64 x y) < 9.00000000000000019e46

    1. Initial program 100.0%

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

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

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

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

Alternative 12: 97.8% accurate, 1.0× speedup?

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

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

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

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

Alternative 13: 51.6% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+147} \lor \neg \left(z \leq 1.95 \cdot 10^{-90}\right):\\
\;\;\;\;t \cdot \left(z \cdot 0.0625\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.8000000000000001e147 or 1.95000000000000002e-90 < z

    1. Initial program 96.8%

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

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

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

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

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

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

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

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

    if -2.8000000000000001e147 < z < 1.95000000000000002e-90

    1. Initial program 100.0%

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

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

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

Alternative 14: 22.5% accurate, 17.0× speedup?

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

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

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

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

    \[\leadsto \color{blue}{c} \]
  5. Final simplification20.0%

    \[\leadsto c \]
  6. Add Preprocessing

Reproduce

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