\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 := t_1 \cdot \cos y\\
\mathbf{if}\;z \cdot t \leq -8.362278312654834 \cdot 10^{+235}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{a}{b} + t_2\\
\mathbf{elif}\;z \cdot t \leq 119678121304.56062:\\
\;\;\;\;\begin{array}{l}
t_3 := z \cdot \left(t \cdot -0.3333333333333333\right)\\
\mathsf{fma}\left(a, \frac{-0.3333333333333333}{b}, t_1 \cdot \left(\cos y \cdot \cos t_3 - \sin t_3 \cdot \sin y\right)\right)
\end{array}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{\frac{1}{b}}{-3}, t_2\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 (* 2.0 (sqrt x))) (t_2 (* t_1 (cos y))))
(if (<= (* z t) -8.362278312654834e+235)
(+ (* -0.3333333333333333 (/ a b)) t_2)
(if (<= (* z t) 119678121304.56062)
(let* ((t_3 (* z (* t -0.3333333333333333))))
(fma
a
(/ -0.3333333333333333 b)
(* t_1 (- (* (cos y) (cos t_3)) (* (sin t_3) (sin y))))))
(fma a (/ (/ 1.0 b) -3.0) 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 = t_1 * cos(y);
double tmp;
if ((z * t) <= -8.362278312654834e+235) {
tmp = (-0.3333333333333333 * (a / b)) + t_2;
} else if ((z * t) <= 119678121304.56062) {
double t_3 = z * (t * -0.3333333333333333);
tmp = fma(a, (-0.3333333333333333 / b), (t_1 * ((cos(y) * cos(t_3)) - (sin(t_3) * sin(y)))));
} else {
tmp = fma(a, ((1.0 / b) / -3.0), 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
| Original | 20.5 |
|---|---|
| Target | 18.5 |
| Herbie | 16.2 |
if (*.f64 z t) < -8.3622783126548336e235Initial program 53.5
Simplified53.4
Taylor expanded in z around 0 33.5
Applied div-inv_binary6433.5
Applied fma-udef_binary6433.5
Simplified33.5
if -8.3622783126548336e235 < (*.f64 z t) < 119678121304.560623Initial program 7.8
Simplified7.9
Applied fma-udef_binary647.9
Applied cos-sum_binary647.3
if 119678121304.560623 < (*.f64 z t) Initial program 41.2
Simplified41.3
Taylor expanded in z around 0 33.3
Applied clear-num_binary6433.4
Applied div-inv_binary6433.3
Applied associate-/r*_binary6433.3
Final simplification16.2
herbie shell --seed 2021313
(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))))