\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}
\begin{array}{l}
t_0 := c \cdot \left(s \cdot \sqrt{x}\right)\\
t_1 := {s}^{2} \cdot \left(x \cdot c\right)\\
t_2 := \frac{\cos \left(x + x\right)}{x}\\
t_3 := \frac{t_2}{c}\\
t_4 := \sqrt[3]{t_3}\\
t_5 := s \cdot \sqrt{x \cdot c}\\
\mathbf{if}\;x \leq -8.754996079145237 \cdot 10^{+225}:\\
\;\;\;\;\frac{t_3}{t_1}\\
\mathbf{elif}\;x \leq -4.4022230997663105 \cdot 10^{+185}:\\
\;\;\;\;\frac{{t_4}^{2}}{t_5} \cdot \frac{t_4}{t_5}\\
\mathbf{elif}\;x \leq -71415521545202600:\\
\;\;\;\;\frac{\frac{\cos \left(x \cdot 2\right)}{x \cdot c}}{t_1}\\
\mathbf{elif}\;x \leq -4.366774230335914 \cdot 10^{-309}:\\
\;\;\;\;\frac{1}{t_5} \cdot \frac{t_3}{t_5}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_2}{t_0}}{t_0}\\
\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
(let* ((t_0 (* c (* s (sqrt x))))
(t_1 (* (pow s 2.0) (* x c)))
(t_2 (/ (cos (+ x x)) x))
(t_3 (/ t_2 c))
(t_4 (cbrt t_3))
(t_5 (* s (sqrt (* x c)))))
(if (<= x -8.754996079145237e+225)
(/ t_3 t_1)
(if (<= x -4.4022230997663105e+185)
(* (/ (pow t_4 2.0) t_5) (/ t_4 t_5))
(if (<= x -71415521545202600.0)
(/ (/ (cos (* x 2.0)) (* x c)) t_1)
(if (<= x -4.366774230335914e-309)
(* (/ 1.0 t_5) (/ t_3 t_5))
(/ (/ t_2 t_0) t_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 t_0 = c * (s * sqrt(x));
double t_1 = pow(s, 2.0) * (x * c);
double t_2 = cos((x + x)) / x;
double t_3 = t_2 / c;
double t_4 = cbrt(t_3);
double t_5 = s * sqrt((x * c));
double tmp;
if (x <= -8.754996079145237e+225) {
tmp = t_3 / t_1;
} else if (x <= -4.4022230997663105e+185) {
tmp = (pow(t_4, 2.0) / t_5) * (t_4 / t_5);
} else if (x <= -71415521545202600.0) {
tmp = (cos((x * 2.0)) / (x * c)) / t_1;
} else if (x <= -4.366774230335914e-309) {
tmp = (1.0 / t_5) * (t_3 / t_5);
} else {
tmp = (t_2 / t_0) / t_0;
}
return tmp;
}



Bits error versus x



Bits error versus c



Bits error versus s
Results
if x < -8.75499607914523745e225Initial program 28.6
Applied egg-rr26.7
Applied egg-rr16.9
Taylor expanded in c around 0 14.0
if -8.75499607914523745e225 < x < -4.40222309976631051e185Initial program 28.5
Applied egg-rr27.0
Applied egg-rr17.3
Applied egg-rr16.7
if -4.40222309976631051e185 < x < -71415521545202600Initial program 23.6
Applied egg-rr22.3
Applied egg-rr15.8
Taylor expanded in c around 0 13.6
Taylor expanded in x around inf 13.6
if -71415521545202600 < x < -4.3667742303359139e-309Initial program 33.4
Applied egg-rr31.6
Applied egg-rr22.7
Applied egg-rr17.1
if -4.3667742303359139e-309 < x Initial program 28.6
Applied egg-rr27.2
Applied egg-rr0.9
Final simplification8.2
herbie shell --seed 2022129
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))