\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}\begin{array}{l}
\mathbf{if}\;x \le 7.28849022830325509 \cdot 10^{-274}:\\
\;\;\;\;\frac{\frac{\cos \left(2 \cdot x\right)}{\left|{cos}^{\left(\frac{2}{2}\right)} \cdot \left(x \cdot {sin}^{\left(\frac{2}{2}\right)}\right)\right|}}{\left|{cos}^{\left(\frac{2}{2}\right)} \cdot \left(x \cdot {sin}^{\left(\frac{2}{2}\right)}\right)\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(2 \cdot x\right)}{{\left(\left|{\left({cos}^{1} \cdot {sin}^{1}\right)}^{1} \cdot x\right|\right)}^{2}}\\
\end{array}double code(double x, double cos, double sin) {
return (cos((2.0 * x)) / (pow(cos, 2.0) * ((x * pow(sin, 2.0)) * x)));
}
double code(double x, double cos, double sin) {
double temp;
if ((x <= 7.288490228303255e-274)) {
temp = ((cos((2.0 * x)) / fabs((pow(cos, (2.0 / 2.0)) * (x * pow(sin, (2.0 / 2.0)))))) / fabs((pow(cos, (2.0 / 2.0)) * (x * pow(sin, (2.0 / 2.0))))));
} else {
temp = (cos((2.0 * x)) / pow(fabs((pow((pow(cos, 1.0) * pow(sin, 1.0)), 1.0) * x)), 2.0));
}
return temp;
}



Bits error versus x



Bits error versus cos



Bits error versus sin
Results
if x < 7.288490228303255e-274Initial program 29.6
rmApplied sqr-pow29.6
Applied associate-*l*24.4
rmApplied sqr-pow24.4
Applied associate-*r*16.8
rmApplied add-sqr-sqrt16.9
Simplified16.8
Simplified2.7
rmApplied associate-/r*2.5
if 7.288490228303255e-274 < x Initial program 28.0
rmApplied sqr-pow28.0
Applied associate-*l*23.0
rmApplied sqr-pow23.0
Applied associate-*r*16.1
rmApplied add-sqr-sqrt16.2
Simplified16.1
Simplified2.7
Taylor expanded around inf 2.6
Final simplification2.6
herbie shell --seed 2020066
(FPCore (x cos sin)
:name "cos(2*x)/(cos^2(x)*sin^2(x))"
:precision binary64
(/ (cos (* 2 x)) (* (pow cos 2) (* (* x (pow sin 2)) x))))