\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 := \cos \left(x + x\right)\\
\mathbf{if}\;x \leq 2.549378178247403 \cdot 10^{-309}:\\
\;\;\;\;\frac{\frac{\frac{1}{x} \cdot t_1}{c}}{{s}^{2} \cdot \left(x \cdot c\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{t_1}{x}}{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 (cos (+ x x))))
(if (<= x 2.549378178247403e-309)
(/ (/ (* (/ 1.0 x) t_1) c) (* (pow s 2.0) (* x c)))
(/ (/ (/ t_1 x) 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 = cos((x + x));
double tmp;
if (x <= 2.549378178247403e-309) {
tmp = (((1.0 / x) * t_1) / c) / (pow(s, 2.0) * (x * c));
} else {
tmp = ((t_1 / x) / t_0) / t_0;
}
return tmp;
}



Bits error versus x



Bits error versus c



Bits error versus s
Results
if x < 2.5493781782474033e-309Initial program 27.4
Applied egg-rr25.9
Applied egg-rr18.3
Taylor expanded in c around 0 15.2
Applied egg-rr15.2
if 2.5493781782474033e-309 < x Initial program 28.5
Applied egg-rr27.1
Applied egg-rr0.8
Final simplification8.1
herbie shell --seed 2022130
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))