?

Average Accuracy: 28.6% → 32.9%
Time: 31.5s
Precision: binary64
Cost: 67332

?

\[\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} \mathbf{if}\;\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{t \cdot \left(\left(1 + 2 \cdot a\right) \cdot b\right)}{16}\right) \leq 5 \cdot 10^{+300}:\\ \;\;\;\;x \cdot \left(\cos \left(\frac{z \cdot \mathsf{fma}\left(y, 2, 1\right)}{\frac{16}{t}}\right) \cdot \cos \left(\sqrt[3]{t} \cdot \left(\frac{b}{\sqrt[3]{16}} \cdot \frac{\mathsf{fma}\left(2, a, 1\right)}{{\left(\sqrt[3]{\frac{16}{t}}\right)}^{2}}\right)\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
 (if (<=
      (*
       (* x (cos (/ (* (* (+ (* y 2.0) 1.0) z) t) 16.0)))
       (cos (/ (* t (* (+ 1.0 (* 2.0 a)) b)) 16.0)))
      5e+300)
   (*
    x
    (*
     (cos (/ (* z (fma y 2.0 1.0)) (/ 16.0 t)))
     (cos
      (*
       (cbrt t)
       (*
        (/ b (cbrt 16.0))
        (/ (fma 2.0 a 1.0) (pow (cbrt (/ 16.0 t)) 2.0)))))))
   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 tmp;
	if (((x * cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * cos(((t * ((1.0 + (2.0 * a)) * b)) / 16.0))) <= 5e+300) {
		tmp = x * (cos(((z * fma(y, 2.0, 1.0)) / (16.0 / t))) * cos((cbrt(t) * ((b / cbrt(16.0)) * (fma(2.0, a, 1.0) / pow(cbrt((16.0 / t)), 2.0))))));
	} 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)
	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))) <= 5e+300)
		tmp = Float64(x * Float64(cos(Float64(Float64(z * fma(y, 2.0, 1.0)) / Float64(16.0 / t))) * cos(Float64(cbrt(t) * Float64(Float64(b / cbrt(16.0)) * Float64(fma(2.0, a, 1.0) / (cbrt(Float64(16.0 / t)) ^ 2.0)))))));
	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_] := 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], 5e+300], N[(x * N[(N[Cos[N[(N[(z * N[(y * 2.0 + 1.0), $MachinePrecision]), $MachinePrecision] / N[(16.0 / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[Power[t, 1/3], $MachinePrecision] * N[(N[(b / N[Power[16.0, 1/3], $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * a + 1.0), $MachinePrecision] / N[Power[N[Power[N[(16.0 / t), $MachinePrecision], 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $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}
\mathbf{if}\;\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{t \cdot \left(\left(1 + 2 \cdot a\right) \cdot b\right)}{16}\right) \leq 5 \cdot 10^{+300}:\\
\;\;\;\;x \cdot \left(\cos \left(\frac{z \cdot \mathsf{fma}\left(y, 2, 1\right)}{\frac{16}{t}}\right) \cdot \cos \left(\sqrt[3]{t} \cdot \left(\frac{b}{\sqrt[3]{16}} \cdot \frac{\mathsf{fma}\left(2, a, 1\right)}{{\left(\sqrt[3]{\frac{16}{t}}\right)}^{2}}\right)\right)\right)\\

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


\end{array}

Error?

Target

Original28.6%
Target31.3%
Herbie32.9%
\[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))) < 5.00000000000000026e300

    1. Initial program 48.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. Simplified48.2%

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

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

      associate-*l* [=>]48.2

      \[ \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* [=>]48.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) \]

      fma-def [=>]48.1

      \[ x \cdot \left(\cos \left(\frac{\color{blue}{\mathsf{fma}\left(y, 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-/l* [=>]48.2

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

      fma-def [=>]48.2

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

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

      [Start]48.2

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

      add-cube-cbrt [=>]48.1

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

      associate-/r* [=>]48.1

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

      cbrt-div [=>]48.2

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

      associate-/r/ [=>]48.3

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

      pow2 [=>]48.3

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

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

      [Start]48.3

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

      *-commutative [=>]48.3

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

      associate-/l/ [=>]48.3

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

      *-commutative [=>]48.3

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

      times-frac [=>]48.0

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

      fma-udef [=>]48.0

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

      *-commutative [<=]48.0

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

      fma-def [=>]48.0

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

    if 5.00000000000000026e300 < (*.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.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. Simplified2.6%

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

      associate-*l* [=>]0.4

      \[ \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 z around 0 6.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{t \cdot \left(\left(1 + 2 \cdot a\right) \cdot b\right)}{16}\right) \leq 5 \cdot 10^{+300}:\\ \;\;\;\;x \cdot \left(\cos \left(\frac{z \cdot \mathsf{fma}\left(y, 2, 1\right)}{\frac{16}{t}}\right) \cdot \cos \left(\sqrt[3]{t} \cdot \left(\frac{b}{\sqrt[3]{16}} \cdot \frac{\mathsf{fma}\left(2, a, 1\right)}{{\left(\sqrt[3]{\frac{16}{t}}\right)}^{2}}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternatives

Alternative 1
Accuracy33.0%
Cost41412
\[\begin{array}{l} \mathbf{if}\;\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{t \cdot \left(\left(1 + 2 \cdot a\right) \cdot b\right)}{16}\right) \leq 5 \cdot 10^{+300}:\\ \;\;\;\;x \cdot \left(\cos \left(\frac{z \cdot \mathsf{fma}\left(y, 2, 1\right)}{\frac{16}{t}}\right) \cdot \cos \left(\mathsf{fma}\left(a, 2, 1\right) \cdot \frac{b}{\frac{16}{t}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 2
Accuracy33.0%
Cost41412
\[\begin{array}{l} \mathbf{if}\;\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{t \cdot \left(\left(1 + 2 \cdot a\right) \cdot b\right)}{16}\right) \leq 5 \cdot 10^{+300}:\\ \;\;\;\;x \cdot \left(\cos \left(\frac{z \cdot \mathsf{fma}\left(y, 2, 1\right)}{\frac{16}{t}}\right) \cdot \cos \left(\frac{b \cdot \mathsf{fma}\left(a, 2, 1\right)}{\frac{16}{t}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Accuracy33.1%
Cost28868
\[\begin{array}{l} t_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{t \cdot \left(\left(1 + 2 \cdot a\right) \cdot b\right)}{16}\right)\\ \mathbf{if}\;t_1 \leq 5 \cdot 10^{+300}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Accuracy31.6%
Cost64
\[x \]

Error

Reproduce?

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