\left(2 \cdot \sqrt{x}\right) \cdot \cos \left(y - \frac{z \cdot t}{3}\right) - \frac{a}{b \cdot 3}
\begin{array}{l}
t_1 := y - \frac{z \cdot t}{3}\\
t_2 := 2 \cdot \sqrt{x}\\
\mathbf{if}\;t_1 \leq -1.8581223082965668 \cdot 10^{+210} \lor \neg \left(t_1 \leq 5.013021847941442 \cdot 10^{+281}\right):\\
\;\;\;\;\mathsf{fma}\left(a, \frac{\frac{1}{b}}{-3}, t_2 \cdot \cos y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{-0.3333333333333333}{b}, t_2 \cdot \left(\cos y \cdot \cos \left(\left(z \cdot t\right) \cdot 0.3333333333333333\right) - \sin y \cdot \sin \left(z \cdot \left(t \cdot -0.3333333333333333\right)\right)\right)\right)\\
\end{array}
(FPCore (x y z t a b) :precision binary64 (- (* (* 2.0 (sqrt x)) (cos (- y (/ (* z t) 3.0)))) (/ a (* b 3.0))))
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- y (/ (* z t) 3.0))) (t_2 (* 2.0 (sqrt x))))
(if (or (<= t_1 -1.8581223082965668e+210)
(not (<= t_1 5.013021847941442e+281)))
(fma a (/ (/ 1.0 b) -3.0) (* t_2 (cos y)))
(fma
a
(/ -0.3333333333333333 b)
(*
t_2
(-
(* (cos y) (cos (* (* z t) 0.3333333333333333)))
(* (sin y) (sin (* z (* t -0.3333333333333333))))))))))double code(double x, double y, double z, double t, double a, double b) {
return ((2.0 * sqrt(x)) * cos((y - ((z * t) / 3.0)))) - (a / (b * 3.0));
}
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y - ((z * t) / 3.0);
double t_2 = 2.0 * sqrt(x);
double tmp;
if ((t_1 <= -1.8581223082965668e+210) || !(t_1 <= 5.013021847941442e+281)) {
tmp = fma(a, ((1.0 / b) / -3.0), (t_2 * cos(y)));
} else {
tmp = fma(a, (-0.3333333333333333 / b), (t_2 * ((cos(y) * cos(((z * t) * 0.3333333333333333))) - (sin(y) * sin((z * (t * -0.3333333333333333)))))));
}
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
| Original | 20.5 |
|---|---|
| Target | 18.4 |
| Herbie | 16.3 |
if (-.f64 y (/.f64 (*.f64 z t) 3)) < -1.85812230829656681e210 or 5.0130218479414421e281 < (-.f64 y (/.f64 (*.f64 z t) 3)) Initial program 42.1
Simplified42.0
Taylor expanded in z around 0 27.2
Applied clear-num_binary6427.2
Applied div-inv_binary6427.2
Applied associate-/r*_binary6427.2
if -1.85812230829656681e210 < (-.f64 y (/.f64 (*.f64 z t) 3)) < 5.0130218479414421e281Initial program 12.9
Simplified12.9
Applied fma-udef_binary6413.0
Applied cos-sum_binary6412.5
Simplified12.5
Simplified12.5
Final simplification16.3
herbie shell --seed 2022160
(FPCore (x y z t a b)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, K"
:precision binary64
:herbie-target
(if (< z -1.3793337487235141e+129) (- (* (* 2.0 (sqrt x)) (cos (- (/ 1.0 y) (/ (/ 0.3333333333333333 z) t)))) (/ (/ a 3.0) b)) (if (< z 3.516290613555987e+106) (- (* (* (sqrt x) 2.0) (cos (- y (* (/ t 3.0) z)))) (/ (/ a 3.0) b)) (- (* (cos (- y (/ (/ 0.3333333333333333 z) t))) (* 2.0 (sqrt x))) (/ (/ a b) 3.0))))
(- (* (* 2.0 (sqrt x)) (cos (- y (/ (* z t) 3.0)))) (/ a (* b 3.0))))