\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 := \cos \left(x \cdot 2\right)\\
\mathbf{if}\;x \leq -7.468381497695001 \cdot 10^{+21}:\\
\;\;\;\;\frac{\frac{1}{c}}{x \cdot s} \cdot \frac{\frac{t_0}{c}}{x \cdot s}\\
\mathbf{elif}\;x \leq -7.956937814384305 \cdot 10^{-263}:\\
\;\;\;\;\begin{array}{l}
t_1 := s \cdot \left(x \cdot c\right)\\
\frac{1}{t_1} \cdot \frac{t_0}{t_1}
\end{array}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{c \cdot \left(x \cdot s\right)} \cdot \frac{\frac{\cos x \cdot \cos x - \sin x \cdot \sin x}{c}}{x \cdot s}\\
\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 (cos (* x 2.0))))
(if (<= x -7.468381497695001e+21)
(* (/ (/ 1.0 c) (* x s)) (/ (/ t_0 c) (* x s)))
(if (<= x -7.956937814384305e-263)
(let* ((t_1 (* s (* x c)))) (* (/ 1.0 t_1) (/ t_0 t_1)))
(*
(/ 1.0 (* c (* x s)))
(/ (/ (- (* (cos x) (cos x)) (* (sin x) (sin x))) c) (* x s)))))))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 = cos(x * 2.0);
double tmp;
if (x <= -7.468381497695001e+21) {
tmp = ((1.0 / c) / (x * s)) * ((t_0 / c) / (x * s));
} else if (x <= -7.956937814384305e-263) {
double t_1 = s * (x * c);
tmp = (1.0 / t_1) * (t_0 / t_1);
} else {
tmp = (1.0 / (c * (x * s))) * ((((cos(x) * cos(x)) - (sin(x) * sin(x))) / c) / (x * s));
}
return tmp;
}



Bits error versus x



Bits error versus c



Bits error versus s
Results
if x < -7.4683814976950014e21Initial program 25.0
Applied add-sqr-sqrt_binary6425.0
Simplified28.5
Simplified2.6
Applied *-un-lft-identity_binary642.6
Applied times-frac_binary642.4
Applied associate-/r*_binary642.4
Applied associate-/r*_binary642.4
if -7.4683814976950014e21 < x < -7.95693781438430461e-263Initial program 33.1
Applied add-sqr-sqrt_binary6433.1
Simplified39.3
Simplified3.5
Applied *-un-lft-identity_binary643.5
Applied times-frac_binary643.2
Simplified5.5
Simplified3.0
if -7.95693781438430461e-263 < x Initial program 28.5
Applied add-sqr-sqrt_binary6428.5
Simplified32.9
Simplified2.9
Applied *-un-lft-identity_binary642.9
Applied times-frac_binary642.7
Applied associate-/r*_binary642.6
Applied cos-2_binary642.7
Final simplification2.7
herbie shell --seed 2022068
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))