\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{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \le 6.4513146009910377 \cdot 10^{296}:\\
\;\;\;\;\left(x \cdot \cos \left(\frac{\left(y \cdot 2 + 1\right) \cdot \left(z \cdot t\right)}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \cos \left(\frac{0}{16}\right)\right) \cdot \cos \left(\frac{0}{16}\right)\\
\end{array}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 VAR;
if ((((x * cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * cos((((((a * 2.0) + 1.0) * b) * t) / 16.0))) <= 6.451314600991038e+296)) {
VAR = ((x * cos(((((y * 2.0) + 1.0) * (z * t)) / 16.0))) * cos((((((a * 2.0) + 1.0) * b) * t) / 16.0)));
} else {
VAR = ((x * cos((0.0 / 16.0))) * cos((0.0 / 16.0)));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a




Bits error versus b
Results
| Original | 46.0 |
|---|---|
| Target | 44.3 |
| Herbie | 43.2 |
if (* (* x (cos (/ (* (* (+ (* y 2.0) 1.0) z) t) 16.0))) (cos (/ (* (* (+ (* a 2.0) 1.0) b) t) 16.0))) < 6.451314600991038e+296Initial program 33.5
rmApplied associate-*l*33.4
if 6.451314600991038e+296 < (* (* x (cos (/ (* (* (+ (* y 2.0) 1.0) z) t) 16.0))) (cos (/ (* (* (+ (* a 2.0) 1.0) b) t) 16.0))) Initial program 63.7
Taylor expanded around 0 60.8
Taylor expanded around 0 56.8
Final simplification43.2
herbie shell --seed 2020078 +o rules:numerics
(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) (/ t (+ (- 1 (* a 2)) (pow (* a 2) 2))))))
(* (* x (cos (/ (* (* (+ (* y 2) 1) z) t) 16))) (cos (/ (* (* (+ (* a 2) 1) b) t) 16))))