\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}\begin{array}{l}
\mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \leq \infty:\\
\;\;\;\;\frac{\frac{\cos \left(2 \cdot x\right)}{\left|s \cdot \left(x \cdot c\right)\right|}}{\left|c \cdot \left(x \cdot s\right)\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(2 \cdot x\right)}{{\left(\left|x \cdot \left(c \cdot s\right)\right|\right)}^{2}}\\
\end{array}(FPCore (x c s) :precision binary64 (/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))
(FPCore (x c s) :precision binary64 (if (<= (/ (cos (* 2.0 x)) (* (pow c 2.0) (* x (* x (pow s 2.0))))) INFINITY) (/ (/ (cos (* 2.0 x)) (fabs (* s (* x c)))) (fabs (* c (* x s)))) (/ (cos (* 2.0 x)) (pow (fabs (* x (* c s))) 2.0))))
double code(double x, double c, double s) {
return cos(2.0 * x) / (pow(c, 2.0) * ((x * pow(s, 2.0)) * x));
}
double code(double x, double c, double s) {
double tmp;
if ((cos(2.0 * x) / (pow(c, 2.0) * (x * (x * pow(s, 2.0))))) <= ((double) INFINITY)) {
tmp = (cos(2.0 * x) / fabs(s * (x * c))) / fabs(c * (x * s));
} else {
tmp = cos(2.0 * x) / pow(fabs(x * (c * s)), 2.0);
}
return tmp;
}



Bits error versus x



Bits error versus c



Bits error versus s
Results
if (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 (pow.f64 c 2) (*.f64 (*.f64 x (pow.f64 s 2)) x))) < +inf.0Initial program 18.4
Simplified14.5
rmApplied add-sqr-sqrt_binary64_78214.5
Simplified14.5
Simplified1.6
rmApplied associate-/r*_binary64_7041.3
Simplified1.3
Taylor expanded around 0 1.3
Simplified1.2
if +inf.0 < (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 (pow.f64 c 2) (*.f64 (*.f64 x (pow.f64 s 2)) x))) Initial program 64.0
Simplified21.7
rmApplied add-sqr-sqrt_binary64_78221.7
Simplified25.3
Simplified6.5
Taylor expanded around inf 6.5
Simplified2.8
Final simplification1.6
herbie shell --seed 2021176
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))