?

Average Accuracy: 26.8% → 31.2%
Time: 27.1s
Precision: binary64
Cost: 67460

?

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

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


\end{array}

Error?

Target

Original26.8%
Target29.7%
Herbie31.2%
\[x \cdot \cos \left(\frac{b}{16} \cdot \frac{t}{\left(1 - a \cdot 2\right) + {\left(a \cdot 2\right)}^{2}}\right) \]

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.00000000000000007e294

    1. Initial program 46.1%

      \[\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. Simplified46.0%

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

      [Start]46.1

      \[ \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) \]

      associate-*l* [=>]46.1

      \[ \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)} \]

      associate-/l* [=>]46.1

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

      associate-*r/ [<=]46.1

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

      associate-/r/ [=>]46.0

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

      fma-def [=>]46.0

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

      associate-*r/ [<=]46.0

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

      *-commutative [=>]46.0

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

      fma-def [=>]46.0

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

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

    if 1.00000000000000007e294 < (*.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 0.6%

      \[\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. Simplified2.7%

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

      [Start]0.6

      \[ \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) \]

      associate-*l* [=>]0.6

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

      \[\leadsto x \cdot \left(\color{blue}{\cos \left(0.0625 \cdot \left(t \cdot z\right)\right)} \cdot \cos \left(\left(t \cdot b\right) \cdot \left(\frac{a}{8} + 0.0625\right)\right)\right) \]
    4. Simplified4.3%

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

      [Start]4.3

      \[ x \cdot \left(\cos \left(0.0625 \cdot \left(t \cdot z\right)\right) \cdot \cos \left(\left(t \cdot b\right) \cdot \left(\frac{a}{8} + 0.0625\right)\right)\right) \]

      associate-*r* [=>]4.3

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

      *-commutative [<=]4.3

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

      associate-*l* [=>]4.3

      \[ x \cdot \left(\cos \color{blue}{\left(t \cdot \left(0.0625 \cdot z\right)\right)} \cdot \cos \left(\left(t \cdot b\right) \cdot \left(\frac{a}{8} + 0.0625\right)\right)\right) \]
    5. Taylor expanded in t around 0 11.1%

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

Alternatives

Alternative 1
Accuracy31.3%
Cost48964
\[\begin{array}{l} t_1 := 0.0625 \cdot \left(t \cdot b\right)\\ t_2 := t \cdot \left(b \cdot \left(a \cdot 0.125\right)\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 \cos \left(\frac{t \cdot \left(\left(1 + 2 \cdot a\right) \cdot b\right)}{16}\right) \leq 10^{+294}:\\ \;\;\;\;x \cdot \left(\cos \left(\left(z \cdot t\right) \cdot \left(0.0625 + \frac{y}{8}\right)\right) \cdot \left(\cos t_2 \cdot \cos t_1 - \sin t_2 \cdot \sin t_1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 2
Accuracy30.9%
Cost47492
\[\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^{+294}:\\ \;\;\;\;x \cdot \left(\cos \left(t \cdot \left(z \cdot 0.0625\right)\right) \cdot \cos \left({\left(\sqrt[3]{t \cdot \left(b \cdot \mathsf{fma}\left(a, 0.125, 0.0625\right)\right)}\right)}^{3}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Accuracy31.0%
Cost28356
\[\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^{+294}:\\ \;\;\;\;\cos \left(\left(z \cdot t\right) \cdot 0.0625\right) \cdot \left(x \cdot \cos \left(t \cdot \left(b \cdot \left(0.0625 + a \cdot 0.125\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Accuracy28.4%
Cost13888
\[x \cdot \left(\left(1 + \cos \left(t \cdot \left(z \cdot 0.0625\right)\right) \cdot \cos \left(t \cdot \left(b \cdot 0.0625\right)\right)\right) + -1\right) \]
Alternative 5
Accuracy28.5%
Cost13632
\[x \cdot \left(\cos \left(t \cdot \left(z \cdot 0.0625\right)\right) \cdot \cos \left(t \cdot \left(b \cdot 0.0625\right)\right)\right) \]
Alternative 6
Accuracy29.2%
Cost6848
\[x \cdot \cos \left(t \cdot \left(z \cdot 0.0625\right)\right) \]
Alternative 7
Accuracy30.0%
Cost64
\[x \]

Error

Reproduce?

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