\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}
\begin{array}{l}
t_0 := \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\\
t_1 := e^{-x}\\
t_2 := t_0 \cdot t_1\\
\mathbf{if}\;t_2 \leq 0:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_2 \leq 1:\\
\;\;\;\;\frac{t_0}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
(FPCore (x) :precision binary64 (* (fmod (exp x) (sqrt (cos x))) (exp (- x))))
(FPCore (x)
:precision binary64
(let* ((t_0 (fmod (exp x) (sqrt (cos x))))
(t_1 (exp (- x)))
(t_2 (* t_0 t_1)))
(if (<= t_2 0.0) t_1 (if (<= t_2 1.0) (/ t_0 (exp x)) t_1))))double code(double x) {
return fmod(exp(x), sqrt(cos(x))) * exp(-x);
}
double code(double x) {
double t_0 = fmod(exp(x), sqrt(cos(x)));
double t_1 = exp(-x);
double t_2 = t_0 * t_1;
double tmp;
if (t_2 <= 0.0) {
tmp = t_1;
} else if (t_2 <= 1.0) {
tmp = t_0 / exp(x);
} else {
tmp = t_1;
}
return tmp;
}



Bits error versus x
if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 0.0 or 1 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) Initial program 61.8
Simplified61.8
Applied add-exp-log_binary6461.8
Applied div-exp_binary6461.8
Taylor expanded in x around inf 24.5
if 0.0 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 1Initial program 12.8
Simplified12.7
Applied pow1_binary6412.7
Final simplification23.9
herbie shell --seed 2022104
(FPCore (x)
:name "expfmod"
:precision binary64
(* (fmod (exp x) (sqrt (cos x))) (exp (- x))))