\left(2 \cdot \sqrt{x}\right) \cdot \cos \left(y - \frac{z \cdot t}{3}\right) - \frac{a}{b \cdot 3}\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -9.314420099989661 \cdot 10^{+290}:\\
\;\;\;\;\sqrt[3]{\left(2 \cdot \sqrt{x}\right) \cdot \cos y} \cdot \left(\sqrt[3]{\left(2 \cdot \sqrt{x}\right) \cdot \cos y} \cdot \sqrt[3]{\left(2 \cdot \sqrt{x}\right) \cdot \cos y}\right) - \frac{a}{b \cdot 3}\\
\mathbf{elif}\;z \cdot t \leq 4.3401700005647045 \cdot 10^{+290}:\\
\;\;\;\;\left(2 \cdot \sqrt{x}\right) \cdot \left(\cos y \cdot \cos \left(\left(-\frac{z}{\sqrt{3}}\right) \cdot \frac{t}{\sqrt{3}}\right) - \sin y \cdot \sin \left(\left(-\frac{z}{\sqrt{3}}\right) \cdot \frac{t}{\sqrt{3}}\right)\right) - \frac{a}{b \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \sqrt{x} - \frac{\frac{a}{b}}{3}\\
\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
(if (<= (* z t) -9.314420099989661e+290)
(-
(*
(cbrt (* (* 2.0 (sqrt x)) (cos y)))
(*
(cbrt (* (* 2.0 (sqrt x)) (cos y)))
(cbrt (* (* 2.0 (sqrt x)) (cos y)))))
(/ a (* b 3.0)))
(if (<= (* z t) 4.3401700005647045e+290)
(-
(*
(* 2.0 (sqrt x))
(-
(* (cos y) (cos (* (- (/ z (sqrt 3.0))) (/ t (sqrt 3.0)))))
(* (sin y) (sin (* (- (/ z (sqrt 3.0))) (/ t (sqrt 3.0)))))))
(/ a (* b 3.0)))
(- (* 2.0 (sqrt x)) (/ (/ a b) 3.0)))))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 tmp;
if ((z * t) <= -9.314420099989661e+290) {
tmp = (cbrt((2.0 * sqrt(x)) * cos(y)) * (cbrt((2.0 * sqrt(x)) * cos(y)) * cbrt((2.0 * sqrt(x)) * cos(y)))) - (a / (b * 3.0));
} else if ((z * t) <= 4.3401700005647045e+290) {
tmp = ((2.0 * sqrt(x)) * ((cos(y) * cos(-(z / sqrt(3.0)) * (t / sqrt(3.0)))) - (sin(y) * sin(-(z / sqrt(3.0)) * (t / sqrt(3.0)))))) - (a / (b * 3.0));
} else {
tmp = (2.0 * sqrt(x)) - ((a / b) / 3.0);
}
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 | 20.9 |
|---|---|
| Target | 19.0 |
| Herbie | 16.8 |
if (*.f64 z t) < -9.3144200999896612e290Initial program 61.1
Taylor expanded around 0 33.9
rmApplied add-cube-cbrt_binary64_1989133.9
if -9.3144200999896612e290 < (*.f64 z t) < 4.34017000056470449e290Initial program 14.4
rmApplied add-sqr-sqrt_binary64_1987814.5
Applied times-frac_binary64_1986214.5
Applied cancel-sign-sub-inv_binary64_1982214.5
Applied cos-sum_binary64_1999014.0
if 4.34017000056470449e290 < (*.f64 z t) Initial program 60.8
Taylor expanded around 0 34.4
rmApplied associate-/r*_binary64_1980034.6
Taylor expanded around 0 34.6
Final simplification16.8
herbie shell --seed 2021015
(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))))