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

Percentage Accurate: 97.8% → 98.3%
Time: 15.3s
Alternatives: 12
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 12 alternatives:

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

Initial Program: 97.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.3% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

    \[\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. Add Preprocessing

Alternative 2: 38.7% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;y \leq -1.8 \cdot 10^{-101}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq -4.2 \cdot 10^{-245}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;y \leq 1.65 \cdot 10^{-281}:\\
\;\;\;\;c\\

\mathbf{elif}\;y \leq 2.65 \cdot 10^{-229}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;y \leq 1.32 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -4.79999999999999973e-17 or 1.32000000000000013e108 < y

    1. Initial program 99.1%

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(x - 0.25 \cdot \frac{a \cdot b}{y}\right)} \]
    6. Taylor expanded in x around inf 45.6%

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

    if -4.79999999999999973e-17 < y < -1.8e-101 or 2.64999999999999999e-229 < y < 1.32000000000000013e108

    1. Initial program 99.0%

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

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

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

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

    if -1.8e-101 < y < -4.2000000000000002e-245 or 1.65e-281 < y < 2.64999999999999999e-229

    1. Initial program 100.0%

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

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

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

      \[\leadsto \color{blue}{a \cdot \left(\frac{x \cdot y}{a} - 0.25 \cdot b\right)} \]
    6. Taylor expanded in a around inf 42.4%

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

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

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

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

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

    if -4.2000000000000002e-245 < y < 1.65e-281

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.8 \cdot 10^{-17}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq -1.8 \cdot 10^{-101}:\\ \;\;\;\;0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;y \leq -4.2 \cdot 10^{-245}:\\ \;\;\;\;a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;y \leq 1.65 \cdot 10^{-281}:\\ \;\;\;\;c\\ \mathbf{elif}\;y \leq 2.65 \cdot 10^{-229}:\\ \;\;\;\;a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;y \leq 1.32 \cdot 10^{+108}:\\ \;\;\;\;0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 36.8% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{if}\;t \leq -5.2 \cdot 10^{-139}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 7.2 \cdot 10^{-285}:\\ \;\;\;\;c\\ \mathbf{elif}\;t \leq 7.5 \cdot 10^{-170}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;t \leq 2.3 \cdot 10^{-114}:\\ \;\;\;\;c\\ \mathbf{elif}\;t \leq 3.2 \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 (* 0.0625 (* z t))))
   (if (<= t -5.2e-139)
     t_1
     (if (<= t 7.2e-285)
       c
       (if (<= t 7.5e-170)
         (* x y)
         (if (<= t 2.3e-114) c (if (<= t 3.2e+55) (* 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 * (z * t);
	double tmp;
	if (t <= -5.2e-139) {
		tmp = t_1;
	} else if (t <= 7.2e-285) {
		tmp = c;
	} else if (t <= 7.5e-170) {
		tmp = x * y;
	} else if (t <= 2.3e-114) {
		tmp = c;
	} else if (t <= 3.2e+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 = 0.0625d0 * (z * t)
    if (t <= (-5.2d-139)) then
        tmp = t_1
    else if (t <= 7.2d-285) then
        tmp = c
    else if (t <= 7.5d-170) then
        tmp = x * y
    else if (t <= 2.3d-114) then
        tmp = c
    else if (t <= 3.2d+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 = 0.0625 * (z * t);
	double tmp;
	if (t <= -5.2e-139) {
		tmp = t_1;
	} else if (t <= 7.2e-285) {
		tmp = c;
	} else if (t <= 7.5e-170) {
		tmp = x * y;
	} else if (t <= 2.3e-114) {
		tmp = c;
	} else if (t <= 3.2e+55) {
		tmp = x * y;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = 0.0625 * (z * t)
	tmp = 0
	if t <= -5.2e-139:
		tmp = t_1
	elif t <= 7.2e-285:
		tmp = c
	elif t <= 7.5e-170:
		tmp = x * y
	elif t <= 2.3e-114:
		tmp = c
	elif t <= 3.2e+55:
		tmp = x * y
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c)
	t_1 = Float64(0.0625 * Float64(z * t))
	tmp = 0.0
	if (t <= -5.2e-139)
		tmp = t_1;
	elseif (t <= 7.2e-285)
		tmp = c;
	elseif (t <= 7.5e-170)
		tmp = Float64(x * y);
	elseif (t <= 2.3e-114)
		tmp = c;
	elseif (t <= 3.2e+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 = 0.0625 * (z * t);
	tmp = 0.0;
	if (t <= -5.2e-139)
		tmp = t_1;
	elseif (t <= 7.2e-285)
		tmp = c;
	elseif (t <= 7.5e-170)
		tmp = x * y;
	elseif (t <= 2.3e-114)
		tmp = c;
	elseif (t <= 3.2e+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[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -5.2e-139], t$95$1, If[LessEqual[t, 7.2e-285], c, If[LessEqual[t, 7.5e-170], N[(x * y), $MachinePrecision], If[LessEqual[t, 2.3e-114], c, If[LessEqual[t, 3.2e+55], N[(x * y), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq 7.2 \cdot 10^{-285}:\\
\;\;\;\;c\\

\mathbf{elif}\;t \leq 7.5 \cdot 10^{-170}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;t \leq 2.3 \cdot 10^{-114}:\\
\;\;\;\;c\\

\mathbf{elif}\;t \leq 3.2 \cdot 10^{+55}:\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -5.1999999999999996e-139 or 3.2000000000000003e55 < t

    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 y around inf 86.2%

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

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

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

    if -5.1999999999999996e-139 < t < 7.20000000000000008e-285 or 7.4999999999999998e-170 < t < 2.2999999999999999e-114

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

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

    if 7.20000000000000008e-285 < t < 7.4999999999999998e-170 or 2.2999999999999999e-114 < t < 3.2000000000000003e55

    1. Initial program 97.2%

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(x - 0.25 \cdot \frac{a \cdot b}{y}\right)} \]
    6. Taylor expanded in x around inf 38.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -5.2 \cdot 10^{-139}:\\ \;\;\;\;0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;t \leq 7.2 \cdot 10^{-285}:\\ \;\;\;\;c\\ \mathbf{elif}\;t \leq 7.5 \cdot 10^{-170}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;t \leq 2.3 \cdot 10^{-114}:\\ \;\;\;\;c\\ \mathbf{elif}\;t \leq 3.2 \cdot 10^{+55}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;0.0625 \cdot \left(z \cdot t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 55.3% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;y \leq -3 \cdot 10^{-100}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;y \leq 6.6 \cdot 10^{+106}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -1.08e-16

    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 y around inf 99.9%

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

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

      \[\leadsto \color{blue}{y \cdot \left(x - 0.25 \cdot \frac{a \cdot b}{y}\right)} \]
    6. Taylor expanded in x around inf 40.2%

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

    if -1.08e-16 < y < -3.0000000000000001e-100 or 4.89999999999999965e-235 < y < 6.60000000000000015e106

    1. Initial program 99.0%

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

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

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

    if -3.0000000000000001e-100 < y < 4.89999999999999965e-235

    1. Initial program 100.0%

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

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

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

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

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

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

    if 6.60000000000000015e106 < y

    1. Initial program 97.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 y around inf 97.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.08 \cdot 10^{-16}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq -3 \cdot 10^{-100}:\\ \;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;y \leq 4.9 \cdot 10^{-235}:\\ \;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\ \mathbf{elif}\;y \leq 6.6 \cdot 10^{+106}:\\ \;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;c + x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 53.1% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;t \leq 3.8 \cdot 10^{-206}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;t \leq 9 \cdot 10^{+58}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2e-8 or 8.9999999999999996e58 < t

    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 y around inf 85.2%

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

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

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

    if -2e-8 < t < 3.80000000000000003e-206 or 1.15e-185 < t < 8.9999999999999996e58

    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 y around inf 91.0%

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

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

    if 3.80000000000000003e-206 < t < 1.15e-185

    1. Initial program 100.0%

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

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

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

      \[\leadsto \color{blue}{a \cdot \left(\frac{x \cdot y}{a} - 0.25 \cdot b\right)} \]
    6. Taylor expanded in a around inf 45.8%

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

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

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

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

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

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

Alternative 6: 87.8% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 100.0%

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

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

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

    if -3.9999999999999998e197 < (*.f64 a b) < 9.99999999999999921e133

    1. Initial program 99.5%

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

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

    if 9.99999999999999921e133 < (*.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 92.0%

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

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

Alternative 7: 86.8% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 100.0%

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

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

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

    if -3.9999999999999998e197 < (*.f64 a b) < 9.99999999999999921e133

    1. Initial program 99.5%

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

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

    if 9.99999999999999921e133 < (*.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 92.0%

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

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

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

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

Alternative 8: 60.4% accurate, 0.7× speedup?

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

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

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

\mathbf{elif}\;y \leq 3.7 \cdot 10^{+101}:\\
\;\;\;\;c + t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -7.5000000000000001e-101 or 3.6999999999999997e101 < y

    1. Initial program 99.3%

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

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

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

    if -7.5000000000000001e-101 < y < 5.9999999999999997e-235

    1. Initial program 100.0%

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

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

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

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

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

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

    if 5.9999999999999997e-235 < y < 3.6999999999999997e101

    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 y around inf 84.4%

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

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

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

Alternative 9: 59.4% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+129} \lor \neg \left(z \leq 4 \cdot 10^{-48}\right):\\
\;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.3999999999999999e129 or 3.9999999999999999e-48 < z

    1. Initial program 98.5%

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

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

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

    if -2.3999999999999999e129 < z < 3.9999999999999999e-48

    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 y around inf 91.6%

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

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

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

Alternative 10: 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 99.3%

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

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

Alternative 11: 35.9% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.6 \cdot 10^{-44} \lor \neg \left(y \leq 1.85 \cdot 10^{+101}\right):\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.59999999999999996e-44 or 1.8499999999999999e101 < y

    1. Initial program 99.2%

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(x - 0.25 \cdot \frac{a \cdot b}{y}\right)} \]
    6. Taylor expanded in x around inf 42.2%

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

    if -4.59999999999999996e-44 < y < 1.8499999999999999e101

    1. Initial program 99.3%

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

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

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

Alternative 12: 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 99.3%

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

    \[\leadsto \color{blue}{c} \]
  4. Add Preprocessing

Reproduce

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