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

Percentage Accurate: 27.2% → 31.7%
Time: 28.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.2% 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.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \cos \left(\frac{t \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\right) \cdot t}{16}\right)\right) \cdot t_1 \leq 10^{+245}:\\ \;\;\;\;t_1 \cdot \left(x \cdot \cos \left(\frac{{\left(\sqrt[3]{\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot t\right)}\right)}^{3}}{16}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \mathsf{expm1}\left(\mathsf{fma}\left(-0.0009765625, {\left(t \cdot b\right)}^{2}, \log 2\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (cos (/ (* t (* (+ 1.0 (* 2.0 a)) b)) 16.0))))
   (if (<= (* (* x (cos (/ (* (* (+ (* y 2.0) 1.0) z) t) 16.0))) t_1) 1e+245)
     (* t_1 (* x (cos (/ (pow (cbrt (* (fma y 2.0 1.0) (* z t))) 3.0) 16.0))))
     (* x (expm1 (fma -0.0009765625 (pow (* t b) 2.0) (log 2.0)))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = cos(((t * ((1.0 + (2.0 * a)) * b)) / 16.0));
	double tmp;
	if (((x * cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * t_1) <= 1e+245) {
		tmp = t_1 * (x * cos((pow(cbrt((fma(y, 2.0, 1.0) * (z * t))), 3.0) / 16.0)));
	} else {
		tmp = x * expm1(fma(-0.0009765625, pow((t * b), 2.0), log(2.0)));
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = cos(Float64(Float64(t * 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) * t) / 16.0))) * t_1) <= 1e+245)
		tmp = Float64(t_1 * Float64(x * cos(Float64((cbrt(Float64(fma(y, 2.0, 1.0) * Float64(z * t))) ^ 3.0) / 16.0))));
	else
		tmp = Float64(x * expm1(fma(-0.0009765625, (Float64(t * b) ^ 2.0), log(2.0))));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Cos[N[(N[(t * 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), $MachinePrecision] * t), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], 1e+245], N[(t$95$1 * N[(x * N[Cos[N[(N[Power[N[Power[N[(N[(y * 2.0 + 1.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(Exp[N[(-0.0009765625 * N[Power[N[(t * b), $MachinePrecision], 2.0], $MachinePrecision] + N[Log[2.0], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \cos \left(\frac{t \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\right) \cdot t}{16}\right)\right) \cdot t_1 \leq 10^{+245}:\\
\;\;\;\;t_1 \cdot \left(x \cdot \cos \left(\frac{{\left(\sqrt[3]{\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot t\right)}\right)}^{3}}{16}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot \mathsf{expm1}\left(\mathsf{fma}\left(-0.0009765625, {\left(t \cdot b\right)}^{2}, \log 2\right)\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))) < 1.00000000000000004e245

    1. Initial program 46.2%

      \[\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. add-cube-cbrt47.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} \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. pow347.1%

        \[\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. associate-*l*47.0%

        \[\leadsto \left(x \cdot \cos \left(\frac{{\left(\sqrt[3]{\color{blue}{\left(y \cdot 2 + 1\right) \cdot \left(z \cdot t\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-def47.0%

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

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

    if 1.00000000000000004e245 < (*.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.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. Step-by-step derivation
      1. associate-*l*3.3%

        \[\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. *-commutative3.3%

        \[\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. *-commutative3.3%

        \[\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/3.3%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\cos \left(0.0625 \cdot \left(t \cdot b\right)\right) \cdot x} \]
    6. Step-by-step derivation
      1. expm1-log1p-u12.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(0.0625 \cdot \left(t \cdot b\right)\right)\right)\right)} \cdot x \]
    7. Applied egg-rr12.1%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(0.0625 \cdot \left(t \cdot b\right)\right)\right)\right)} \cdot x \]
    8. Taylor expanded in t around 0 14.4%

      \[\leadsto \mathsf{expm1}\left(\color{blue}{\log 2 + -0.0009765625 \cdot \left({t}^{2} \cdot {b}^{2}\right)}\right) \cdot x \]
    9. Step-by-step derivation
      1. +-commutative14.4%

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

        \[\leadsto \mathsf{expm1}\left(\color{blue}{\mathsf{fma}\left(-0.0009765625, {t}^{2} \cdot {b}^{2}, \log 2\right)}\right) \cdot x \]
      3. unpow214.4%

        \[\leadsto \mathsf{expm1}\left(\mathsf{fma}\left(-0.0009765625, \color{blue}{\left(t \cdot t\right)} \cdot {b}^{2}, \log 2\right)\right) \cdot x \]
      4. unpow214.4%

        \[\leadsto \mathsf{expm1}\left(\mathsf{fma}\left(-0.0009765625, \left(t \cdot t\right) \cdot \color{blue}{\left(b \cdot b\right)}, \log 2\right)\right) \cdot x \]
      5. swap-sqr15.9%

        \[\leadsto \mathsf{expm1}\left(\mathsf{fma}\left(-0.0009765625, \color{blue}{\left(t \cdot b\right) \cdot \left(t \cdot b\right)}, \log 2\right)\right) \cdot x \]
      6. unpow215.9%

        \[\leadsto \mathsf{expm1}\left(\mathsf{fma}\left(-0.0009765625, \color{blue}{{\left(t \cdot b\right)}^{2}}, \log 2\right)\right) \cdot x \]
    10. Simplified15.9%

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

    \[\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^{+245}:\\ \;\;\;\;\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(\sqrt[3]{\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot t\right)}\right)}^{3}}{16}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \mathsf{expm1}\left(\mathsf{fma}\left(-0.0009765625, {\left(t \cdot b\right)}^{2}, \log 2\right)\right)\\ \end{array} \]

Alternative 2: 30.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \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^{+245}:\\ \;\;\;\;\left(x \cdot \cos \left(\frac{z \cdot \mathsf{fma}\left(y, 2, 1\right)}{\frac{16}{t}}\right)\right) \cdot \cos \left(t \cdot \left(\left(b \cdot \left(-1 + a \cdot -2\right)\right) \cdot -0.0625\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \mathsf{expm1}\left(\log 2 + -0.0009765625 \cdot \left(\left(t \cdot t\right) \cdot \left(b \cdot b\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<=
      (*
       (* x (cos (/ (* (* (+ (* y 2.0) 1.0) z) t) 16.0)))
       (cos (/ (* t (* (+ 1.0 (* 2.0 a)) b)) 16.0)))
      1e+245)
   (*
    (* x (cos (/ (* z (fma y 2.0 1.0)) (/ 16.0 t))))
    (cos (* t (* (* b (+ -1.0 (* a -2.0))) -0.0625))))
   (* x (expm1 (+ (log 2.0) (* -0.0009765625 (* (* t t) (* b b))))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (((x * cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * cos(((t * ((1.0 + (2.0 * a)) * b)) / 16.0))) <= 1e+245) {
		tmp = (x * cos(((z * fma(y, 2.0, 1.0)) / (16.0 / t)))) * cos((t * ((b * (-1.0 + (a * -2.0))) * -0.0625)));
	} else {
		tmp = x * expm1((log(2.0) + (-0.0009765625 * ((t * t) * (b * b)))));
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (Float64(Float64(x * cos(Float64(Float64(Float64(Float64(Float64(y * 2.0) + 1.0) * z) * t) / 16.0))) * cos(Float64(Float64(t * Float64(Float64(1.0 + Float64(2.0 * a)) * b)) / 16.0))) <= 1e+245)
		tmp = Float64(Float64(x * cos(Float64(Float64(z * fma(y, 2.0, 1.0)) / Float64(16.0 / t)))) * cos(Float64(t * Float64(Float64(b * Float64(-1.0 + Float64(a * -2.0))) * -0.0625))));
	else
		tmp = Float64(x * expm1(Float64(log(2.0) + Float64(-0.0009765625 * Float64(Float64(t * t) * Float64(b * b))))));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[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[(t * N[(N[(1.0 + N[(2.0 * a), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1e+245], N[(N[(x * N[Cos[N[(N[(z * N[(y * 2.0 + 1.0), $MachinePrecision]), $MachinePrecision] / N[(16.0 / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(t * N[(N[(b * N[(-1.0 + N[(a * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.0625), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[(Exp[N[(N[Log[2.0], $MachinePrecision] + N[(-0.0009765625 * N[(N[(t * t), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\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^{+245}:\\
\;\;\;\;\left(x \cdot \cos \left(\frac{z \cdot \mathsf{fma}\left(y, 2, 1\right)}{\frac{16}{t}}\right)\right) \cdot \cos \left(t \cdot \left(\left(b \cdot \left(-1 + a \cdot -2\right)\right) \cdot -0.0625\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot \mathsf{expm1}\left(\log 2 + -0.0009765625 \cdot \left(\left(t \cdot t\right) \cdot \left(b \cdot b\right)\right)\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))) < 1.00000000000000004e245

    1. Initial program 46.2%

      \[\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. *-commutative46.2%

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

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

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

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

        \[\leadsto \cos \left(\frac{\color{blue}{\left(-\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}}{16}\right) \cdot \left(x \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right)\right) \]
      6. distribute-rgt-neg-out46.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x \cdot \cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right) \cdot z}{\frac{16}{t}}\right)\right) \cdot \cos \left(t \cdot \left(\left(b \cdot \left(0 - \left(1 + \color{blue}{\left(--2\right)} \cdot a\right)\right)\right) \cdot -0.0625\right)\right) \]
      9. cancel-sign-sub-inv46.8%

        \[\leadsto \left(x \cdot \cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right) \cdot z}{\frac{16}{t}}\right)\right) \cdot \cos \left(t \cdot \left(\left(b \cdot \left(0 - \color{blue}{\left(1 - -2 \cdot a\right)}\right)\right) \cdot -0.0625\right)\right) \]
      10. associate--r-46.8%

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

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

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

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

    if 1.00000000000000004e245 < (*.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.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. Step-by-step derivation
      1. associate-*l*3.3%

        \[\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. *-commutative3.3%

        \[\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. *-commutative3.3%

        \[\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/3.3%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\cos \left(0.0625 \cdot \left(t \cdot b\right)\right) \cdot x} \]
    6. Step-by-step derivation
      1. expm1-log1p-u12.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(0.0625 \cdot \left(t \cdot b\right)\right)\right)\right)} \cdot x \]
    7. Applied egg-rr12.1%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(0.0625 \cdot \left(t \cdot b\right)\right)\right)\right)} \cdot x \]
    8. Taylor expanded in t around 0 14.4%

      \[\leadsto \mathsf{expm1}\left(\color{blue}{\log 2 + -0.0009765625 \cdot \left({t}^{2} \cdot {b}^{2}\right)}\right) \cdot x \]
    9. Step-by-step derivation
      1. unpow214.4%

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

        \[\leadsto \mathsf{expm1}\left(\log 2 + -0.0009765625 \cdot \left(\left(t \cdot t\right) \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) \cdot x \]
    10. Simplified14.4%

      \[\leadsto \mathsf{expm1}\left(\color{blue}{\log 2 + -0.0009765625 \cdot \left(\left(t \cdot t\right) \cdot \left(b \cdot b\right)\right)}\right) \cdot x \]
  3. Recombined 2 regimes into one program.
  4. Final simplification32.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^{+245}:\\ \;\;\;\;\left(x \cdot \cos \left(\frac{z \cdot \mathsf{fma}\left(y, 2, 1\right)}{\frac{16}{t}}\right)\right) \cdot \cos \left(t \cdot \left(\left(b \cdot \left(-1 + a \cdot -2\right)\right) \cdot -0.0625\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \mathsf{expm1}\left(\log 2 + -0.0009765625 \cdot \left(\left(t \cdot t\right) \cdot \left(b \cdot b\right)\right)\right)\\ \end{array} \]

Alternative 3: 30.7% accurate, 0.6× speedup?

\[\begin{array}{l} \\ x \cdot \mathsf{expm1}\left(\mathsf{fma}\left(-0.0009765625, {\left(t \cdot b\right)}^{2}, \log 2\right)\right) \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (* x (expm1 (fma -0.0009765625 (pow (* t b) 2.0) (log 2.0)))))
double code(double x, double y, double z, double t, double a, double b) {
	return x * expm1(fma(-0.0009765625, pow((t * b), 2.0), log(2.0)));
}
function code(x, y, z, t, a, b)
	return Float64(x * expm1(fma(-0.0009765625, (Float64(t * b) ^ 2.0), log(2.0))))
end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[(Exp[N[(-0.0009765625 * N[Power[N[(t * b), $MachinePrecision], 2.0], $MachinePrecision] + N[Log[2.0], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot \mathsf{expm1}\left(\mathsf{fma}\left(-0.0009765625, {\left(t \cdot b\right)}^{2}, \log 2\right)\right)
\end{array}
Derivation
  1. Initial program 26.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. Step-by-step derivation
    1. associate-*l*26.9%

      \[\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. *-commutative26.9%

      \[\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. *-commutative26.9%

      \[\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/26.9%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\cos \left(0.0625 \cdot \left(t \cdot b\right)\right) \cdot x} \]
  6. Step-by-step derivation
    1. expm1-log1p-u30.0%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(0.0625 \cdot \left(t \cdot b\right)\right)\right)\right)} \cdot x \]
  7. Applied egg-rr30.0%

    \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(0.0625 \cdot \left(t \cdot b\right)\right)\right)\right)} \cdot x \]
  8. Taylor expanded in t around 0 29.3%

    \[\leadsto \mathsf{expm1}\left(\color{blue}{\log 2 + -0.0009765625 \cdot \left({t}^{2} \cdot {b}^{2}\right)}\right) \cdot x \]
  9. Step-by-step derivation
    1. +-commutative29.3%

      \[\leadsto \mathsf{expm1}\left(\color{blue}{-0.0009765625 \cdot \left({t}^{2} \cdot {b}^{2}\right) + \log 2}\right) \cdot x \]
    2. fma-def29.3%

      \[\leadsto \mathsf{expm1}\left(\color{blue}{\mathsf{fma}\left(-0.0009765625, {t}^{2} \cdot {b}^{2}, \log 2\right)}\right) \cdot x \]
    3. unpow229.3%

      \[\leadsto \mathsf{expm1}\left(\mathsf{fma}\left(-0.0009765625, \color{blue}{\left(t \cdot t\right)} \cdot {b}^{2}, \log 2\right)\right) \cdot x \]
    4. unpow229.3%

      \[\leadsto \mathsf{expm1}\left(\mathsf{fma}\left(-0.0009765625, \left(t \cdot t\right) \cdot \color{blue}{\left(b \cdot b\right)}, \log 2\right)\right) \cdot x \]
    5. swap-sqr31.5%

      \[\leadsto \mathsf{expm1}\left(\mathsf{fma}\left(-0.0009765625, \color{blue}{\left(t \cdot b\right) \cdot \left(t \cdot b\right)}, \log 2\right)\right) \cdot x \]
    6. unpow231.5%

      \[\leadsto \mathsf{expm1}\left(\mathsf{fma}\left(-0.0009765625, \color{blue}{{\left(t \cdot b\right)}^{2}}, \log 2\right)\right) \cdot x \]
  10. Simplified31.5%

    \[\leadsto \mathsf{expm1}\left(\color{blue}{\mathsf{fma}\left(-0.0009765625, {\left(t \cdot b\right)}^{2}, \log 2\right)}\right) \cdot x \]
  11. Final simplification31.5%

    \[\leadsto x \cdot \mathsf{expm1}\left(\mathsf{fma}\left(-0.0009765625, {\left(t \cdot b\right)}^{2}, \log 2\right)\right) \]

Alternative 4: 29.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq 2.75 \cdot 10^{-77}:\\ \;\;\;\;\left(x \cdot \cos \left(\frac{z \cdot t}{16}\right)\right) \cdot \cos \left(\frac{t \cdot b}{16}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \mathsf{expm1}\left(\log 2 + -0.0009765625 \cdot \left(\left(t \cdot t\right) \cdot \left(b \cdot b\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= t 2.75e-77)
   (* (* x (cos (/ (* z t) 16.0))) (cos (/ (* t b) 16.0)))
   (* x (expm1 (+ (log 2.0) (* -0.0009765625 (* (* t t) (* b b))))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (t <= 2.75e-77) {
		tmp = (x * cos(((z * t) / 16.0))) * cos(((t * b) / 16.0));
	} else {
		tmp = x * expm1((log(2.0) + (-0.0009765625 * ((t * t) * (b * b)))));
	}
	return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (t <= 2.75e-77) {
		tmp = (x * Math.cos(((z * t) / 16.0))) * Math.cos(((t * b) / 16.0));
	} else {
		tmp = x * Math.expm1((Math.log(2.0) + (-0.0009765625 * ((t * t) * (b * b)))));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if t <= 2.75e-77:
		tmp = (x * math.cos(((z * t) / 16.0))) * math.cos(((t * b) / 16.0))
	else:
		tmp = x * math.expm1((math.log(2.0) + (-0.0009765625 * ((t * t) * (b * b)))))
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (t <= 2.75e-77)
		tmp = Float64(Float64(x * cos(Float64(Float64(z * t) / 16.0))) * cos(Float64(Float64(t * b) / 16.0)));
	else
		tmp = Float64(x * expm1(Float64(log(2.0) + Float64(-0.0009765625 * Float64(Float64(t * t) * Float64(b * b))))));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, 2.75e-77], N[(N[(x * N[Cos[N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(t * b), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[(Exp[N[(N[Log[2.0], $MachinePrecision] + N[(-0.0009765625 * N[(N[(t * t), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.75 \cdot 10^{-77}:\\
\;\;\;\;\left(x \cdot \cos \left(\frac{z \cdot t}{16}\right)\right) \cdot \cos \left(\frac{t \cdot b}{16}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 2.74999999999999999e-77

    1. Initial program 32.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. Taylor expanded in y around 0 34.1%

      \[\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) \]
    3. Taylor expanded in a around 0 35.1%

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

    if 2.74999999999999999e-77 < t

    1. Initial program 15.4%

      \[\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*15.4%

        \[\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. *-commutative15.4%

        \[\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. *-commutative15.4%

        \[\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/15.4%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\cos \left(0.0625 \cdot \left(t \cdot b\right)\right) \cdot x} \]
    6. Step-by-step derivation
      1. expm1-log1p-u18.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(0.0625 \cdot \left(t \cdot b\right)\right)\right)\right)} \cdot x \]
    7. Applied egg-rr18.9%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(0.0625 \cdot \left(t \cdot b\right)\right)\right)\right)} \cdot x \]
    8. Taylor expanded in t around 0 21.1%

      \[\leadsto \mathsf{expm1}\left(\color{blue}{\log 2 + -0.0009765625 \cdot \left({t}^{2} \cdot {b}^{2}\right)}\right) \cdot x \]
    9. Step-by-step derivation
      1. unpow221.1%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 2.75 \cdot 10^{-77}:\\ \;\;\;\;\left(x \cdot \cos \left(\frac{z \cdot t}{16}\right)\right) \cdot \cos \left(\frac{t \cdot b}{16}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \mathsf{expm1}\left(\log 2 + -0.0009765625 \cdot \left(\left(t \cdot t\right) \cdot \left(b \cdot b\right)\right)\right)\\ \end{array} \]

Alternative 5: 29.7% accurate, 2.1× speedup?

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

\\
x \cdot \cos \left(\left(t \cdot b\right) \cdot 0.0625\right)
\end{array}
Derivation
  1. Initial program 26.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. Step-by-step derivation
    1. associate-*l*26.9%

      \[\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. *-commutative26.9%

      \[\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. *-commutative26.9%

      \[\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/26.9%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\cos \left(0.0625 \cdot \left(t \cdot b\right)\right) \cdot x} \]
  6. Final simplification30.0%

    \[\leadsto x \cdot \cos \left(\left(t \cdot b\right) \cdot 0.0625\right) \]

Alternative 6: 30.8% accurate, 225.0× speedup?

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

\\
x
\end{array}
Derivation
  1. Initial program 26.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. Step-by-step derivation
    1. associate-*l*26.9%

      \[\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. *-commutative26.9%

      \[\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. *-commutative26.9%

      \[\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/26.9%

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

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

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

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

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

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

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

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

    \[\leadsto x \]

Developer target: 30.3% 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 2023274 
(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))))