Average Error: 46.5 → 45.1
Time: 11.5s
Precision: binary64
\[\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) \]
\[\log \left(e^{\cos \left(0.0625 \cdot \left(t \cdot z\right)\right)}\right) \cdot 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)
\log \left(e^{\cos \left(0.0625 \cdot \left(t \cdot z\right)\right)}\right) \cdot 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
 (* (log (exp (cos (* 0.0625 (* t z))))) 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 log(exp(cos(0.0625 * (t * z)))) * x;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original46.5
Target44.7
Herbie45.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.5

    \[\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. Simplified45.9

    \[\leadsto \color{blue}{\left(x \cdot \cos \left(\left(z \cdot t\right) \cdot \mathsf{fma}\left(y, 0.125, 0.0625\right)\right)\right) \cdot \cos \left(\left(t \cdot b\right) \cdot \mathsf{fma}\left(a, 0.125, 0.0625\right)\right)} \]
  3. Taylor expanded in t around 0 45.4

    \[\leadsto \left(x \cdot \cos \left(\left(z \cdot t\right) \cdot \mathsf{fma}\left(y, 0.125, 0.0625\right)\right)\right) \cdot \color{blue}{1} \]
  4. Taylor expanded in y around 0 45.0

    \[\leadsto \color{blue}{\left(\cos \left(0.0625 \cdot \left(t \cdot z\right)\right) \cdot x\right)} \cdot 1 \]
  5. Applied add-log-exp_binary6445.1

    \[\leadsto \left(\color{blue}{\log \left(e^{\cos \left(0.0625 \cdot \left(t \cdot z\right)\right)}\right)} \cdot x\right) \cdot 1 \]
  6. Final simplification45.1

    \[\leadsto \log \left(e^{\cos \left(0.0625 \cdot \left(t \cdot z\right)\right)}\right) \cdot x \]

Reproduce

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