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




Bits error versus x
| Alternative 1 | |
|---|---|
| Error | 36.7 |
| Cost | 64 |

if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 1Initial program 30.7
if 1 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) Initial program 1.2
Final simplification24.8
herbie shell --seed 2021044
(FPCore (x)
:name "expfmod"
:precision binary64
(* (fmod (exp x) (sqrt (cos x))) (exp (- x))))