\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 2390462.7457392686:\\
\;\;\;\;\left(x \cdot \left(\cos \left(\left(z \cdot t\right) \cdot 0.0625\right) \cdot \cos \left(\left(z \cdot t\right) \cdot \frac{y}{8}\right) - \sin \left(\left(z \cdot t\right) \cdot 0.0625\right) \cdot \sin \left(\left(z \cdot t\right) \cdot \frac{y}{8}\right)\right)\right) \cdot \cos \left(\left(t \cdot b\right) \cdot \left(0.0625 + \frac{a}{8}\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)))
2390462.7457392686)
(*
(*
x
(-
(* (cos (* (* z t) 0.0625)) (cos (* (* z t) (/ y 8.0))))
(* (sin (* (* z t) 0.0625)) (sin (* (* z t) (/ y 8.0))))))
(cos (* (* t b) (+ 0.0625 (/ a 8.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)) <= 2390462.7457392686) {
tmp = (x * ((cos((z * t) * 0.0625) * cos((z * t) * (y / 8.0))) - (sin((z * t) * 0.0625) * sin((z * t) * (y / 8.0))))) * cos((t * b) * (0.0625 + (a / 8.0)));
} else {
tmp = x;
}
return tmp;
}




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.4 |
|---|---|
| Target | 44.7 |
| Herbie | 43.7 |
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))) < 2390462.7457392686Initial program 33.7
Simplified33.7
rmApplied distribute-lft-in_binary6433.7
Applied cos-sum_binary6433.6
if 2390462.7457392686 < (*.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))) Initial program 56.4
Simplified55.4
Taylor expanded around 0 53.8
Taylor expanded around 0 51.6
Final simplification43.7
herbie shell --seed 2020219
(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))))