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

Percentage Accurate: 28.8% → 32.9%
Time: 30.7s
Alternatives: 4
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 4 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: 28.8% 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: 32.9% accurate, 0.4× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;\left(x\_m \cdot \cos \left(\frac{t \cdot \left(z \cdot \left(1 + 2 \cdot y\right)\right)}{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^{+271}:\\ \;\;\;\;x\_m \cdot \left(\cos \left(\left(z \cdot \mathsf{fma}\left(y, 2, 1\right)\right) \cdot \frac{t}{16}\right) \cdot \cos \left(\frac{1}{\frac{16}{t \cdot b}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\_m \cdot \mathsf{expm1}\left(\log 2 + -0.0009765625 \cdot {\left(t \cdot z\right)}^{2}\right)\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z t a b)
 :precision binary64
 (*
  x_s
  (if (<=
       (*
        (* x_m (cos (/ (* t (* z (+ 1.0 (* 2.0 y)))) 16.0)))
        (cos (/ (* t (* (+ 1.0 (* 2.0 a)) b)) 16.0)))
       5e+271)
    (*
     x_m
     (*
      (cos (* (* z (fma y 2.0 1.0)) (/ t 16.0)))
      (cos (/ 1.0 (/ 16.0 (* t b))))))
    (* x_m (expm1 (+ (log 2.0) (* -0.0009765625 (pow (* t z) 2.0))))))))
x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t, double a, double b) {
	double tmp;
	if (((x_m * cos(((t * (z * (1.0 + (2.0 * y)))) / 16.0))) * cos(((t * ((1.0 + (2.0 * a)) * b)) / 16.0))) <= 5e+271) {
		tmp = x_m * (cos(((z * fma(y, 2.0, 1.0)) * (t / 16.0))) * cos((1.0 / (16.0 / (t * b)))));
	} else {
		tmp = x_m * expm1((log(2.0) + (-0.0009765625 * pow((t * z), 2.0))));
	}
	return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0, x)
function code(x_s, x_m, y, z, t, a, b)
	tmp = 0.0
	if (Float64(Float64(x_m * cos(Float64(Float64(t * Float64(z * Float64(1.0 + Float64(2.0 * y)))) / 16.0))) * cos(Float64(Float64(t * Float64(Float64(1.0 + Float64(2.0 * a)) * b)) / 16.0))) <= 5e+271)
		tmp = Float64(x_m * Float64(cos(Float64(Float64(z * fma(y, 2.0, 1.0)) * Float64(t / 16.0))) * cos(Float64(1.0 / Float64(16.0 / Float64(t * b))))));
	else
		tmp = Float64(x_m * expm1(Float64(log(2.0) + Float64(-0.0009765625 * (Float64(t * z) ^ 2.0)))));
	end
	return Float64(x_s * tmp)
end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_, a_, b_] := N[(x$95$s * If[LessEqual[N[(N[(x$95$m * N[Cos[N[(N[(t * N[(z * N[(1.0 + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(t * N[(N[(1.0 + N[(2.0 * a), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 5e+271], N[(x$95$m * N[(N[Cos[N[(N[(z * N[(y * 2.0 + 1.0), $MachinePrecision]), $MachinePrecision] * N[(t / 16.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(1.0 / N[(16.0 / N[(t * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(Exp[N[(N[Log[2.0], $MachinePrecision] + N[(-0.0009765625 * N[Power[N[(t * z), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;\left(x\_m \cdot \cos \left(\frac{t \cdot \left(z \cdot \left(1 + 2 \cdot y\right)\right)}{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^{+271}:\\
\;\;\;\;x\_m \cdot \left(\cos \left(\left(z \cdot \mathsf{fma}\left(y, 2, 1\right)\right) \cdot \frac{t}{16}\right) \cdot \cos \left(\frac{1}{\frac{16}{t \cdot b}}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x\_m \cdot \mathsf{expm1}\left(\log 2 + -0.0009765625 \cdot {\left(t \cdot z\right)}^{2}\right)\\


\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))) < 5.0000000000000003e271

    1. Initial program 46.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. Step-by-step derivation
      1. associate-*l*46.8%

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

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

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

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

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

        \[\leadsto x \cdot \left(\cos \left(\left(\mathsf{fma}\left(y, 2, 1\right) \cdot z\right) \cdot \frac{t}{16}\right) \cdot \cos \color{blue}{\left(\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot \frac{t}{16}\right)}\right) \]
      7. fma-define46.8%

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

      \[\leadsto \color{blue}{x \cdot \left(\cos \left(\left(\mathsf{fma}\left(y, 2, 1\right) \cdot z\right) \cdot \frac{t}{16}\right) \cdot \cos \left(\left(\mathsf{fma}\left(a, 2, 1\right) \cdot b\right) \cdot \frac{t}{16}\right)\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-*r/46.8%

        \[\leadsto x \cdot \left(\cos \left(\left(\mathsf{fma}\left(y, 2, 1\right) \cdot z\right) \cdot \frac{t}{16}\right) \cdot \cos \color{blue}{\left(\frac{\left(\mathsf{fma}\left(a, 2, 1\right) \cdot b\right) \cdot t}{16}\right)}\right) \]
      2. fma-define46.8%

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

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

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

        \[\leadsto x \cdot \left(\cos \left(\left(\mathsf{fma}\left(y, 2, 1\right) \cdot z\right) \cdot \frac{t}{16}\right) \cdot \cos \left(\frac{1}{\frac{16}{\color{blue}{\mathsf{fma}\left(a, 2, 1\right)} \cdot \left(b \cdot t\right)}}\right)\right) \]
    6. Applied egg-rr46.9%

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

      \[\leadsto x \cdot \left(\cos \left(\left(\mathsf{fma}\left(y, 2, 1\right) \cdot z\right) \cdot \frac{t}{16}\right) \cdot \cos \left(\frac{1}{\frac{16}{\color{blue}{b \cdot t}}}\right)\right) \]
    8. Step-by-step derivation
      1. *-commutative47.7%

        \[\leadsto x \cdot \left(\cos \left(\left(\mathsf{fma}\left(y, 2, 1\right) \cdot z\right) \cdot \frac{t}{16}\right) \cdot \cos \left(\frac{1}{\frac{16}{\color{blue}{t \cdot b}}}\right)\right) \]
    9. Simplified47.7%

      \[\leadsto x \cdot \left(\cos \left(\left(\mathsf{fma}\left(y, 2, 1\right) \cdot z\right) \cdot \frac{t}{16}\right) \cdot \cos \left(\frac{1}{\frac{16}{\color{blue}{t \cdot b}}}\right)\right) \]

    if 5.0000000000000003e271 < (*.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 2.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. Simplified4.7%

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

      \[\leadsto \cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \left(t \cdot 0.0625\right)\right)\right) \cdot \left(x \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. metadata-eval7.3%

        \[\leadsto \cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \left(t \cdot \color{blue}{\frac{1}{16}}\right)\right)\right) \cdot \left(x \cdot 1\right) \]
      2. div-inv7.3%

        \[\leadsto \cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \color{blue}{\frac{t}{16}}\right)\right) \cdot \left(x \cdot 1\right) \]
      3. expm1-log1p-u7.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \frac{t}{16}\right)\right)\right)\right)} \cdot \left(x \cdot 1\right) \]
      4. expm1-undefine7.3%

        \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \frac{t}{16}\right)\right)\right)} - 1\right)} \cdot \left(x \cdot 1\right) \]
      5. div-inv7.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \color{blue}{\left(t \cdot \frac{1}{16}\right)}\right)\right)\right)} - 1\right) \cdot \left(x \cdot 1\right) \]
      6. metadata-eval7.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \left(t \cdot \color{blue}{0.0625}\right)\right)\right)\right)} - 1\right) \cdot \left(x \cdot 1\right) \]
      7. *-commutative7.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \color{blue}{\left(0.0625 \cdot t\right)}\right)\right)\right)} - 1\right) \cdot \left(x \cdot 1\right) \]
    6. Applied egg-rr7.3%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \left(0.0625 \cdot t\right)\right)\right)\right)} - 1\right)} \cdot \left(x \cdot 1\right) \]
    7. Taylor expanded in z around 0 11.2%

      \[\leadsto \left(e^{\color{blue}{\log 2 + -0.0009765625 \cdot \left({t}^{2} \cdot \left({z}^{2} \cdot {\left(1 + 2 \cdot y\right)}^{2}\right)\right)}} - 1\right) \cdot \left(x \cdot 1\right) \]
    8. Step-by-step derivation
      1. +-commutative11.2%

        \[\leadsto \left(e^{\color{blue}{-0.0009765625 \cdot \left({t}^{2} \cdot \left({z}^{2} \cdot {\left(1 + 2 \cdot y\right)}^{2}\right)\right) + \log 2}} - 1\right) \cdot \left(x \cdot 1\right) \]
      2. *-commutative11.2%

        \[\leadsto \left(e^{\color{blue}{\left({t}^{2} \cdot \left({z}^{2} \cdot {\left(1 + 2 \cdot y\right)}^{2}\right)\right) \cdot -0.0009765625} + \log 2} - 1\right) \cdot \left(x \cdot 1\right) \]
      3. fma-define11.2%

        \[\leadsto \left(e^{\color{blue}{\mathsf{fma}\left({t}^{2} \cdot \left({z}^{2} \cdot {\left(1 + 2 \cdot y\right)}^{2}\right), -0.0009765625, \log 2\right)}} - 1\right) \cdot \left(x \cdot 1\right) \]
    9. Simplified13.9%

      \[\leadsto \left(e^{\color{blue}{\mathsf{fma}\left({\left(t \cdot \left(z \cdot \mathsf{fma}\left(2, y, 1\right)\right)\right)}^{2}, -0.0009765625, \log 2\right)}} - 1\right) \cdot \left(x \cdot 1\right) \]
    10. Taylor expanded in y around 0 12.5%

      \[\leadsto \color{blue}{x \cdot \left(e^{\log 2 + -0.0009765625 \cdot \left({t}^{2} \cdot {z}^{2}\right)} - 1\right)} \]
    11. Step-by-step derivation
      1. *-commutative12.5%

        \[\leadsto \color{blue}{\left(e^{\log 2 + -0.0009765625 \cdot \left({t}^{2} \cdot {z}^{2}\right)} - 1\right) \cdot x} \]
      2. expm1-define12.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\log 2 + -0.0009765625 \cdot \left({t}^{2} \cdot {z}^{2}\right)\right)} \cdot x \]
      3. *-commutative12.5%

        \[\leadsto \mathsf{expm1}\left(\log 2 + \color{blue}{\left({t}^{2} \cdot {z}^{2}\right) \cdot -0.0009765625}\right) \cdot x \]
      4. unpow212.5%

        \[\leadsto \mathsf{expm1}\left(\log 2 + \left(\color{blue}{\left(t \cdot t\right)} \cdot {z}^{2}\right) \cdot -0.0009765625\right) \cdot x \]
      5. unpow212.5%

        \[\leadsto \mathsf{expm1}\left(\log 2 + \left(\left(t \cdot t\right) \cdot \color{blue}{\left(z \cdot z\right)}\right) \cdot -0.0009765625\right) \cdot x \]
      6. swap-sqr14.1%

        \[\leadsto \mathsf{expm1}\left(\log 2 + \color{blue}{\left(\left(t \cdot z\right) \cdot \left(t \cdot z\right)\right)} \cdot -0.0009765625\right) \cdot x \]
      7. unpow214.1%

        \[\leadsto \mathsf{expm1}\left(\log 2 + \color{blue}{{\left(t \cdot z\right)}^{2}} \cdot -0.0009765625\right) \cdot x \]
    12. Simplified14.1%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\log 2 + {\left(t \cdot z\right)}^{2} \cdot -0.0009765625\right) \cdot x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification34.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(x \cdot \cos \left(\frac{t \cdot \left(z \cdot \left(1 + 2 \cdot y\right)\right)}{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^{+271}:\\ \;\;\;\;x \cdot \left(\cos \left(\left(z \cdot \mathsf{fma}\left(y, 2, 1\right)\right) \cdot \frac{t}{16}\right) \cdot \cos \left(\frac{1}{\frac{16}{t \cdot b}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \mathsf{expm1}\left(\log 2 + -0.0009765625 \cdot {\left(t \cdot z\right)}^{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 32.1% accurate, 0.4× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \left(\left(e^{\mathsf{fma}\left({\left(t \cdot \left(z \cdot \mathsf{fma}\left(2, y, 1\right)\right)\right)}^{2}, -0.0009765625, \log 2\right)} + -1\right) \cdot x\_m\right) \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z t a b)
 :precision binary64
 (*
  x_s
  (*
   (+
    (exp (fma (pow (* t (* z (fma 2.0 y 1.0))) 2.0) -0.0009765625 (log 2.0)))
    -1.0)
   x_m)))
x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t, double a, double b) {
	return x_s * ((exp(fma(pow((t * (z * fma(2.0, y, 1.0))), 2.0), -0.0009765625, log(2.0))) + -1.0) * x_m);
}
x_m = abs(x)
x_s = copysign(1.0, x)
function code(x_s, x_m, y, z, t, a, b)
	return Float64(x_s * Float64(Float64(exp(fma((Float64(t * Float64(z * fma(2.0, y, 1.0))) ^ 2.0), -0.0009765625, log(2.0))) + -1.0) * x_m))
end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_, a_, b_] := N[(x$95$s * N[(N[(N[Exp[N[(N[Power[N[(t * N[(z * N[(2.0 * y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.0009765625 + N[Log[2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision] * x$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \left(\left(e^{\mathsf{fma}\left({\left(t \cdot \left(z \cdot \mathsf{fma}\left(2, y, 1\right)\right)\right)}^{2}, -0.0009765625, \log 2\right)} + -1\right) \cdot x\_m\right)
\end{array}
Derivation
  1. Initial program 29.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. Simplified29.9%

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

    \[\leadsto \cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \left(t \cdot 0.0625\right)\right)\right) \cdot \left(x \cdot \color{blue}{1}\right) \]
  5. Step-by-step derivation
    1. metadata-eval31.2%

      \[\leadsto \cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \left(t \cdot \color{blue}{\frac{1}{16}}\right)\right)\right) \cdot \left(x \cdot 1\right) \]
    2. div-inv31.2%

      \[\leadsto \cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \color{blue}{\frac{t}{16}}\right)\right) \cdot \left(x \cdot 1\right) \]
    3. expm1-log1p-u31.2%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \frac{t}{16}\right)\right)\right)\right)} \cdot \left(x \cdot 1\right) \]
    4. expm1-undefine31.2%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \frac{t}{16}\right)\right)\right)} - 1\right)} \cdot \left(x \cdot 1\right) \]
    5. div-inv31.2%

      \[\leadsto \left(e^{\mathsf{log1p}\left(\cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \color{blue}{\left(t \cdot \frac{1}{16}\right)}\right)\right)\right)} - 1\right) \cdot \left(x \cdot 1\right) \]
    6. metadata-eval31.2%

      \[\leadsto \left(e^{\mathsf{log1p}\left(\cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \left(t \cdot \color{blue}{0.0625}\right)\right)\right)\right)} - 1\right) \cdot \left(x \cdot 1\right) \]
    7. *-commutative31.2%

      \[\leadsto \left(e^{\mathsf{log1p}\left(\cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \color{blue}{\left(0.0625 \cdot t\right)}\right)\right)\right)} - 1\right) \cdot \left(x \cdot 1\right) \]
  6. Applied egg-rr31.2%

    \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \left(0.0625 \cdot t\right)\right)\right)\right)} - 1\right)} \cdot \left(x \cdot 1\right) \]
  7. Taylor expanded in z around 0 25.9%

    \[\leadsto \left(e^{\color{blue}{\log 2 + -0.0009765625 \cdot \left({t}^{2} \cdot \left({z}^{2} \cdot {\left(1 + 2 \cdot y\right)}^{2}\right)\right)}} - 1\right) \cdot \left(x \cdot 1\right) \]
  8. Step-by-step derivation
    1. +-commutative25.9%

      \[\leadsto \left(e^{\color{blue}{-0.0009765625 \cdot \left({t}^{2} \cdot \left({z}^{2} \cdot {\left(1 + 2 \cdot y\right)}^{2}\right)\right) + \log 2}} - 1\right) \cdot \left(x \cdot 1\right) \]
    2. *-commutative25.9%

      \[\leadsto \left(e^{\color{blue}{\left({t}^{2} \cdot \left({z}^{2} \cdot {\left(1 + 2 \cdot y\right)}^{2}\right)\right) \cdot -0.0009765625} + \log 2} - 1\right) \cdot \left(x \cdot 1\right) \]
    3. fma-define25.9%

      \[\leadsto \left(e^{\color{blue}{\mathsf{fma}\left({t}^{2} \cdot \left({z}^{2} \cdot {\left(1 + 2 \cdot y\right)}^{2}\right), -0.0009765625, \log 2\right)}} - 1\right) \cdot \left(x \cdot 1\right) \]
  9. Simplified32.9%

    \[\leadsto \left(e^{\color{blue}{\mathsf{fma}\left({\left(t \cdot \left(z \cdot \mathsf{fma}\left(2, y, 1\right)\right)\right)}^{2}, -0.0009765625, \log 2\right)}} - 1\right) \cdot \left(x \cdot 1\right) \]
  10. Final simplification32.9%

    \[\leadsto \left(e^{\mathsf{fma}\left({\left(t \cdot \left(z \cdot \mathsf{fma}\left(2, y, 1\right)\right)\right)}^{2}, -0.0009765625, \log 2\right)} + -1\right) \cdot x \]
  11. Add Preprocessing

Alternative 3: 32.0% accurate, 0.7× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \left(x\_m \cdot \mathsf{expm1}\left(\log 2 + -0.0009765625 \cdot {\left(t \cdot z\right)}^{2}\right)\right) \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z t a b)
 :precision binary64
 (* x_s (* x_m (expm1 (+ (log 2.0) (* -0.0009765625 (pow (* t z) 2.0)))))))
x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t, double a, double b) {
	return x_s * (x_m * expm1((log(2.0) + (-0.0009765625 * pow((t * z), 2.0)))));
}
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t, double a, double b) {
	return x_s * (x_m * Math.expm1((Math.log(2.0) + (-0.0009765625 * Math.pow((t * z), 2.0)))));
}
x_m = math.fabs(x)
x_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z, t, a, b):
	return x_s * (x_m * math.expm1((math.log(2.0) + (-0.0009765625 * math.pow((t * z), 2.0)))))
x_m = abs(x)
x_s = copysign(1.0, x)
function code(x_s, x_m, y, z, t, a, b)
	return Float64(x_s * Float64(x_m * expm1(Float64(log(2.0) + Float64(-0.0009765625 * (Float64(t * z) ^ 2.0))))))
end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_, a_, b_] := N[(x$95$s * N[(x$95$m * N[(Exp[N[(N[Log[2.0], $MachinePrecision] + N[(-0.0009765625 * N[Power[N[(t * z), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \left(x\_m \cdot \mathsf{expm1}\left(\log 2 + -0.0009765625 \cdot {\left(t \cdot z\right)}^{2}\right)\right)
\end{array}
Derivation
  1. Initial program 29.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. Simplified29.9%

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

    \[\leadsto \cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \left(t \cdot 0.0625\right)\right)\right) \cdot \left(x \cdot \color{blue}{1}\right) \]
  5. Step-by-step derivation
    1. metadata-eval31.2%

      \[\leadsto \cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \left(t \cdot \color{blue}{\frac{1}{16}}\right)\right)\right) \cdot \left(x \cdot 1\right) \]
    2. div-inv31.2%

      \[\leadsto \cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \color{blue}{\frac{t}{16}}\right)\right) \cdot \left(x \cdot 1\right) \]
    3. expm1-log1p-u31.2%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \frac{t}{16}\right)\right)\right)\right)} \cdot \left(x \cdot 1\right) \]
    4. expm1-undefine31.2%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \frac{t}{16}\right)\right)\right)} - 1\right)} \cdot \left(x \cdot 1\right) \]
    5. div-inv31.2%

      \[\leadsto \left(e^{\mathsf{log1p}\left(\cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \color{blue}{\left(t \cdot \frac{1}{16}\right)}\right)\right)\right)} - 1\right) \cdot \left(x \cdot 1\right) \]
    6. metadata-eval31.2%

      \[\leadsto \left(e^{\mathsf{log1p}\left(\cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \left(t \cdot \color{blue}{0.0625}\right)\right)\right)\right)} - 1\right) \cdot \left(x \cdot 1\right) \]
    7. *-commutative31.2%

      \[\leadsto \left(e^{\mathsf{log1p}\left(\cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \color{blue}{\left(0.0625 \cdot t\right)}\right)\right)\right)} - 1\right) \cdot \left(x \cdot 1\right) \]
  6. Applied egg-rr31.2%

    \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \left(0.0625 \cdot t\right)\right)\right)\right)} - 1\right)} \cdot \left(x \cdot 1\right) \]
  7. Taylor expanded in z around 0 25.9%

    \[\leadsto \left(e^{\color{blue}{\log 2 + -0.0009765625 \cdot \left({t}^{2} \cdot \left({z}^{2} \cdot {\left(1 + 2 \cdot y\right)}^{2}\right)\right)}} - 1\right) \cdot \left(x \cdot 1\right) \]
  8. Step-by-step derivation
    1. +-commutative25.9%

      \[\leadsto \left(e^{\color{blue}{-0.0009765625 \cdot \left({t}^{2} \cdot \left({z}^{2} \cdot {\left(1 + 2 \cdot y\right)}^{2}\right)\right) + \log 2}} - 1\right) \cdot \left(x \cdot 1\right) \]
    2. *-commutative25.9%

      \[\leadsto \left(e^{\color{blue}{\left({t}^{2} \cdot \left({z}^{2} \cdot {\left(1 + 2 \cdot y\right)}^{2}\right)\right) \cdot -0.0009765625} + \log 2} - 1\right) \cdot \left(x \cdot 1\right) \]
    3. fma-define25.9%

      \[\leadsto \left(e^{\color{blue}{\mathsf{fma}\left({t}^{2} \cdot \left({z}^{2} \cdot {\left(1 + 2 \cdot y\right)}^{2}\right), -0.0009765625, \log 2\right)}} - 1\right) \cdot \left(x \cdot 1\right) \]
  9. Simplified32.9%

    \[\leadsto \left(e^{\color{blue}{\mathsf{fma}\left({\left(t \cdot \left(z \cdot \mathsf{fma}\left(2, y, 1\right)\right)\right)}^{2}, -0.0009765625, \log 2\right)}} - 1\right) \cdot \left(x \cdot 1\right) \]
  10. Taylor expanded in y around 0 30.6%

    \[\leadsto \color{blue}{x \cdot \left(e^{\log 2 + -0.0009765625 \cdot \left({t}^{2} \cdot {z}^{2}\right)} - 1\right)} \]
  11. Step-by-step derivation
    1. *-commutative30.6%

      \[\leadsto \color{blue}{\left(e^{\log 2 + -0.0009765625 \cdot \left({t}^{2} \cdot {z}^{2}\right)} - 1\right) \cdot x} \]
    2. expm1-define30.6%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\log 2 + -0.0009765625 \cdot \left({t}^{2} \cdot {z}^{2}\right)\right)} \cdot x \]
    3. *-commutative30.6%

      \[\leadsto \mathsf{expm1}\left(\log 2 + \color{blue}{\left({t}^{2} \cdot {z}^{2}\right) \cdot -0.0009765625}\right) \cdot x \]
    4. unpow230.6%

      \[\leadsto \mathsf{expm1}\left(\log 2 + \left(\color{blue}{\left(t \cdot t\right)} \cdot {z}^{2}\right) \cdot -0.0009765625\right) \cdot x \]
    5. unpow230.6%

      \[\leadsto \mathsf{expm1}\left(\log 2 + \left(\left(t \cdot t\right) \cdot \color{blue}{\left(z \cdot z\right)}\right) \cdot -0.0009765625\right) \cdot x \]
    6. swap-sqr32.7%

      \[\leadsto \mathsf{expm1}\left(\log 2 + \color{blue}{\left(\left(t \cdot z\right) \cdot \left(t \cdot z\right)\right)} \cdot -0.0009765625\right) \cdot x \]
    7. unpow232.7%

      \[\leadsto \mathsf{expm1}\left(\log 2 + \color{blue}{{\left(t \cdot z\right)}^{2}} \cdot -0.0009765625\right) \cdot x \]
  12. Simplified32.7%

    \[\leadsto \color{blue}{\mathsf{expm1}\left(\log 2 + {\left(t \cdot z\right)}^{2} \cdot -0.0009765625\right) \cdot x} \]
  13. Final simplification32.7%

    \[\leadsto x \cdot \mathsf{expm1}\left(\log 2 + -0.0009765625 \cdot {\left(t \cdot z\right)}^{2}\right) \]
  14. Add Preprocessing

Alternative 4: 31.8% accurate, 225.0× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot x\_m \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z t a b) :precision binary64 (* x_s x_m))
x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t, double a, double b) {
	return x_s * x_m;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t, a, b)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    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_s * x_m
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t, double a, double b) {
	return x_s * x_m;
}
x_m = math.fabs(x)
x_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z, t, a, b):
	return x_s * x_m
x_m = abs(x)
x_s = copysign(1.0, x)
function code(x_s, x_m, y, z, t, a, b)
	return Float64(x_s * x_m)
end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
function tmp = code(x_s, x_m, y, z, t, a, b)
	tmp = x_s * x_m;
end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_, a_, b_] := N[(x$95$s * x$95$m), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot x\_m
\end{array}
Derivation
  1. Initial program 29.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. Simplified29.9%

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

    \[\leadsto \cos \left(\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot \left(t \cdot 0.0625\right)\right)\right) \cdot \left(x \cdot \color{blue}{1}\right) \]
  5. Taylor expanded in z around 0 31.9%

    \[\leadsto \color{blue}{x} \]
  6. Final simplification31.9%

    \[\leadsto x \]
  7. Add Preprocessing

Developer target: 31.4% 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 2024062 
(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))))