\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}\;\cos \left(y - \frac{z \cdot t}{3}\right) \leq 0.9999999999993662:\\
\;\;\;\;2 \cdot \left(\cos y \cdot \left(\sqrt[3]{\log \left(e^{{\left(\cos \left(z \cdot \left(t \cdot 0.3333333333333333\right)\right)\right)}^{3}}\right)} \cdot \sqrt{x}\right) + \sin y \cdot \left(\sqrt{x} \cdot \sin \left(z \cdot \frac{t}{3}\right)\right)\right) - \frac{a}{3 \cdot b}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\sqrt{x} \cdot \left(1 + y \cdot \left(y \cdot -0.5\right)\right)\right) - \frac{a}{3 \cdot b}\\
\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 (<= (cos (- y (/ (* z t) 3.0))) 0.9999999999993662)
(-
(*
2.0
(+
(*
(cos y)
(*
(cbrt (log (exp (pow (cos (* z (* t 0.3333333333333333))) 3.0))))
(sqrt x)))
(* (sin y) (* (sqrt x) (sin (* z (/ t 3.0)))))))
(/ a (* 3.0 b)))
(- (* 2.0 (* (sqrt x) (+ 1.0 (* y (* y -0.5))))) (/ a (* 3.0 b)))))double code(double x, double y, double z, double t, double a, double b) {
return ((double) (((double) (((double) (2.0 * ((double) sqrt(x)))) * ((double) cos(((double) (y - (((double) (z * t)) / 3.0))))))) - (a / ((double) (b * 3.0)))));
}
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((((double) cos(((double) (y - (((double) (z * t)) / 3.0))))) <= 0.9999999999993662)) {
tmp = ((double) (((double) (2.0 * ((double) (((double) (((double) cos(y)) * ((double) (((double) cbrt(((double) log(((double) exp(((double) pow(((double) cos(((double) (z * ((double) (t * 0.3333333333333333)))))), 3.0)))))))) * ((double) sqrt(x)))))) + ((double) (((double) sin(y)) * ((double) (((double) sqrt(x)) * ((double) sin(((double) (z * (t / 3.0))))))))))))) - (a / ((double) (3.0 * b)))));
} else {
tmp = ((double) (((double) (2.0 * ((double) (((double) sqrt(x)) * ((double) (1.0 + ((double) (y * ((double) (y * -0.5)))))))))) - (a / ((double) (3.0 * b)))));
}
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.7 |
|---|---|
| Target | 18.8 |
| Herbie | 17.8 |
if (cos (- y (/ (* z t) 3.0))) < 0.999999999999366174Initial program Error: 19.9 bits
SimplifiedError: 19.9 bits
rmApplied cos-diffError: 19.2 bits
Applied distribute-lft-inError: 19.2 bits
SimplifiedError: 19.2 bits
SimplifiedError: 19.2 bits
Taylor expanded around inf Error: 19.2 bits
SimplifiedError: 19.2 bits
rmApplied add-cbrt-cubeError: 19.2 bits
SimplifiedError: 19.2 bits
rmApplied add-log-expError: 19.2 bits
if 0.999999999999366174 < (cos (- y (/ (* z t) 3.0))) Initial program Error: 22.2 bits
SimplifiedError: 22.2 bits
Taylor expanded around 0 Error: 15.3 bits
SimplifiedError: 15.3 bits
Final simplificationError: 17.8 bits
herbie shell --seed 2020203
(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))))