\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 := \frac{\cos \left(x + x\right)}{x}\\
\mathbf{if}\;x \leq 3.413023980714311 \cdot 10^{-307}:\\
\;\;\;\;\frac{\frac{\frac{t_1}{c}}{s}}{s \cdot \left(x \cdot c\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_1}{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)) x)))
(if (<= x 3.413023980714311e-307)
(/ (/ (/ t_1 c) s) (* s (* x c)))
(/ (/ t_1 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)) / x;
double tmp;
if (x <= 3.413023980714311e-307) {
tmp = ((t_1 / c) / s) / (s * (x * c));
} else {
tmp = (t_1 / t_0) / t_0;
}
return tmp;
}



Bits error versus x



Bits error versus c



Bits error versus s
Results
if x < 3.41302398071431097e-307Initial program 28.4
Applied egg-rr26.5
Applied egg-rr18.2
Applied egg-rr15.3
Applied egg-rr2.9
if 3.41302398071431097e-307 < x Initial program 28.2
Applied egg-rr26.8
Applied egg-rr0.9
Final simplification1.9
herbie shell --seed 2022125
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))