?

Average Error: 46.3 → 44.1
Time: 20.0s
Precision: binary64
Cost: 64

?

\[\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) \]
\[x \]
(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 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) {
	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 * cos((((((y * 2.0d0) + 1.0d0) * z) * t) / 16.0d0))) * cos((((((a * 2.0d0) + 1.0d0) * b) * t) / 16.0d0))
end function
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 * Math.cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * Math.cos((((((a * 2.0) + 1.0) * b) * t) / 16.0));
}
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 * 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
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)
	return x
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
function tmp = code(x, y, z, t, a, b)
	tmp = x;
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_] := 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)
x

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original46.3
Target44.4
Herbie44.1
\[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. Initial program 46.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. Simplified46.3

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

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

    rational.json-simplify-49 [=>]46.3

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

    trig.json-simplify-24 [=>]46.3

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

    trig.json-simplify-24 [=>]46.3

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

    rational.json-simplify-10 [=>]46.3

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

    rational.json-simplify-10 [=>]46.3

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

    rational.json-simplify-49 [=>]46.3

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

    rational.json-simplify-2 [=>]46.3

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

    rational.json-simplify-49 [=>]46.3

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

    rational.json-simplify-2 [=>]46.3

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

    rational.json-simplify-49 [=>]46.3

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

    rational.json-simplify-47 [=>]46.3

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

    metadata-eval [=>]46.3

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

    rational.json-simplify-7 [=>]46.3

    \[ \left(x \cdot \cos \left(t \cdot \frac{\left(y \cdot 2 + 1\right) \cdot z}{16}\right)\right) \cdot \cos \left(t \cdot \color{blue}{\frac{\left(a \cdot 2 + 1\right) \cdot b}{16}}\right) \]
  3. Taylor expanded in a around 0 45.8

    \[\leadsto \left(x \cdot \cos \left(t \cdot \frac{\left(y \cdot 2 + 1\right) \cdot z}{16}\right)\right) \cdot \color{blue}{\cos \left(0.0625 \cdot \left(t \cdot b\right)\right)} \]
  4. Simplified45.8

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

    [Start]45.8

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

    rational.json-simplify-43 [=>]45.8

    \[ \left(x \cdot \cos \left(t \cdot \frac{\left(y \cdot 2 + 1\right) \cdot z}{16}\right)\right) \cdot \cos \color{blue}{\left(t \cdot \left(b \cdot 0.0625\right)\right)} \]
  5. Taylor expanded in t around 0 44.8

    \[\leadsto \color{blue}{x} \cdot \cos \left(t \cdot \left(b \cdot 0.0625\right)\right) \]
  6. Taylor expanded in t around 0 44.1

    \[\leadsto \color{blue}{x} \]
  7. Final simplification44.1

    \[\leadsto x \]

Reproduce?

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