\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 -1.5924942241623108 \cdot 10^{+206}:\\
\;\;\;\;\mathsf{fma}\left(-0.3333333333333333, \frac{a}{b}, 2 \cdot \left(\cos y \cdot \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := 2 \cdot \sqrt{x}\\
\mathbf{if}\;z \cdot t \leq 2.7279406500333466 \cdot 10^{+142}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{-0.3333333333333333}{b}, t_1 \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)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{-0.3333333333333333}{b}, t_1\right)\\
\end{array}\\
\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) -1.5924942241623108e+206)
(fma -0.3333333333333333 (/ a b) (* 2.0 (* (cos y) (sqrt x))))
(let* ((t_1 (* 2.0 (sqrt x))))
(if (<= (* z t) 2.7279406500333466e+142)
(fma
a
(/ -0.3333333333333333 b)
(*
t_1
(-
(* (cos y) (cos (* (* z t) 0.3333333333333333)))
(* (sin y) (sin (* z (* t -0.3333333333333333)))))))
(fma a (/ -0.3333333333333333 b) t_1)))))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) <= -1.5924942241623108e+206) {
tmp = fma(-0.3333333333333333, (a / b), (2.0 * (cos(y) * sqrt(x))));
} else {
double t_1 = 2.0 * sqrt(x);
double tmp_1;
if ((z * t) <= 2.7279406500333466e+142) {
tmp_1 = fma(a, (-0.3333333333333333 / b), (t_1 * ((cos(y) * cos((z * t) * 0.3333333333333333)) - (sin(y) * sin(z * (t * -0.3333333333333333))))));
} else {
tmp_1 = fma(a, (-0.3333333333333333 / b), t_1);
}
tmp = tmp_1;
}
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.7 |
|---|---|
| Target | 18.7 |
| Herbie | 16.4 |
if (*.f64 z t) < -1.59249422416231081e206Initial program 50.7
Simplified50.7
Taylor expanded in z around 0 34.6
Applied div-inv_binary6434.7
Taylor expanded in a around 0 34.7
Simplified34.7
if -1.59249422416231081e206 < (*.f64 z t) < 2.7279406500333466e142Initial program 11.0
Simplified11.0
Applied fma-udef_binary6411.0
Applied cos-sum_binary6410.4
Simplified10.4
Simplified10.4
if 2.7279406500333466e142 < (*.f64 z t) Initial program 46.9
Simplified46.9
Taylor expanded in z around 0 32.8
Taylor expanded in y around 0 32.5
Final simplification16.4
herbie shell --seed 2021307
(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))))