\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(2 \cdot x\right)\\
\mathbf{if}\;\frac{t_0}{{c}^{2} \cdot \left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \leq 6.733258681127257 \cdot 10^{+264}:\\
\;\;\;\;\begin{array}{l}
t_1 := \left|x \cdot s\right|\\
\frac{\frac{1}{c}}{t_1} \cdot \frac{t_0}{c \cdot t_1}
\end{array}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{{\left(\left(c \cdot \left|s\right|\right) \cdot \left|x\right|\right)}^{2}}\\
\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 (* 2.0 x))))
(if (<=
(/ t_0 (* (pow c 2.0) (* x (* x (pow s 2.0)))))
6.733258681127257e+264)
(let* ((t_1 (fabs (* x s)))) (* (/ (/ 1.0 c) t_1) (/ t_0 (* c t_1))))
(/ t_0 (pow (* (* c (fabs s)) (fabs x)) 2.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 = cos(2.0 * x);
double tmp;
if ((t_0 / (pow(c, 2.0) * (x * (x * pow(s, 2.0))))) <= 6.733258681127257e+264) {
double t_1_1 = fabs(x * s);
tmp = ((1.0 / c) / t_1_1) * (t_0 / (c * t_1_1));
} else {
tmp = t_0 / pow(((c * fabs(s)) * fabs(x)), 2.0);
}
return tmp;
}



Bits error versus x



Bits error versus c



Bits error versus s
Results
if (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 (pow.f64 c 2) (*.f64 (*.f64 x (pow.f64 s 2)) x))) < 6.73325868112725697e264Initial program 13.5
Applied add-sqr-sqrt_binary6413.6
Simplified13.5
Simplified6.7
Applied pow2_binary646.7
Applied pow-prod-down_binary640.6
Applied unpow2_binary640.6
Applied *-un-lft-identity_binary640.6
Applied times-frac_binary640.3
Applied associate-/r*_binary640.3
if 6.73325868112725697e264 < (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 (pow.f64 c 2) (*.f64 (*.f64 x (pow.f64 s 2)) x))) Initial program 29.9
Applied add-sqr-sqrt_binary6429.9
Simplified29.9
Simplified22.5
Applied pow2_binary6422.5
Applied pow-prod-down_binary643.3
Applied fabs-mul_binary643.3
Applied associate-*r*_binary641.6
Final simplification0.9
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))))