\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 := 2 \cdot \sqrt{x}\\
t_2 := \frac{a}{3 \cdot b}\\
\mathbf{if}\;\begin{array}{l}
t_3 := y - \frac{z \cdot t}{3}\\
t_3 \leq -1.5911678706912745 \cdot 10^{+252} \lor \neg \left(t_3 \leq 8.139337473696087 \cdot 10^{+243}\right)
\end{array}:\\
\;\;\;\;t_1 \cdot \cos y - t_2\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(\cos y \cdot \cos \left(\sqrt{\sqrt[3]{0.3333333333333333} \cdot \sqrt[3]{0.3333333333333333}} \cdot \left(\left(\left(z \cdot t\right) \cdot \sqrt{0.3333333333333333}\right) \cdot \sqrt{\sqrt[3]{0.3333333333333333}}\right)\right) - \sin \left(z \cdot \left(t \cdot -0.3333333333333333\right)\right) \cdot \sin y\right) - t_2\\
\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 (* 2.0 (sqrt x))) (t_2 (/ a (* 3.0 b))))
(if (let* ((t_3 (- y (/ (* z t) 3.0))))
(or (<= t_3 -1.5911678706912745e+252)
(not (<= t_3 8.139337473696087e+243))))
(- (* t_1 (cos y)) t_2)
(-
(*
t_1
(-
(*
(cos y)
(cos
(*
(sqrt (* (cbrt 0.3333333333333333) (cbrt 0.3333333333333333)))
(*
(* (* z t) (sqrt 0.3333333333333333))
(sqrt (cbrt 0.3333333333333333))))))
(* (sin (* z (* t -0.3333333333333333))) (sin y))))
t_2))))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 = 2.0 * sqrt(x);
double t_2 = a / (3.0 * b);
double t_3 = y - ((z * t) / 3.0);
double tmp;
if ((t_3 <= -1.5911678706912745e+252) || !(t_3 <= 8.139337473696087e+243)) {
tmp = (t_1 * cos(y)) - t_2;
} else {
tmp = (t_1 * ((cos(y) * cos(sqrt(cbrt(0.3333333333333333) * cbrt(0.3333333333333333)) * (((z * t) * sqrt(0.3333333333333333)) * sqrt(cbrt(0.3333333333333333))))) - (sin(z * (t * -0.3333333333333333)) * sin(y)))) - t_2;
}
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 | 21.1 |
|---|---|
| Target | 19.2 |
| Herbie | 16.9 |
if (-.f64 y (/.f64 (*.f64 z t) 3)) < -1.59116787069127455e252 or 8.13933747369608677e243 < (-.f64 y (/.f64 (*.f64 z t) 3)) Initial program 41.9
Taylor expanded around 0 26.9
if -1.59116787069127455e252 < (-.f64 y (/.f64 (*.f64 z t) 3)) < 8.13933747369608677e243Initial program 13.6
rmApplied sub-neg_binary6413.6
Applied cos-sum_binary6413.2
Simplified13.2
Simplified13.2
rmApplied add-sqr-sqrt_binary6413.2
Applied associate-*l*_binary6413.3
Simplified13.3
rmApplied add-cube-cbrt_binary6413.3
Applied sqrt-prod_binary6413.3
Applied associate-*l*_binary6413.3
Simplified13.3
Final simplification16.9
herbie shell --seed 2021204
(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))))