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

Percentage Accurate: 97.9% → 97.9%
Time: 2.2s
Alternatives: 9
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 9 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.9% 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: 97.9% 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}
Derivation
  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. Add Preprocessing

Alternative 2: 91.0% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot y + \frac{z \cdot t}{16}\\
t_2 := t\_1 - \frac{a \cdot b}{4}\\
\mathbf{if}\;a \cdot b \leq -6 \cdot 10^{+59}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;a \cdot b \leq 3.6 \cdot 10^{+39}:\\
\;\;\;\;t\_1 + c\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -6.0000000000000001e59 or 3.59999999999999984e39 < (*.f64 a b)

    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 x around 0

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

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

    if -6.0000000000000001e59 < (*.f64 a b) < 3.59999999999999984e39

    1. Initial program 98.5%

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

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

      \[\leadsto \color{blue}{\left(x \cdot y + \frac{z \cdot t}{16}\right)} + c \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 68.7% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot y - \frac{a \cdot b}{4}\\ \mathbf{if}\;a \cdot b \leq -9.5 \cdot 10^{+124}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \cdot b \leq 3.9 \cdot 10^{-51}:\\ \;\;\;\;x \cdot y + \frac{z \cdot t}{16}\\ \mathbf{elif}\;a \cdot b \leq 3.6 \cdot 10^{+39}:\\ \;\;\;\;x \cdot y + c\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (- (* x y) (/ (* a b) 4.0))))
   (if (<= (* a b) -9.5e+124)
     t_1
     (if (<= (* a b) 3.9e-51)
       (+ (* x y) (/ (* z t) 16.0))
       (if (<= (* a b) 3.6e+39) (+ (* x y) c) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = (x * y) - ((a * b) / 4.0);
	double tmp;
	if ((a * b) <= -9.5e+124) {
		tmp = t_1;
	} else if ((a * b) <= 3.9e-51) {
		tmp = (x * y) + ((z * t) / 16.0);
	} else if ((a * b) <= 3.6e+39) {
		tmp = (x * y) + c;
	} 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 = (x * y) - ((a * b) / 4.0d0)
    if ((a * b) <= (-9.5d+124)) then
        tmp = t_1
    else if ((a * b) <= 3.9d-51) then
        tmp = (x * y) + ((z * t) / 16.0d0)
    else if ((a * b) <= 3.6d+39) then
        tmp = (x * y) + c
    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 = (x * y) - ((a * b) / 4.0);
	double tmp;
	if ((a * b) <= -9.5e+124) {
		tmp = t_1;
	} else if ((a * b) <= 3.9e-51) {
		tmp = (x * y) + ((z * t) / 16.0);
	} else if ((a * b) <= 3.6e+39) {
		tmp = (x * y) + c;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = (x * y) - ((a * b) / 4.0)
	tmp = 0
	if (a * b) <= -9.5e+124:
		tmp = t_1
	elif (a * b) <= 3.9e-51:
		tmp = (x * y) + ((z * t) / 16.0)
	elif (a * b) <= 3.6e+39:
		tmp = (x * y) + c
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c)
	t_1 = Float64(Float64(x * y) - Float64(Float64(a * b) / 4.0))
	tmp = 0.0
	if (Float64(a * b) <= -9.5e+124)
		tmp = t_1;
	elseif (Float64(a * b) <= 3.9e-51)
		tmp = Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0));
	elseif (Float64(a * b) <= 3.6e+39)
		tmp = Float64(Float64(x * y) + c);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	t_1 = (x * y) - ((a * b) / 4.0);
	tmp = 0.0;
	if ((a * b) <= -9.5e+124)
		tmp = t_1;
	elseif ((a * b) <= 3.9e-51)
		tmp = (x * y) + ((z * t) / 16.0);
	elseif ((a * b) <= 3.6e+39)
		tmp = (x * y) + c;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -9.5e+124], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 3.9e-51], N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 3.6e+39], N[(N[(x * y), $MachinePrecision] + c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot y - \frac{a \cdot b}{4}\\
\mathbf{if}\;a \cdot b \leq -9.5 \cdot 10^{+124}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;a \cdot b \leq 3.9 \cdot 10^{-51}:\\
\;\;\;\;x \cdot y + \frac{z \cdot t}{16}\\

\mathbf{elif}\;a \cdot b \leq 3.6 \cdot 10^{+39}:\\
\;\;\;\;x \cdot y + c\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -9.50000000000000004e124 or 3.59999999999999984e39 < (*.f64 a b)

    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 x around 0

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

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

      \[\leadsto \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right) - \frac{\color{blue}{a \cdot b}}{4} \]
    6. Applied rewrites83.7%

      \[\leadsto x \cdot y - \frac{\color{blue}{a \cdot b}}{4} \]

    if -9.50000000000000004e124 < (*.f64 a b) < 3.8999999999999997e-51

    1. Initial program 98.5%

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

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

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

      \[\leadsto \frac{1}{16} \cdot \left(t \cdot z\right) - \color{blue}{\frac{1}{4} \cdot \left(a \cdot b\right)} \]
    6. Applied rewrites70.6%

      \[\leadsto x \cdot y + \color{blue}{\frac{z \cdot t}{16}} \]

    if 3.8999999999999997e-51 < (*.f64 a b) < 3.59999999999999984e39

    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

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

      \[\leadsto \color{blue}{x \cdot y} + c \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 4: 89.4% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;a \cdot b \leq 80:\\
\;\;\;\;\left(x \cdot y + \frac{z \cdot t}{16}\right) + c\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -9.80000000000000069e124 or 80 < (*.f64 a b)

    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 x around 0

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

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

      \[\leadsto \frac{1}{16} \cdot \left(t \cdot z\right) - \frac{\color{blue}{a \cdot b}}{4} \]
    6. Applied rewrites89.3%

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

    if -9.80000000000000069e124 < (*.f64 a b) < 80

    1. Initial program 98.6%

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

      \[\leadsto \color{blue}{\left(\frac{1}{16} \cdot \left(t \cdot z\right) - \frac{1}{4} \cdot \left(a \cdot b\right)\right)} + c \]
    4. Applied rewrites94.6%

      \[\leadsto \color{blue}{\left(x \cdot y + \frac{z \cdot t}{16}\right)} + c \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 86.8% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot y + \frac{z \cdot t}{16}\\ \mathbf{if}\;z \cdot t \leq -1.65 \cdot 10^{+143}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \cdot t \leq 4.5 \cdot 10^{+89}:\\ \;\;\;\;\left(x \cdot y + c\right) - \frac{a \cdot b}{4}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (+ (* x y) (/ (* z t) 16.0))))
   (if (<= (* z t) -1.65e+143)
     t_1
     (if (<= (* z t) 4.5e+89) (- (+ (* x y) c) (/ (* a b) 4.0)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = (x * y) + ((z * t) / 16.0);
	double tmp;
	if ((z * t) <= -1.65e+143) {
		tmp = t_1;
	} else if ((z * t) <= 4.5e+89) {
		tmp = ((x * y) + c) - ((a * b) / 4.0);
	} 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 = (x * y) + ((z * t) / 16.0d0)
    if ((z * t) <= (-1.65d+143)) then
        tmp = t_1
    else if ((z * t) <= 4.5d+89) then
        tmp = ((x * y) + c) - ((a * b) / 4.0d0)
    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 = (x * y) + ((z * t) / 16.0);
	double tmp;
	if ((z * t) <= -1.65e+143) {
		tmp = t_1;
	} else if ((z * t) <= 4.5e+89) {
		tmp = ((x * y) + c) - ((a * b) / 4.0);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = (x * y) + ((z * t) / 16.0)
	tmp = 0
	if (z * t) <= -1.65e+143:
		tmp = t_1
	elif (z * t) <= 4.5e+89:
		tmp = ((x * y) + c) - ((a * b) / 4.0)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c)
	t_1 = Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0))
	tmp = 0.0
	if (Float64(z * t) <= -1.65e+143)
		tmp = t_1;
	elseif (Float64(z * t) <= 4.5e+89)
		tmp = Float64(Float64(Float64(x * y) + c) - Float64(Float64(a * b) / 4.0));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	t_1 = (x * y) + ((z * t) / 16.0);
	tmp = 0.0;
	if ((z * t) <= -1.65e+143)
		tmp = t_1;
	elseif ((z * t) <= 4.5e+89)
		tmp = ((x * y) + c) - ((a * b) / 4.0);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -1.65e+143], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 4.5e+89], N[(N[(N[(x * y), $MachinePrecision] + c), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot y + \frac{z \cdot t}{16}\\
\mathbf{if}\;z \cdot t \leq -1.65 \cdot 10^{+143}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \cdot t \leq 4.5 \cdot 10^{+89}:\\
\;\;\;\;\left(x \cdot y + c\right) - \frac{a \cdot b}{4}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -1.65e143 or 4.5e89 < (*.f64 z t)

    1. Initial program 96.4%

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

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

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

      \[\leadsto \frac{1}{16} \cdot \left(t \cdot z\right) - \color{blue}{\frac{1}{4} \cdot \left(a \cdot b\right)} \]
    6. Applied rewrites78.3%

      \[\leadsto x \cdot y + \color{blue}{\frac{z \cdot t}{16}} \]

    if -1.65e143 < (*.f64 z t) < 4.5e89

    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

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

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

      \[\leadsto \frac{1}{16} \cdot \left(t \cdot z\right) - \frac{\color{blue}{a \cdot b}}{4} \]
    6. Applied rewrites92.6%

      \[\leadsto \left(x \cdot y + c\right) - \frac{\color{blue}{a \cdot b}}{4} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 66.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot y + \frac{z \cdot t}{16}\\ \mathbf{if}\;z \cdot t \leq -1.25 \cdot 10^{+76}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \cdot t \leq 5.1 \cdot 10^{+15}:\\ \;\;\;\;x \cdot y + c\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (+ (* x y) (/ (* z t) 16.0))))
   (if (<= (* z t) -1.25e+76)
     t_1
     (if (<= (* z t) 5.1e+15) (+ (* x y) c) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = (x * y) + ((z * t) / 16.0);
	double tmp;
	if ((z * t) <= -1.25e+76) {
		tmp = t_1;
	} else if ((z * t) <= 5.1e+15) {
		tmp = (x * y) + c;
	} 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 = (x * y) + ((z * t) / 16.0d0)
    if ((z * t) <= (-1.25d+76)) then
        tmp = t_1
    else if ((z * t) <= 5.1d+15) then
        tmp = (x * y) + c
    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 = (x * y) + ((z * t) / 16.0);
	double tmp;
	if ((z * t) <= -1.25e+76) {
		tmp = t_1;
	} else if ((z * t) <= 5.1e+15) {
		tmp = (x * y) + c;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = (x * y) + ((z * t) / 16.0)
	tmp = 0
	if (z * t) <= -1.25e+76:
		tmp = t_1
	elif (z * t) <= 5.1e+15:
		tmp = (x * y) + c
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c)
	t_1 = Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0))
	tmp = 0.0
	if (Float64(z * t) <= -1.25e+76)
		tmp = t_1;
	elseif (Float64(z * t) <= 5.1e+15)
		tmp = Float64(Float64(x * y) + c);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	t_1 = (x * y) + ((z * t) / 16.0);
	tmp = 0.0;
	if ((z * t) <= -1.25e+76)
		tmp = t_1;
	elseif ((z * t) <= 5.1e+15)
		tmp = (x * y) + c;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -1.25e+76], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5.1e+15], N[(N[(x * y), $MachinePrecision] + c), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot y + \frac{z \cdot t}{16}\\
\mathbf{if}\;z \cdot t \leq -1.25 \cdot 10^{+76}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \cdot t \leq 5.1 \cdot 10^{+15}:\\
\;\;\;\;x \cdot y + c\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -1.24999999999999998e76 or 5.1e15 < (*.f64 z t)

    1. Initial program 97.3%

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

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

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

      \[\leadsto \frac{1}{16} \cdot \left(t \cdot z\right) - \color{blue}{\frac{1}{4} \cdot \left(a \cdot b\right)} \]
    6. Applied rewrites72.0%

      \[\leadsto x \cdot y + \color{blue}{\frac{z \cdot t}{16}} \]

    if -1.24999999999999998e76 < (*.f64 z t) < 5.1e15

    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

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

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

Alternative 7: 41.3% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4800000000000:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;x \cdot y \leq 2.8 \cdot 10^{+81}:\\
\;\;\;\;a \cdot b + c\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -4.8e12 or 2.79999999999999995e81 < (*.f64 x y)

    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 x around 0

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

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

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

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

    if -4.8e12 < (*.f64 x y) < 2.79999999999999995e81

    1. Initial program 99.3%

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

      \[\leadsto \color{blue}{\left(\frac{1}{16} \cdot \left(t \cdot z\right) - \frac{1}{4} \cdot \left(a \cdot b\right)\right)} + c \]
    4. Applied rewrites68.8%

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

      \[\leadsto \frac{1}{16} \cdot \color{blue}{\left(t \cdot z\right)} + c \]
    6. Applied rewrites10.2%

      \[\leadsto \left(x \cdot y + \color{blue}{c}\right) + c \]
    7. Taylor expanded in x around -inf

      \[\leadsto -1 \cdot \color{blue}{\left(x \cdot \left(-1 \cdot y + \frac{-1}{16} \cdot \frac{t \cdot z}{x}\right)\right)} + c \]
    8. Applied rewrites27.5%

      \[\leadsto a \cdot \color{blue}{b} + c \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 8: 48.5% accurate, 5.2× speedup?

\[\begin{array}{l} \\ x \cdot y + c \end{array} \]
(FPCore (x y z t a b c) :precision binary64 (+ (* x y) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
	return (x * y) + 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) + c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
	return (x * y) + c;
}
def code(x, y, z, t, a, b, c):
	return (x * y) + c
function code(x, y, z, t, a, b, c)
	return Float64(Float64(x * y) + c)
end
function tmp = code(x, y, z, t, a, b, c)
	tmp = (x * y) + c;
end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(x * y), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}

\\
x \cdot y + c
\end{array}
Derivation
  1. Initial program 98.8%

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

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

    \[\leadsto \color{blue}{x \cdot y} + c \]
  5. Add Preprocessing

Alternative 9: 28.4% accurate, 7.8× speedup?

\[\begin{array}{l} \\ x \cdot y \end{array} \]
(FPCore (x y z t a b c) :precision binary64 (* x y))
double code(double x, double y, double z, double t, double a, double b, double c) {
	return x * y;
}
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
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
	return x * y;
}
def code(x, y, z, t, a, b, c):
	return x * y
function code(x, y, z, t, a, b, c)
	return Float64(x * y)
end
function tmp = code(x, y, z, t, a, b, c)
	tmp = x * y;
end
code[x_, y_, z_, t_, a_, b_, c_] := N[(x * y), $MachinePrecision]
\begin{array}{l}

\\
x \cdot y
\end{array}
Derivation
  1. Initial program 98.8%

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

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

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

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

    \[\leadsto x \cdot \color{blue}{y} \]
  7. Add Preprocessing

Reproduce

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