Codec.Picture.Jpg.FastDct:referenceDct from JuicyPixels-3.2.6.1

Percentage Accurate: 27.9% → 31.9%
Time: 22.1s
Alternatives: 6
Speedup: 225.0×

Specification

?
\[\begin{array}{l} \\ \left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (*
  (* x (cos (/ (* (* (+ (* y 2.0) 1.0) z) t) 16.0)))
  (cos (/ (* (* (+ (* a 2.0) 1.0) b) t) 16.0))))
double code(double x, double y, double z, double t, double a, double b) {
	return (x * cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * cos((((((a * 2.0) + 1.0) * b) * t) / 16.0));
}
real(8) function code(x, y, z, t, a, b)
    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
    code = (x * cos((((((y * 2.0d0) + 1.0d0) * z) * t) / 16.0d0))) * cos((((((a * 2.0d0) + 1.0d0) * b) * t) / 16.0d0))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return (x * Math.cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * Math.cos((((((a * 2.0) + 1.0) * b) * t) / 16.0));
}
def code(x, y, z, t, a, b):
	return (x * math.cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * math.cos((((((a * 2.0) + 1.0) * b) * t) / 16.0))
function code(x, y, z, t, a, b)
	return Float64(Float64(x * cos(Float64(Float64(Float64(Float64(Float64(y * 2.0) + 1.0) * z) * t) / 16.0))) * cos(Float64(Float64(Float64(Float64(Float64(a * 2.0) + 1.0) * b) * t) / 16.0)))
end
function tmp = code(x, y, z, t, a, b)
	tmp = (x * cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * cos((((((a * 2.0) + 1.0) * b) * t) / 16.0));
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * N[Cos[N[(N[(N[(N[(N[(y * 2.0), $MachinePrecision] + 1.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(N[(N[(N[(a * 2.0), $MachinePrecision] + 1.0), $MachinePrecision] * b), $MachinePrecision] * t), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right)
\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 6 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: 27.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (*
  (* x (cos (/ (* (* (+ (* y 2.0) 1.0) z) t) 16.0)))
  (cos (/ (* (* (+ (* a 2.0) 1.0) b) t) 16.0))))
double code(double x, double y, double z, double t, double a, double b) {
	return (x * cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * cos((((((a * 2.0) + 1.0) * b) * t) / 16.0));
}
real(8) function code(x, y, z, t, a, b)
    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
    code = (x * cos((((((y * 2.0d0) + 1.0d0) * z) * t) / 16.0d0))) * cos((((((a * 2.0d0) + 1.0d0) * b) * t) / 16.0d0))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return (x * Math.cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * Math.cos((((((a * 2.0) + 1.0) * b) * t) / 16.0));
}
def code(x, y, z, t, a, b):
	return (x * math.cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * math.cos((((((a * 2.0) + 1.0) * b) * t) / 16.0))
function code(x, y, z, t, a, b)
	return Float64(Float64(x * cos(Float64(Float64(Float64(Float64(Float64(y * 2.0) + 1.0) * z) * t) / 16.0))) * cos(Float64(Float64(Float64(Float64(Float64(a * 2.0) + 1.0) * b) * t) / 16.0)))
end
function tmp = code(x, y, z, t, a, b)
	tmp = (x * cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * cos((((((a * 2.0) + 1.0) * b) * t) / 16.0));
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * N[Cos[N[(N[(N[(N[(N[(y * 2.0), $MachinePrecision] + 1.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(N[(N[(N[(a * 2.0), $MachinePrecision] + 1.0), $MachinePrecision] * b), $MachinePrecision] * t), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right)
\end{array}

Alternative 1: 31.9% accurate, 0.3× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ t_m = \left|t\right| \\ \begin{array}{l} t_1 := \cos \left(\frac{t\_m \cdot \left(\left(1 + 2 \cdot a\right) \cdot b\right)}{16}\right)\\ \mathbf{if}\;\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\_m\right) \cdot t\_m}{16}\right)\right) \cdot t\_1 \leq 10^{+271}:\\ \;\;\;\;t\_1 \cdot \left(x \cdot \cos \left(\frac{{\left({\left(z\_m \cdot t\_m\right)}^{0.3333333333333333}\right)}^{3}}{16}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
t_m = (fabs.f64 t)
(FPCore (x y z_m t_m a b)
 :precision binary64
 (let* ((t_1 (cos (/ (* t_m (* (+ 1.0 (* 2.0 a)) b)) 16.0))))
   (if (<=
        (* (* x (cos (/ (* (* (+ (* y 2.0) 1.0) z_m) t_m) 16.0))) t_1)
        1e+271)
     (*
      t_1
      (* x (cos (/ (pow (pow (* z_m t_m) 0.3333333333333333) 3.0) 16.0))))
     x)))
z_m = fabs(z);
t_m = fabs(t);
double code(double x, double y, double z_m, double t_m, double a, double b) {
	double t_1 = cos(((t_m * ((1.0 + (2.0 * a)) * b)) / 16.0));
	double tmp;
	if (((x * cos((((((y * 2.0) + 1.0) * z_m) * t_m) / 16.0))) * t_1) <= 1e+271) {
		tmp = t_1 * (x * cos((pow(pow((z_m * t_m), 0.3333333333333333), 3.0) / 16.0)));
	} else {
		tmp = x;
	}
	return tmp;
}
z_m = abs(z)
t_m = abs(t)
real(8) function code(x, y, z_m, t_m, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t_m
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: t_1
    real(8) :: tmp
    t_1 = cos(((t_m * ((1.0d0 + (2.0d0 * a)) * b)) / 16.0d0))
    if (((x * cos((((((y * 2.0d0) + 1.0d0) * z_m) * t_m) / 16.0d0))) * t_1) <= 1d+271) then
        tmp = t_1 * (x * cos(((((z_m * t_m) ** 0.3333333333333333d0) ** 3.0d0) / 16.0d0)))
    else
        tmp = x
    end if
    code = tmp
end function
z_m = Math.abs(z);
t_m = Math.abs(t);
public static double code(double x, double y, double z_m, double t_m, double a, double b) {
	double t_1 = Math.cos(((t_m * ((1.0 + (2.0 * a)) * b)) / 16.0));
	double tmp;
	if (((x * Math.cos((((((y * 2.0) + 1.0) * z_m) * t_m) / 16.0))) * t_1) <= 1e+271) {
		tmp = t_1 * (x * Math.cos((Math.pow(Math.pow((z_m * t_m), 0.3333333333333333), 3.0) / 16.0)));
	} else {
		tmp = x;
	}
	return tmp;
}
z_m = math.fabs(z)
t_m = math.fabs(t)
def code(x, y, z_m, t_m, a, b):
	t_1 = math.cos(((t_m * ((1.0 + (2.0 * a)) * b)) / 16.0))
	tmp = 0
	if ((x * math.cos((((((y * 2.0) + 1.0) * z_m) * t_m) / 16.0))) * t_1) <= 1e+271:
		tmp = t_1 * (x * math.cos((math.pow(math.pow((z_m * t_m), 0.3333333333333333), 3.0) / 16.0)))
	else:
		tmp = x
	return tmp
z_m = abs(z)
t_m = abs(t)
function code(x, y, z_m, t_m, a, b)
	t_1 = cos(Float64(Float64(t_m * Float64(Float64(1.0 + Float64(2.0 * a)) * b)) / 16.0))
	tmp = 0.0
	if (Float64(Float64(x * cos(Float64(Float64(Float64(Float64(Float64(y * 2.0) + 1.0) * z_m) * t_m) / 16.0))) * t_1) <= 1e+271)
		tmp = Float64(t_1 * Float64(x * cos(Float64(((Float64(z_m * t_m) ^ 0.3333333333333333) ^ 3.0) / 16.0))));
	else
		tmp = x;
	end
	return tmp
end
z_m = abs(z);
t_m = abs(t);
function tmp_2 = code(x, y, z_m, t_m, a, b)
	t_1 = cos(((t_m * ((1.0 + (2.0 * a)) * b)) / 16.0));
	tmp = 0.0;
	if (((x * cos((((((y * 2.0) + 1.0) * z_m) * t_m) / 16.0))) * t_1) <= 1e+271)
		tmp = t_1 * (x * cos(((((z_m * t_m) ^ 0.3333333333333333) ^ 3.0) / 16.0)));
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z$95$m_, t$95$m_, a_, b_] := Block[{t$95$1 = N[Cos[N[(N[(t$95$m * N[(N[(1.0 + N[(2.0 * a), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(x * N[Cos[N[(N[(N[(N[(N[(y * 2.0), $MachinePrecision] + 1.0), $MachinePrecision] * z$95$m), $MachinePrecision] * t$95$m), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], 1e+271], N[(t$95$1 * N[(x * N[Cos[N[(N[Power[N[Power[N[(z$95$m * t$95$m), $MachinePrecision], 0.3333333333333333], $MachinePrecision], 3.0], $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
z_m = \left|z\right|
\\
t_m = \left|t\right|

\\
\begin{array}{l}
t_1 := \cos \left(\frac{t\_m \cdot \left(\left(1 + 2 \cdot a\right) \cdot b\right)}{16}\right)\\
\mathbf{if}\;\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\_m\right) \cdot t\_m}{16}\right)\right) \cdot t\_1 \leq 10^{+271}:\\
\;\;\;\;t\_1 \cdot \left(x \cdot \cos \left(\frac{{\left({\left(z\_m \cdot t\_m\right)}^{0.3333333333333333}\right)}^{3}}{16}\right)\right)\\

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


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

    1. Initial program 49.7%

      \[\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cube-cbrt50.2%

        \[\leadsto \left(x \cdot \cos \left(\frac{\color{blue}{\left(\sqrt[3]{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t} \cdot \sqrt[3]{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}\right) \cdot \sqrt[3]{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}}}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \]
      2. pow350.0%

        \[\leadsto \left(x \cdot \cos \left(\frac{\color{blue}{{\left(\sqrt[3]{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}\right)}^{3}}}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \]
      3. *-commutative50.0%

        \[\leadsto \left(x \cdot \cos \left(\frac{{\left(\sqrt[3]{\color{blue}{t \cdot \left(\left(y \cdot 2 + 1\right) \cdot z\right)}}\right)}^{3}}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \]
      4. fma-define50.0%

        \[\leadsto \left(x \cdot \cos \left(\frac{{\left(\sqrt[3]{t \cdot \left(\color{blue}{\mathsf{fma}\left(y, 2, 1\right)} \cdot z\right)}\right)}^{3}}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \]
      5. *-commutative50.0%

        \[\leadsto \left(x \cdot \cos \left(\frac{{\left(\sqrt[3]{t \cdot \color{blue}{\left(z \cdot \mathsf{fma}\left(y, 2, 1\right)\right)}}\right)}^{3}}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \]
    4. Applied egg-rr50.0%

      \[\leadsto \left(x \cdot \cos \left(\frac{\color{blue}{{\left(\sqrt[3]{t \cdot \left(z \cdot \mathsf{fma}\left(y, 2, 1\right)\right)}\right)}^{3}}}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \]
    5. Taylor expanded in y around 0 33.3%

      \[\leadsto \left(x \cdot \cos \left(\frac{{\color{blue}{\left({\left(t \cdot z\right)}^{0.3333333333333333}\right)}}^{3}}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \]

    if 9.99999999999999953e270 < (*.f64 (*.f64 x (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 y 2) 1) z) t) 16))) (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 a 2) 1) b) t) 16)))

    1. Initial program 3.7%

      \[\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \]
    2. Simplified5.5%

      \[\leadsto \color{blue}{\left(x \cdot \cos \left(z \cdot \left(\frac{t}{16} \cdot \mathsf{fma}\left(y, 2, 1\right)\right)\right)\right) \cdot \cos \left(t \cdot \left(\frac{b}{16} \cdot \mathsf{fma}\left(2, a, 1\right)\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in z around 0 7.5%

      \[\leadsto \left(x \cdot \color{blue}{1}\right) \cdot \cos \left(t \cdot \left(\frac{b}{16} \cdot \mathsf{fma}\left(2, a, 1\right)\right)\right) \]
    5. Taylor expanded in t around 0 13.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{t \cdot \left(\left(1 + 2 \cdot a\right) \cdot b\right)}{16}\right) \leq 10^{+271}:\\ \;\;\;\;\cos \left(\frac{t \cdot \left(\left(1 + 2 \cdot a\right) \cdot b\right)}{16}\right) \cdot \left(x \cdot \cos \left(\frac{{\left({\left(z \cdot t\right)}^{0.3333333333333333}\right)}^{3}}{16}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 32.2% accurate, 0.5× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ t_m = \left|t\right| \\ \begin{array}{l} t_1 := \left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\_m\right) \cdot t\_m}{16}\right)\right) \cdot \cos \left(\frac{t\_m \cdot \left(\left(1 + 2 \cdot a\right) \cdot b\right)}{16}\right)\\ \mathbf{if}\;t\_1 \leq 5 \cdot 10^{+199}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
t_m = (fabs.f64 t)
(FPCore (x y z_m t_m a b)
 :precision binary64
 (let* ((t_1
         (*
          (* x (cos (/ (* (* (+ (* y 2.0) 1.0) z_m) t_m) 16.0)))
          (cos (/ (* t_m (* (+ 1.0 (* 2.0 a)) b)) 16.0)))))
   (if (<= t_1 5e+199) t_1 x)))
z_m = fabs(z);
t_m = fabs(t);
double code(double x, double y, double z_m, double t_m, double a, double b) {
	double t_1 = (x * cos((((((y * 2.0) + 1.0) * z_m) * t_m) / 16.0))) * cos(((t_m * ((1.0 + (2.0 * a)) * b)) / 16.0));
	double tmp;
	if (t_1 <= 5e+199) {
		tmp = t_1;
	} else {
		tmp = x;
	}
	return tmp;
}
z_m = abs(z)
t_m = abs(t)
real(8) function code(x, y, z_m, t_m, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t_m
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (x * cos((((((y * 2.0d0) + 1.0d0) * z_m) * t_m) / 16.0d0))) * cos(((t_m * ((1.0d0 + (2.0d0 * a)) * b)) / 16.0d0))
    if (t_1 <= 5d+199) then
        tmp = t_1
    else
        tmp = x
    end if
    code = tmp
end function
z_m = Math.abs(z);
t_m = Math.abs(t);
public static double code(double x, double y, double z_m, double t_m, double a, double b) {
	double t_1 = (x * Math.cos((((((y * 2.0) + 1.0) * z_m) * t_m) / 16.0))) * Math.cos(((t_m * ((1.0 + (2.0 * a)) * b)) / 16.0));
	double tmp;
	if (t_1 <= 5e+199) {
		tmp = t_1;
	} else {
		tmp = x;
	}
	return tmp;
}
z_m = math.fabs(z)
t_m = math.fabs(t)
def code(x, y, z_m, t_m, a, b):
	t_1 = (x * math.cos((((((y * 2.0) + 1.0) * z_m) * t_m) / 16.0))) * math.cos(((t_m * ((1.0 + (2.0 * a)) * b)) / 16.0))
	tmp = 0
	if t_1 <= 5e+199:
		tmp = t_1
	else:
		tmp = x
	return tmp
z_m = abs(z)
t_m = abs(t)
function code(x, y, z_m, t_m, a, b)
	t_1 = Float64(Float64(x * cos(Float64(Float64(Float64(Float64(Float64(y * 2.0) + 1.0) * z_m) * t_m) / 16.0))) * cos(Float64(Float64(t_m * Float64(Float64(1.0 + Float64(2.0 * a)) * b)) / 16.0)))
	tmp = 0.0
	if (t_1 <= 5e+199)
		tmp = t_1;
	else
		tmp = x;
	end
	return tmp
end
z_m = abs(z);
t_m = abs(t);
function tmp_2 = code(x, y, z_m, t_m, a, b)
	t_1 = (x * cos((((((y * 2.0) + 1.0) * z_m) * t_m) / 16.0))) * cos(((t_m * ((1.0 + (2.0 * a)) * b)) / 16.0));
	tmp = 0.0;
	if (t_1 <= 5e+199)
		tmp = t_1;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z$95$m_, t$95$m_, a_, b_] := Block[{t$95$1 = N[(N[(x * N[Cos[N[(N[(N[(N[(N[(y * 2.0), $MachinePrecision] + 1.0), $MachinePrecision] * z$95$m), $MachinePrecision] * t$95$m), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(t$95$m * N[(N[(1.0 + N[(2.0 * a), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+199], t$95$1, x]]
\begin{array}{l}
z_m = \left|z\right|
\\
t_m = \left|t\right|

\\
\begin{array}{l}
t_1 := \left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\_m\right) \cdot t\_m}{16}\right)\right) \cdot \cos \left(\frac{t\_m \cdot \left(\left(1 + 2 \cdot a\right) \cdot b\right)}{16}\right)\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{+199}:\\
\;\;\;\;t\_1\\

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


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

    1. Initial program 51.9%

      \[\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \]
    2. Add Preprocessing

    if 4.9999999999999998e199 < (*.f64 (*.f64 x (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 y 2) 1) z) t) 16))) (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 a 2) 1) b) t) 16)))

    1. Initial program 5.3%

      \[\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \]
    2. Simplified7.0%

      \[\leadsto \color{blue}{\left(x \cdot \cos \left(z \cdot \left(\frac{t}{16} \cdot \mathsf{fma}\left(y, 2, 1\right)\right)\right)\right) \cdot \cos \left(t \cdot \left(\frac{b}{16} \cdot \mathsf{fma}\left(2, a, 1\right)\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in z around 0 8.6%

      \[\leadsto \left(x \cdot \color{blue}{1}\right) \cdot \cos \left(t \cdot \left(\frac{b}{16} \cdot \mathsf{fma}\left(2, a, 1\right)\right)\right) \]
    5. Taylor expanded in t around 0 13.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{t \cdot \left(\left(1 + 2 \cdot a\right) \cdot b\right)}{16}\right) \leq 5 \cdot 10^{+199}:\\ \;\;\;\;\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{t \cdot \left(\left(1 + 2 \cdot a\right) \cdot b\right)}{16}\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 30.3% accurate, 0.7× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ t_m = \left|t\right| \\ x \cdot \cos \left({\left(\sqrt[3]{0.0625 \cdot \left(t\_m \cdot b\right)}\right)}^{3}\right) \end{array} \]
z_m = (fabs.f64 z)
t_m = (fabs.f64 t)
(FPCore (x y z_m t_m a b)
 :precision binary64
 (* x (cos (pow (cbrt (* 0.0625 (* t_m b))) 3.0))))
z_m = fabs(z);
t_m = fabs(t);
double code(double x, double y, double z_m, double t_m, double a, double b) {
	return x * cos(pow(cbrt((0.0625 * (t_m * b))), 3.0));
}
z_m = Math.abs(z);
t_m = Math.abs(t);
public static double code(double x, double y, double z_m, double t_m, double a, double b) {
	return x * Math.cos(Math.pow(Math.cbrt((0.0625 * (t_m * b))), 3.0));
}
z_m = abs(z)
t_m = abs(t)
function code(x, y, z_m, t_m, a, b)
	return Float64(x * cos((cbrt(Float64(0.0625 * Float64(t_m * b))) ^ 3.0)))
end
z_m = N[Abs[z], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z$95$m_, t$95$m_, a_, b_] := N[(x * N[Cos[N[Power[N[Power[N[(0.0625 * N[(t$95$m * b), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
t_m = \left|t\right|

\\
x \cdot \cos \left({\left(\sqrt[3]{0.0625 \cdot \left(t\_m \cdot b\right)}\right)}^{3}\right)
\end{array}
Derivation
  1. Initial program 33.0%

    \[\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \]
  2. Simplified33.4%

    \[\leadsto \color{blue}{\left(x \cdot \cos \left(z \cdot \left(\frac{t}{16} \cdot \mathsf{fma}\left(y, 2, 1\right)\right)\right)\right) \cdot \cos \left(t \cdot \left(\frac{b}{16} \cdot \mathsf{fma}\left(2, a, 1\right)\right)\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in z around 0 34.3%

    \[\leadsto \left(x \cdot \color{blue}{1}\right) \cdot \cos \left(t \cdot \left(\frac{b}{16} \cdot \mathsf{fma}\left(2, a, 1\right)\right)\right) \]
  5. Step-by-step derivation
    1. add-cube-cbrt34.2%

      \[\leadsto \left(x \cdot 1\right) \cdot \cos \color{blue}{\left(\left(\sqrt[3]{t \cdot \left(\frac{b}{16} \cdot \mathsf{fma}\left(2, a, 1\right)\right)} \cdot \sqrt[3]{t \cdot \left(\frac{b}{16} \cdot \mathsf{fma}\left(2, a, 1\right)\right)}\right) \cdot \sqrt[3]{t \cdot \left(\frac{b}{16} \cdot \mathsf{fma}\left(2, a, 1\right)\right)}\right)} \]
    2. pow334.3%

      \[\leadsto \left(x \cdot 1\right) \cdot \cos \color{blue}{\left({\left(\sqrt[3]{t \cdot \left(\frac{b}{16} \cdot \mathsf{fma}\left(2, a, 1\right)\right)}\right)}^{3}\right)} \]
    3. associate-*r*34.7%

      \[\leadsto \left(x \cdot 1\right) \cdot \cos \left({\left(\sqrt[3]{\color{blue}{\left(t \cdot \frac{b}{16}\right) \cdot \mathsf{fma}\left(2, a, 1\right)}}\right)}^{3}\right) \]
    4. div-inv34.7%

      \[\leadsto \left(x \cdot 1\right) \cdot \cos \left({\left(\sqrt[3]{\left(t \cdot \color{blue}{\left(b \cdot \frac{1}{16}\right)}\right) \cdot \mathsf{fma}\left(2, a, 1\right)}\right)}^{3}\right) \]
    5. metadata-eval34.7%

      \[\leadsto \left(x \cdot 1\right) \cdot \cos \left({\left(\sqrt[3]{\left(t \cdot \left(b \cdot \color{blue}{0.0625}\right)\right) \cdot \mathsf{fma}\left(2, a, 1\right)}\right)}^{3}\right) \]
  6. Applied egg-rr34.7%

    \[\leadsto \left(x \cdot 1\right) \cdot \cos \color{blue}{\left({\left(\sqrt[3]{\left(t \cdot \left(b \cdot 0.0625\right)\right) \cdot \mathsf{fma}\left(2, a, 1\right)}\right)}^{3}\right)} \]
  7. Taylor expanded in a around 0 35.2%

    \[\leadsto \left(x \cdot 1\right) \cdot \cos \left({\left(\sqrt[3]{\color{blue}{0.0625 \cdot \left(b \cdot t\right)}}\right)}^{3}\right) \]
  8. Final simplification35.2%

    \[\leadsto x \cdot \cos \left({\left(\sqrt[3]{0.0625 \cdot \left(t \cdot b\right)}\right)}^{3}\right) \]
  9. Add Preprocessing

Alternative 4: 31.5% accurate, 1.0× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ t_m = \left|t\right| \\ \begin{array}{l} \mathbf{if}\;t\_m \leq 1.7 \cdot 10^{+34}:\\ \;\;\;\;\left(x \cdot \cos \left(\frac{z\_m \cdot t\_m}{16}\right)\right) \cdot \cos \left(\left(t\_m \cdot b\right) \cdot \left(0.0625 + a \cdot 0.125\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
t_m = (fabs.f64 t)
(FPCore (x y z_m t_m a b)
 :precision binary64
 (if (<= t_m 1.7e+34)
   (*
    (* x (cos (/ (* z_m t_m) 16.0)))
    (cos (* (* t_m b) (+ 0.0625 (* a 0.125)))))
   x))
z_m = fabs(z);
t_m = fabs(t);
double code(double x, double y, double z_m, double t_m, double a, double b) {
	double tmp;
	if (t_m <= 1.7e+34) {
		tmp = (x * cos(((z_m * t_m) / 16.0))) * cos(((t_m * b) * (0.0625 + (a * 0.125))));
	} else {
		tmp = x;
	}
	return tmp;
}
z_m = abs(z)
t_m = abs(t)
real(8) function code(x, y, z_m, t_m, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t_m
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (t_m <= 1.7d+34) then
        tmp = (x * cos(((z_m * t_m) / 16.0d0))) * cos(((t_m * b) * (0.0625d0 + (a * 0.125d0))))
    else
        tmp = x
    end if
    code = tmp
end function
z_m = Math.abs(z);
t_m = Math.abs(t);
public static double code(double x, double y, double z_m, double t_m, double a, double b) {
	double tmp;
	if (t_m <= 1.7e+34) {
		tmp = (x * Math.cos(((z_m * t_m) / 16.0))) * Math.cos(((t_m * b) * (0.0625 + (a * 0.125))));
	} else {
		tmp = x;
	}
	return tmp;
}
z_m = math.fabs(z)
t_m = math.fabs(t)
def code(x, y, z_m, t_m, a, b):
	tmp = 0
	if t_m <= 1.7e+34:
		tmp = (x * math.cos(((z_m * t_m) / 16.0))) * math.cos(((t_m * b) * (0.0625 + (a * 0.125))))
	else:
		tmp = x
	return tmp
z_m = abs(z)
t_m = abs(t)
function code(x, y, z_m, t_m, a, b)
	tmp = 0.0
	if (t_m <= 1.7e+34)
		tmp = Float64(Float64(x * cos(Float64(Float64(z_m * t_m) / 16.0))) * cos(Float64(Float64(t_m * b) * Float64(0.0625 + Float64(a * 0.125)))));
	else
		tmp = x;
	end
	return tmp
end
z_m = abs(z);
t_m = abs(t);
function tmp_2 = code(x, y, z_m, t_m, a, b)
	tmp = 0.0;
	if (t_m <= 1.7e+34)
		tmp = (x * cos(((z_m * t_m) / 16.0))) * cos(((t_m * b) * (0.0625 + (a * 0.125))));
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z$95$m_, t$95$m_, a_, b_] := If[LessEqual[t$95$m, 1.7e+34], N[(N[(x * N[Cos[N[(N[(z$95$m * t$95$m), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(t$95$m * b), $MachinePrecision] * N[(0.0625 + N[(a * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
z_m = \left|z\right|
\\
t_m = \left|t\right|

\\
\begin{array}{l}
\mathbf{if}\;t\_m \leq 1.7 \cdot 10^{+34}:\\
\;\;\;\;\left(x \cdot \cos \left(\frac{z\_m \cdot t\_m}{16}\right)\right) \cdot \cos \left(\left(t\_m \cdot b\right) \cdot \left(0.0625 + a \cdot 0.125\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 1.7e34

    1. Initial program 38.8%

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

      \[\leadsto \left(x \cdot \cos \left(\frac{\color{blue}{t \cdot z}}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \]
    4. Taylor expanded in a around 0 40.3%

      \[\leadsto \left(x \cdot \cos \left(\frac{t \cdot z}{16}\right)\right) \cdot \cos \color{blue}{\left(0.0625 \cdot \left(b \cdot t\right) + 0.125 \cdot \left(a \cdot \left(b \cdot t\right)\right)\right)} \]
    5. Step-by-step derivation
      1. +-commutative40.3%

        \[\leadsto \left(x \cdot \cos \left(\frac{t \cdot z}{16}\right)\right) \cdot \cos \color{blue}{\left(0.125 \cdot \left(a \cdot \left(b \cdot t\right)\right) + 0.0625 \cdot \left(b \cdot t\right)\right)} \]
      2. associate-*r*40.4%

        \[\leadsto \left(x \cdot \cos \left(\frac{t \cdot z}{16}\right)\right) \cdot \cos \left(\color{blue}{\left(0.125 \cdot a\right) \cdot \left(b \cdot t\right)} + 0.0625 \cdot \left(b \cdot t\right)\right) \]
      3. *-commutative40.4%

        \[\leadsto \left(x \cdot \cos \left(\frac{t \cdot z}{16}\right)\right) \cdot \cos \left(\left(0.125 \cdot a\right) \cdot \color{blue}{\left(t \cdot b\right)} + 0.0625 \cdot \left(b \cdot t\right)\right) \]
      4. *-commutative40.4%

        \[\leadsto \left(x \cdot \cos \left(\frac{t \cdot z}{16}\right)\right) \cdot \cos \left(\left(0.125 \cdot a\right) \cdot \left(t \cdot b\right) + 0.0625 \cdot \color{blue}{\left(t \cdot b\right)}\right) \]
      5. distribute-rgt-out40.4%

        \[\leadsto \left(x \cdot \cos \left(\frac{t \cdot z}{16}\right)\right) \cdot \cos \color{blue}{\left(\left(t \cdot b\right) \cdot \left(0.125 \cdot a + 0.0625\right)\right)} \]
      6. *-commutative40.4%

        \[\leadsto \left(x \cdot \cos \left(\frac{t \cdot z}{16}\right)\right) \cdot \cos \left(\color{blue}{\left(b \cdot t\right)} \cdot \left(0.125 \cdot a + 0.0625\right)\right) \]
      7. *-commutative40.4%

        \[\leadsto \left(x \cdot \cos \left(\frac{t \cdot z}{16}\right)\right) \cdot \cos \left(\left(b \cdot t\right) \cdot \left(\color{blue}{a \cdot 0.125} + 0.0625\right)\right) \]
    6. Simplified40.4%

      \[\leadsto \left(x \cdot \cos \left(\frac{t \cdot z}{16}\right)\right) \cdot \cos \color{blue}{\left(\left(b \cdot t\right) \cdot \left(a \cdot 0.125 + 0.0625\right)\right)} \]

    if 1.7e34 < t

    1. Initial program 9.0%

      \[\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \]
    2. Simplified8.4%

      \[\leadsto \color{blue}{\left(x \cdot \cos \left(z \cdot \left(\frac{t}{16} \cdot \mathsf{fma}\left(y, 2, 1\right)\right)\right)\right) \cdot \cos \left(t \cdot \left(\frac{b}{16} \cdot \mathsf{fma}\left(2, a, 1\right)\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in z around 0 12.6%

      \[\leadsto \left(x \cdot \color{blue}{1}\right) \cdot \cos \left(t \cdot \left(\frac{b}{16} \cdot \mathsf{fma}\left(2, a, 1\right)\right)\right) \]
    5. Taylor expanded in t around 0 14.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 1.7 \cdot 10^{+34}:\\ \;\;\;\;\left(x \cdot \cos \left(\frac{z \cdot t}{16}\right)\right) \cdot \cos \left(\left(t \cdot b\right) \cdot \left(0.0625 + a \cdot 0.125\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 29.5% accurate, 2.0× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ t_m = \left|t\right| \\ x \cdot \cos \left(\left(t\_m \cdot b\right) \cdot \left(0.0625 + a \cdot 0.125\right)\right) \end{array} \]
z_m = (fabs.f64 z)
t_m = (fabs.f64 t)
(FPCore (x y z_m t_m a b)
 :precision binary64
 (* x (cos (* (* t_m b) (+ 0.0625 (* a 0.125))))))
z_m = fabs(z);
t_m = fabs(t);
double code(double x, double y, double z_m, double t_m, double a, double b) {
	return x * cos(((t_m * b) * (0.0625 + (a * 0.125))));
}
z_m = abs(z)
t_m = abs(t)
real(8) function code(x, y, z_m, t_m, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t_m
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = x * cos(((t_m * b) * (0.0625d0 + (a * 0.125d0))))
end function
z_m = Math.abs(z);
t_m = Math.abs(t);
public static double code(double x, double y, double z_m, double t_m, double a, double b) {
	return x * Math.cos(((t_m * b) * (0.0625 + (a * 0.125))));
}
z_m = math.fabs(z)
t_m = math.fabs(t)
def code(x, y, z_m, t_m, a, b):
	return x * math.cos(((t_m * b) * (0.0625 + (a * 0.125))))
z_m = abs(z)
t_m = abs(t)
function code(x, y, z_m, t_m, a, b)
	return Float64(x * cos(Float64(Float64(t_m * b) * Float64(0.0625 + Float64(a * 0.125)))))
end
z_m = abs(z);
t_m = abs(t);
function tmp = code(x, y, z_m, t_m, a, b)
	tmp = x * cos(((t_m * b) * (0.0625 + (a * 0.125))));
end
z_m = N[Abs[z], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z$95$m_, t$95$m_, a_, b_] := N[(x * N[Cos[N[(N[(t$95$m * b), $MachinePrecision] * N[(0.0625 + N[(a * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
t_m = \left|t\right|

\\
x \cdot \cos \left(\left(t\_m \cdot b\right) \cdot \left(0.0625 + a \cdot 0.125\right)\right)
\end{array}
Derivation
  1. Initial program 33.0%

    \[\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \]
  2. Simplified33.4%

    \[\leadsto \color{blue}{\left(x \cdot \cos \left(z \cdot \left(\frac{t}{16} \cdot \mathsf{fma}\left(y, 2, 1\right)\right)\right)\right) \cdot \cos \left(t \cdot \left(\frac{b}{16} \cdot \mathsf{fma}\left(2, a, 1\right)\right)\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in z around 0 34.3%

    \[\leadsto \left(x \cdot \color{blue}{1}\right) \cdot \cos \left(t \cdot \left(\frac{b}{16} \cdot \mathsf{fma}\left(2, a, 1\right)\right)\right) \]
  5. Taylor expanded in a around 0 34.6%

    \[\leadsto \left(x \cdot 1\right) \cdot \cos \color{blue}{\left(0.0625 \cdot \left(b \cdot t\right) + 0.125 \cdot \left(a \cdot \left(b \cdot t\right)\right)\right)} \]
  6. Step-by-step derivation
    1. +-commutative34.6%

      \[\leadsto \left(x \cdot 1\right) \cdot \cos \color{blue}{\left(0.125 \cdot \left(a \cdot \left(b \cdot t\right)\right) + 0.0625 \cdot \left(b \cdot t\right)\right)} \]
    2. associate-*r*34.7%

      \[\leadsto \left(x \cdot 1\right) \cdot \cos \left(\color{blue}{\left(0.125 \cdot a\right) \cdot \left(b \cdot t\right)} + 0.0625 \cdot \left(b \cdot t\right)\right) \]
    3. distribute-rgt-out34.7%

      \[\leadsto \left(x \cdot 1\right) \cdot \cos \color{blue}{\left(\left(b \cdot t\right) \cdot \left(0.125 \cdot a + 0.0625\right)\right)} \]
    4. *-commutative34.7%

      \[\leadsto \left(x \cdot 1\right) \cdot \cos \left(\color{blue}{\left(t \cdot b\right)} \cdot \left(0.125 \cdot a + 0.0625\right)\right) \]
    5. *-commutative34.7%

      \[\leadsto \left(x \cdot 1\right) \cdot \cos \left(\left(t \cdot b\right) \cdot \left(\color{blue}{a \cdot 0.125} + 0.0625\right)\right) \]
  7. Simplified34.7%

    \[\leadsto \left(x \cdot 1\right) \cdot \cos \color{blue}{\left(\left(t \cdot b\right) \cdot \left(a \cdot 0.125 + 0.0625\right)\right)} \]
  8. Final simplification34.7%

    \[\leadsto x \cdot \cos \left(\left(t \cdot b\right) \cdot \left(0.0625 + a \cdot 0.125\right)\right) \]
  9. Add Preprocessing

Alternative 6: 31.3% accurate, 225.0× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ t_m = \left|t\right| \\ x \end{array} \]
z_m = (fabs.f64 z)
t_m = (fabs.f64 t)
(FPCore (x y z_m t_m a b) :precision binary64 x)
z_m = fabs(z);
t_m = fabs(t);
double code(double x, double y, double z_m, double t_m, double a, double b) {
	return x;
}
z_m = abs(z)
t_m = abs(t)
real(8) function code(x, y, z_m, t_m, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t_m
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = x
end function
z_m = Math.abs(z);
t_m = Math.abs(t);
public static double code(double x, double y, double z_m, double t_m, double a, double b) {
	return x;
}
z_m = math.fabs(z)
t_m = math.fabs(t)
def code(x, y, z_m, t_m, a, b):
	return x
z_m = abs(z)
t_m = abs(t)
function code(x, y, z_m, t_m, a, b)
	return x
end
z_m = abs(z);
t_m = abs(t);
function tmp = code(x, y, z_m, t_m, a, b)
	tmp = x;
end
z_m = N[Abs[z], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z$95$m_, t$95$m_, a_, b_] := x
\begin{array}{l}
z_m = \left|z\right|
\\
t_m = \left|t\right|

\\
x
\end{array}
Derivation
  1. Initial program 33.0%

    \[\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \]
  2. Simplified33.4%

    \[\leadsto \color{blue}{\left(x \cdot \cos \left(z \cdot \left(\frac{t}{16} \cdot \mathsf{fma}\left(y, 2, 1\right)\right)\right)\right) \cdot \cos \left(t \cdot \left(\frac{b}{16} \cdot \mathsf{fma}\left(2, a, 1\right)\right)\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in z around 0 34.3%

    \[\leadsto \left(x \cdot \color{blue}{1}\right) \cdot \cos \left(t \cdot \left(\frac{b}{16} \cdot \mathsf{fma}\left(2, a, 1\right)\right)\right) \]
  5. Taylor expanded in t around 0 34.7%

    \[\leadsto \color{blue}{x} \]
  6. Final simplification34.7%

    \[\leadsto x \]
  7. Add Preprocessing

Developer target: 30.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x \cdot \cos \left(\frac{b}{16} \cdot \frac{t}{\left(1 - a \cdot 2\right) + {\left(a \cdot 2\right)}^{2}}\right) \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (* x (cos (* (/ b 16.0) (/ t (+ (- 1.0 (* a 2.0)) (pow (* a 2.0) 2.0)))))))
double code(double x, double y, double z, double t, double a, double b) {
	return x * cos(((b / 16.0) * (t / ((1.0 - (a * 2.0)) + pow((a * 2.0), 2.0)))));
}
real(8) function code(x, y, z, t, a, b)
    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
    code = x * cos(((b / 16.0d0) * (t / ((1.0d0 - (a * 2.0d0)) + ((a * 2.0d0) ** 2.0d0)))))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return x * Math.cos(((b / 16.0) * (t / ((1.0 - (a * 2.0)) + Math.pow((a * 2.0), 2.0)))));
}
def code(x, y, z, t, a, b):
	return x * math.cos(((b / 16.0) * (t / ((1.0 - (a * 2.0)) + math.pow((a * 2.0), 2.0)))))
function code(x, y, z, t, a, b)
	return Float64(x * cos(Float64(Float64(b / 16.0) * Float64(t / Float64(Float64(1.0 - Float64(a * 2.0)) + (Float64(a * 2.0) ^ 2.0))))))
end
function tmp = code(x, y, z, t, a, b)
	tmp = x * cos(((b / 16.0) * (t / ((1.0 - (a * 2.0)) + ((a * 2.0) ^ 2.0)))));
end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Cos[N[(N[(b / 16.0), $MachinePrecision] * N[(t / N[(N[(1.0 - N[(a * 2.0), $MachinePrecision]), $MachinePrecision] + N[Power[N[(a * 2.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot \cos \left(\frac{b}{16} \cdot \frac{t}{\left(1 - a \cdot 2\right) + {\left(a \cdot 2\right)}^{2}}\right)
\end{array}

Reproduce

?
herbie shell --seed 2024030 
(FPCore (x y z t a b)
  :name "Codec.Picture.Jpg.FastDct:referenceDct from JuicyPixels-3.2.6.1"
  :precision binary64

  :herbie-target
  (* x (cos (* (/ b 16.0) (/ t (+ (- 1.0 (* a 2.0)) (pow (* a 2.0) 2.0))))))

  (* (* x (cos (/ (* (* (+ (* y 2.0) 1.0) z) t) 16.0))) (cos (/ (* (* (+ (* a 2.0) 1.0) b) t) 16.0))))