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

Percentage Accurate: 27.6% → 31.1%
Time: 31.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.6% 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.1% accurate, 0.2× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ t_m = \left|t\right| \\ \begin{array}{l} t_1 := \log \left(\frac{16}{t_m}\right)\\ x \cdot \cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\frac{{t_1}^{3} - {\log z_m}^{3}}{t_1 \cdot t_1 + \left(\log z_m \cdot \log z_m + t_1 \cdot \log z_m\right)}\right|}}\right) \end{array} \end{array} \]
z_m = (fabs.f64 z)
t_m = (fabs.f64 t)
(FPCore (x y z_m t_m a b)
 :precision binary64
 (let* ((t_1 (log (/ 16.0 t_m))))
   (*
    x
    (cos
     (/
      (fma y 2.0 1.0)
      (exp
       (fabs
        (/
         (- (pow t_1 3.0) (pow (log z_m) 3.0))
         (+ (* t_1 t_1) (+ (* (log z_m) (log z_m)) (* t_1 (log z_m))))))))))))
z_m = fabs(z);
t_m = fabs(t);
double code(double x, double y, double z_m, double t_m, double a, double b) {
	double t_1 = log((16.0 / t_m));
	return x * cos((fma(y, 2.0, 1.0) / exp(fabs(((pow(t_1, 3.0) - pow(log(z_m), 3.0)) / ((t_1 * t_1) + ((log(z_m) * log(z_m)) + (t_1 * log(z_m)))))))));
}
z_m = abs(z)
t_m = abs(t)
function code(x, y, z_m, t_m, a, b)
	t_1 = log(Float64(16.0 / t_m))
	return Float64(x * cos(Float64(fma(y, 2.0, 1.0) / exp(abs(Float64(Float64((t_1 ^ 3.0) - (log(z_m) ^ 3.0)) / Float64(Float64(t_1 * t_1) + Float64(Float64(log(z_m) * log(z_m)) + Float64(t_1 * log(z_m))))))))))
end
z_m = N[Abs[z], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z$95$m_, t$95$m_, a_, b_] := Block[{t$95$1 = N[Log[N[(16.0 / t$95$m), $MachinePrecision]], $MachinePrecision]}, N[(x * N[Cos[N[(N[(y * 2.0 + 1.0), $MachinePrecision] / N[Exp[N[Abs[N[(N[(N[Power[t$95$1, 3.0], $MachinePrecision] - N[Power[N[Log[z$95$m], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] / N[(N[(t$95$1 * t$95$1), $MachinePrecision] + N[(N[(N[Log[z$95$m], $MachinePrecision] * N[Log[z$95$m], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * N[Log[z$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
t_m = \left|t\right|

\\
\begin{array}{l}
t_1 := \log \left(\frac{16}{t_m}\right)\\
x \cdot \cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\frac{{t_1}^{3} - {\log z_m}^{3}}{t_1 \cdot t_1 + \left(\log z_m \cdot \log z_m + t_1 \cdot \log z_m\right)}\right|}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 22.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. Simplified23.9%

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

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{\frac{\frac{16}{t}}{z}}\right) \cdot \color{blue}{1}\right) \]
  5. Step-by-step derivation
    1. associate-/l/24.6%

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

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{\color{blue}{e^{\log \left(\frac{16}{z \cdot t}\right)}}}\right) \cdot 1\right) \]
    3. *-commutative11.4%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\log \left(\frac{16}{\color{blue}{t \cdot z}}\right)}}\right) \cdot 1\right) \]
  6. Applied egg-rr11.4%

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{\color{blue}{e^{\log \left(\frac{16}{t \cdot z}\right)}}}\right) \cdot 1\right) \]
  7. Step-by-step derivation
    1. rem-exp-log11.4%

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

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

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\color{blue}{\sqrt{\log \left(e^{\log \left(\frac{16}{t \cdot z}\right)}\right) \cdot \log \left(e^{\log \left(\frac{16}{t \cdot z}\right)}\right)}}}}\right) \cdot 1\right) \]
    4. pow213.5%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\sqrt{\color{blue}{{\log \left(e^{\log \left(\frac{16}{t \cdot z}\right)}\right)}^{2}}}}}\right) \cdot 1\right) \]
    5. rem-exp-log13.5%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\sqrt{{\log \color{blue}{\left(\frac{16}{t \cdot z}\right)}}^{2}}}}\right) \cdot 1\right) \]
    6. associate-/r*13.4%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\sqrt{{\log \color{blue}{\left(\frac{\frac{16}{t}}{z}\right)}}^{2}}}}\right) \cdot 1\right) \]
  8. Applied egg-rr13.4%

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\color{blue}{\sqrt{{\log \left(\frac{\frac{16}{t}}{z}\right)}^{2}}}}}\right) \cdot 1\right) \]
  9. Step-by-step derivation
    1. unpow213.4%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\sqrt{\color{blue}{\log \left(\frac{\frac{16}{t}}{z}\right) \cdot \log \left(\frac{\frac{16}{t}}{z}\right)}}}}\right) \cdot 1\right) \]
    2. rem-sqrt-square13.4%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\color{blue}{\left|\log \left(\frac{\frac{16}{t}}{z}\right)\right|}}}\right) \cdot 1\right) \]
  10. Simplified13.4%

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\color{blue}{\left|\log \left(\frac{\frac{16}{t}}{z}\right)\right|}}}\right) \cdot 1\right) \]
  11. Step-by-step derivation
    1. log-div6.7%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\color{blue}{\log \left(\frac{16}{t}\right) - \log z}\right|}}\right) \cdot 1\right) \]
    2. flip3--6.9%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\color{blue}{\frac{{\log \left(\frac{16}{t}\right)}^{3} - {\log z}^{3}}{\log \left(\frac{16}{t}\right) \cdot \log \left(\frac{16}{t}\right) + \left(\log z \cdot \log z + \log \left(\frac{16}{t}\right) \cdot \log z\right)}}\right|}}\right) \cdot 1\right) \]
  12. Applied egg-rr6.9%

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\color{blue}{\frac{{\log \left(\frac{16}{t}\right)}^{3} - {\log z}^{3}}{\log \left(\frac{16}{t}\right) \cdot \log \left(\frac{16}{t}\right) + \left(\log z \cdot \log z + \log \left(\frac{16}{t}\right) \cdot \log z\right)}}\right|}}\right) \cdot 1\right) \]
  13. Final simplification6.9%

    \[\leadsto x \cdot \cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\frac{{\log \left(\frac{16}{t}\right)}^{3} - {\log z}^{3}}{\log \left(\frac{16}{t}\right) \cdot \log \left(\frac{16}{t}\right) + \left(\log z \cdot \log z + \log \left(\frac{16}{t}\right) \cdot \log z\right)}\right|}}\right) \]
  14. Add Preprocessing

Alternative 2: 31.0% accurate, 0.3× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ t_m = \left|t\right| \\ x \cdot \cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\sqrt[3]{{\log \left(\frac{16}{t_m \cdot z_m}\right)}^{3}}\right|}}\right) \end{array} \]
z_m = (fabs.f64 z)
t_m = (fabs.f64 t)
(FPCore (x y z_m t_m a b)
 :precision binary64
 (*
  x
  (cos
   (/
    (fma y 2.0 1.0)
    (exp (fabs (cbrt (pow (log (/ 16.0 (* t_m z_m))) 3.0))))))))
z_m = fabs(z);
t_m = fabs(t);
double code(double x, double y, double z_m, double t_m, double a, double b) {
	return x * cos((fma(y, 2.0, 1.0) / exp(fabs(cbrt(pow(log((16.0 / (t_m * z_m))), 3.0))))));
}
z_m = abs(z)
t_m = abs(t)
function code(x, y, z_m, t_m, a, b)
	return Float64(x * cos(Float64(fma(y, 2.0, 1.0) / exp(abs(cbrt((log(Float64(16.0 / Float64(t_m * z_m))) ^ 3.0)))))))
end
z_m = N[Abs[z], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z$95$m_, t$95$m_, a_, b_] := N[(x * N[Cos[N[(N[(y * 2.0 + 1.0), $MachinePrecision] / N[Exp[N[Abs[N[Power[N[Power[N[Log[N[(16.0 / N[(t$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 3.0], $MachinePrecision], 1/3], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
t_m = \left|t\right|

\\
x \cdot \cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\sqrt[3]{{\log \left(\frac{16}{t_m \cdot z_m}\right)}^{3}}\right|}}\right)
\end{array}
Derivation
  1. Initial program 22.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. Simplified23.9%

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

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{\frac{\frac{16}{t}}{z}}\right) \cdot \color{blue}{1}\right) \]
  5. Step-by-step derivation
    1. associate-/l/24.6%

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

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{\color{blue}{e^{\log \left(\frac{16}{z \cdot t}\right)}}}\right) \cdot 1\right) \]
    3. *-commutative11.4%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\log \left(\frac{16}{\color{blue}{t \cdot z}}\right)}}\right) \cdot 1\right) \]
  6. Applied egg-rr11.4%

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{\color{blue}{e^{\log \left(\frac{16}{t \cdot z}\right)}}}\right) \cdot 1\right) \]
  7. Step-by-step derivation
    1. rem-exp-log11.4%

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

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

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\color{blue}{\sqrt{\log \left(e^{\log \left(\frac{16}{t \cdot z}\right)}\right) \cdot \log \left(e^{\log \left(\frac{16}{t \cdot z}\right)}\right)}}}}\right) \cdot 1\right) \]
    4. pow213.5%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\sqrt{\color{blue}{{\log \left(e^{\log \left(\frac{16}{t \cdot z}\right)}\right)}^{2}}}}}\right) \cdot 1\right) \]
    5. rem-exp-log13.5%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\sqrt{{\log \color{blue}{\left(\frac{16}{t \cdot z}\right)}}^{2}}}}\right) \cdot 1\right) \]
    6. associate-/r*13.4%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\sqrt{{\log \color{blue}{\left(\frac{\frac{16}{t}}{z}\right)}}^{2}}}}\right) \cdot 1\right) \]
  8. Applied egg-rr13.4%

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\color{blue}{\sqrt{{\log \left(\frac{\frac{16}{t}}{z}\right)}^{2}}}}}\right) \cdot 1\right) \]
  9. Step-by-step derivation
    1. unpow213.4%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\sqrt{\color{blue}{\log \left(\frac{\frac{16}{t}}{z}\right) \cdot \log \left(\frac{\frac{16}{t}}{z}\right)}}}}\right) \cdot 1\right) \]
    2. rem-sqrt-square13.4%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\color{blue}{\left|\log \left(\frac{\frac{16}{t}}{z}\right)\right|}}}\right) \cdot 1\right) \]
  10. Simplified13.4%

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\color{blue}{\left|\log \left(\frac{\frac{16}{t}}{z}\right)\right|}}}\right) \cdot 1\right) \]
  11. Step-by-step derivation
    1. add-cbrt-cube13.3%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\color{blue}{\sqrt[3]{\left(\log \left(\frac{\frac{16}{t}}{z}\right) \cdot \log \left(\frac{\frac{16}{t}}{z}\right)\right) \cdot \log \left(\frac{\frac{16}{t}}{z}\right)}}\right|}}\right) \cdot 1\right) \]
    2. pow313.5%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\sqrt[3]{\color{blue}{{\log \left(\frac{\frac{16}{t}}{z}\right)}^{3}}}\right|}}\right) \cdot 1\right) \]
    3. associate-/l/13.5%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\sqrt[3]{{\log \color{blue}{\left(\frac{16}{z \cdot t}\right)}}^{3}}\right|}}\right) \cdot 1\right) \]
    4. *-commutative13.5%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\sqrt[3]{{\log \left(\frac{16}{\color{blue}{t \cdot z}}\right)}^{3}}\right|}}\right) \cdot 1\right) \]
  12. Applied egg-rr13.5%

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\color{blue}{\sqrt[3]{{\log \left(\frac{16}{t \cdot z}\right)}^{3}}}\right|}}\right) \cdot 1\right) \]
  13. Final simplification13.5%

    \[\leadsto x \cdot \cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\sqrt[3]{{\log \left(\frac{16}{t \cdot z}\right)}^{3}}\right|}}\right) \]
  14. Add Preprocessing

Alternative 3: 31.1% accurate, 0.4× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ t_m = \left|t\right| \\ x \cdot \cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\log \left(\frac{16}{z_m}\right) - \log t_m\right|}}\right) \end{array} \]
z_m = (fabs.f64 z)
t_m = (fabs.f64 t)
(FPCore (x y z_m t_m a b)
 :precision binary64
 (* x (cos (/ (fma y 2.0 1.0) (exp (fabs (- (log (/ 16.0 z_m)) (log t_m))))))))
z_m = fabs(z);
t_m = fabs(t);
double code(double x, double y, double z_m, double t_m, double a, double b) {
	return x * cos((fma(y, 2.0, 1.0) / exp(fabs((log((16.0 / z_m)) - log(t_m))))));
}
z_m = abs(z)
t_m = abs(t)
function code(x, y, z_m, t_m, a, b)
	return Float64(x * cos(Float64(fma(y, 2.0, 1.0) / exp(abs(Float64(log(Float64(16.0 / z_m)) - log(t_m)))))))
end
z_m = N[Abs[z], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z$95$m_, t$95$m_, a_, b_] := N[(x * N[Cos[N[(N[(y * 2.0 + 1.0), $MachinePrecision] / N[Exp[N[Abs[N[(N[Log[N[(16.0 / z$95$m), $MachinePrecision]], $MachinePrecision] - N[Log[t$95$m], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
t_m = \left|t\right|

\\
x \cdot \cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\log \left(\frac{16}{z_m}\right) - \log t_m\right|}}\right)
\end{array}
Derivation
  1. Initial program 22.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. Simplified23.9%

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

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{\frac{\frac{16}{t}}{z}}\right) \cdot \color{blue}{1}\right) \]
  5. Step-by-step derivation
    1. associate-/l/24.6%

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

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{\color{blue}{e^{\log \left(\frac{16}{z \cdot t}\right)}}}\right) \cdot 1\right) \]
    3. *-commutative11.4%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\log \left(\frac{16}{\color{blue}{t \cdot z}}\right)}}\right) \cdot 1\right) \]
  6. Applied egg-rr11.4%

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{\color{blue}{e^{\log \left(\frac{16}{t \cdot z}\right)}}}\right) \cdot 1\right) \]
  7. Step-by-step derivation
    1. rem-exp-log11.4%

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

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

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\color{blue}{\sqrt{\log \left(e^{\log \left(\frac{16}{t \cdot z}\right)}\right) \cdot \log \left(e^{\log \left(\frac{16}{t \cdot z}\right)}\right)}}}}\right) \cdot 1\right) \]
    4. pow213.5%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\sqrt{\color{blue}{{\log \left(e^{\log \left(\frac{16}{t \cdot z}\right)}\right)}^{2}}}}}\right) \cdot 1\right) \]
    5. rem-exp-log13.5%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\sqrt{{\log \color{blue}{\left(\frac{16}{t \cdot z}\right)}}^{2}}}}\right) \cdot 1\right) \]
    6. associate-/r*13.4%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\sqrt{{\log \color{blue}{\left(\frac{\frac{16}{t}}{z}\right)}}^{2}}}}\right) \cdot 1\right) \]
  8. Applied egg-rr13.4%

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\color{blue}{\sqrt{{\log \left(\frac{\frac{16}{t}}{z}\right)}^{2}}}}}\right) \cdot 1\right) \]
  9. Step-by-step derivation
    1. unpow213.4%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\sqrt{\color{blue}{\log \left(\frac{\frac{16}{t}}{z}\right) \cdot \log \left(\frac{\frac{16}{t}}{z}\right)}}}}\right) \cdot 1\right) \]
    2. rem-sqrt-square13.4%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\color{blue}{\left|\log \left(\frac{\frac{16}{t}}{z}\right)\right|}}}\right) \cdot 1\right) \]
  10. Simplified13.4%

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\color{blue}{\left|\log \left(\frac{\frac{16}{t}}{z}\right)\right|}}}\right) \cdot 1\right) \]
  11. Taylor expanded in t around 0 6.7%

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\color{blue}{\log \left(\frac{16}{z}\right) + -1 \cdot \log t}\right|}}\right) \cdot 1\right) \]
  12. Step-by-step derivation
    1. mul-1-neg6.7%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\log \left(\frac{16}{z}\right) + \color{blue}{\left(-\log t\right)}\right|}}\right) \cdot 1\right) \]
    2. unsub-neg6.7%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\color{blue}{\log \left(\frac{16}{z}\right) - \log t}\right|}}\right) \cdot 1\right) \]
  13. Simplified6.7%

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\color{blue}{\log \left(\frac{16}{z}\right) - \log t}\right|}}\right) \cdot 1\right) \]
  14. Final simplification6.7%

    \[\leadsto x \cdot \cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\log \left(\frac{16}{z}\right) - \log t\right|}}\right) \]
  15. Add Preprocessing

Alternative 4: 31.1% accurate, 0.4× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ t_m = \left|t\right| \\ x \cdot \cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\log \left(\frac{\frac{16}{t_m}}{z_m}\right)\right|}}\right) \end{array} \]
z_m = (fabs.f64 z)
t_m = (fabs.f64 t)
(FPCore (x y z_m t_m a b)
 :precision binary64
 (* x (cos (/ (fma y 2.0 1.0) (exp (fabs (log (/ (/ 16.0 t_m) z_m))))))))
z_m = fabs(z);
t_m = fabs(t);
double code(double x, double y, double z_m, double t_m, double a, double b) {
	return x * cos((fma(y, 2.0, 1.0) / exp(fabs(log(((16.0 / t_m) / z_m))))));
}
z_m = abs(z)
t_m = abs(t)
function code(x, y, z_m, t_m, a, b)
	return Float64(x * cos(Float64(fma(y, 2.0, 1.0) / exp(abs(log(Float64(Float64(16.0 / t_m) / z_m)))))))
end
z_m = N[Abs[z], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z$95$m_, t$95$m_, a_, b_] := N[(x * N[Cos[N[(N[(y * 2.0 + 1.0), $MachinePrecision] / N[Exp[N[Abs[N[Log[N[(N[(16.0 / t$95$m), $MachinePrecision] / z$95$m), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
t_m = \left|t\right|

\\
x \cdot \cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\log \left(\frac{\frac{16}{t_m}}{z_m}\right)\right|}}\right)
\end{array}
Derivation
  1. Initial program 22.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. Simplified23.9%

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

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{\frac{\frac{16}{t}}{z}}\right) \cdot \color{blue}{1}\right) \]
  5. Step-by-step derivation
    1. associate-/l/24.6%

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

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{\color{blue}{e^{\log \left(\frac{16}{z \cdot t}\right)}}}\right) \cdot 1\right) \]
    3. *-commutative11.4%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\log \left(\frac{16}{\color{blue}{t \cdot z}}\right)}}\right) \cdot 1\right) \]
  6. Applied egg-rr11.4%

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{\color{blue}{e^{\log \left(\frac{16}{t \cdot z}\right)}}}\right) \cdot 1\right) \]
  7. Step-by-step derivation
    1. rem-exp-log11.4%

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

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

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\color{blue}{\sqrt{\log \left(e^{\log \left(\frac{16}{t \cdot z}\right)}\right) \cdot \log \left(e^{\log \left(\frac{16}{t \cdot z}\right)}\right)}}}}\right) \cdot 1\right) \]
    4. pow213.5%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\sqrt{\color{blue}{{\log \left(e^{\log \left(\frac{16}{t \cdot z}\right)}\right)}^{2}}}}}\right) \cdot 1\right) \]
    5. rem-exp-log13.5%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\sqrt{{\log \color{blue}{\left(\frac{16}{t \cdot z}\right)}}^{2}}}}\right) \cdot 1\right) \]
    6. associate-/r*13.4%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\sqrt{{\log \color{blue}{\left(\frac{\frac{16}{t}}{z}\right)}}^{2}}}}\right) \cdot 1\right) \]
  8. Applied egg-rr13.4%

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\color{blue}{\sqrt{{\log \left(\frac{\frac{16}{t}}{z}\right)}^{2}}}}}\right) \cdot 1\right) \]
  9. Step-by-step derivation
    1. unpow213.4%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\sqrt{\color{blue}{\log \left(\frac{\frac{16}{t}}{z}\right) \cdot \log \left(\frac{\frac{16}{t}}{z}\right)}}}}\right) \cdot 1\right) \]
    2. rem-sqrt-square13.4%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\color{blue}{\left|\log \left(\frac{\frac{16}{t}}{z}\right)\right|}}}\right) \cdot 1\right) \]
  10. Simplified13.4%

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\color{blue}{\left|\log \left(\frac{\frac{16}{t}}{z}\right)\right|}}}\right) \cdot 1\right) \]
  11. Final simplification13.4%

    \[\leadsto x \cdot \cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\left|\log \left(\frac{\frac{16}{t}}{z}\right)\right|}}\right) \]
  12. Add Preprocessing

Alternative 5: 31.0% accurate, 0.5× speedup?

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

\\
x \cdot \cos \left(\frac{y \cdot 2}{e^{\left|\log \left(\frac{16}{t_m \cdot z_m}\right)\right|}}\right)
\end{array}
Derivation
  1. Initial program 22.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. Simplified23.9%

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

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{\frac{\frac{16}{t}}{z}}\right) \cdot \color{blue}{1}\right) \]
  5. Step-by-step derivation
    1. associate-/l/24.6%

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

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{\color{blue}{e^{\log \left(\frac{16}{z \cdot t}\right)}}}\right) \cdot 1\right) \]
    3. *-commutative11.4%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\log \left(\frac{16}{\color{blue}{t \cdot z}}\right)}}\right) \cdot 1\right) \]
  6. Applied egg-rr11.4%

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{\color{blue}{e^{\log \left(\frac{16}{t \cdot z}\right)}}}\right) \cdot 1\right) \]
  7. Step-by-step derivation
    1. rem-exp-log11.4%

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

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

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\color{blue}{\sqrt{\log \left(e^{\log \left(\frac{16}{t \cdot z}\right)}\right) \cdot \log \left(e^{\log \left(\frac{16}{t \cdot z}\right)}\right)}}}}\right) \cdot 1\right) \]
    4. pow213.5%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\sqrt{\color{blue}{{\log \left(e^{\log \left(\frac{16}{t \cdot z}\right)}\right)}^{2}}}}}\right) \cdot 1\right) \]
    5. rem-exp-log13.5%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\sqrt{{\log \color{blue}{\left(\frac{16}{t \cdot z}\right)}}^{2}}}}\right) \cdot 1\right) \]
    6. associate-/r*13.4%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\sqrt{{\log \color{blue}{\left(\frac{\frac{16}{t}}{z}\right)}}^{2}}}}\right) \cdot 1\right) \]
  8. Applied egg-rr13.4%

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\color{blue}{\sqrt{{\log \left(\frac{\frac{16}{t}}{z}\right)}^{2}}}}}\right) \cdot 1\right) \]
  9. Step-by-step derivation
    1. unpow213.4%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\sqrt{\color{blue}{\log \left(\frac{\frac{16}{t}}{z}\right) \cdot \log \left(\frac{\frac{16}{t}}{z}\right)}}}}\right) \cdot 1\right) \]
    2. rem-sqrt-square13.4%

      \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\color{blue}{\left|\log \left(\frac{\frac{16}{t}}{z}\right)\right|}}}\right) \cdot 1\right) \]
  10. Simplified13.4%

    \[\leadsto x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{e^{\color{blue}{\left|\log \left(\frac{\frac{16}{t}}{z}\right)\right|}}}\right) \cdot 1\right) \]
  11. Taylor expanded in y around inf 13.4%

    \[\leadsto x \cdot \left(\cos \color{blue}{\left(2 \cdot \frac{y}{e^{\left|\log \left(\frac{16}{t \cdot z}\right)\right|}}\right)} \cdot 1\right) \]
  12. Step-by-step derivation
    1. associate-*r/13.4%

      \[\leadsto x \cdot \left(\cos \color{blue}{\left(\frac{2 \cdot y}{e^{\left|\log \left(\frac{16}{t \cdot z}\right)\right|}}\right)} \cdot 1\right) \]
    2. *-commutative13.4%

      \[\leadsto x \cdot \left(\cos \left(\frac{\color{blue}{y \cdot 2}}{e^{\left|\log \left(\frac{16}{t \cdot z}\right)\right|}}\right) \cdot 1\right) \]
    3. *-commutative13.4%

      \[\leadsto x \cdot \left(\cos \left(\frac{y \cdot 2}{e^{\left|\log \left(\frac{16}{\color{blue}{z \cdot t}}\right)\right|}}\right) \cdot 1\right) \]
  13. Simplified13.4%

    \[\leadsto x \cdot \left(\cos \color{blue}{\left(\frac{y \cdot 2}{e^{\left|\log \left(\frac{16}{z \cdot t}\right)\right|}}\right)} \cdot 1\right) \]
  14. Final simplification13.4%

    \[\leadsto x \cdot \cos \left(\frac{y \cdot 2}{e^{\left|\log \left(\frac{16}{t \cdot z}\right)\right|}}\right) \]
  15. Add Preprocessing

Alternative 6: 30.6% accurate, 225.0× speedup?

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

\\
x
\end{array}
Derivation
  1. Initial program 22.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. Simplified23.9%

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

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

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

    \[\leadsto x \]
  7. Add Preprocessing

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 2024021 
(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))))