Average Error: 59.6 → 23.8
Time: 1.3min
Precision: binary64
Cost: 52226
\[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}\]
\[\begin{array}{l} \mathbf{if}\;x \leq 2.6134317790376 \cdot 10^{-310}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 163559103.077314:\\ \;\;\;\;\sqrt[3]{\sqrt[3]{e^{\left(\log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) - x\right) \cdot 9}}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]
\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}
\begin{array}{l}
\mathbf{if}\;x \leq 2.6134317790376 \cdot 10^{-310}:\\
\;\;\;\;1\\

\mathbf{elif}\;x \leq 163559103.077314:\\
\;\;\;\;\sqrt[3]{\sqrt[3]{e^{\left(\log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) - x\right) \cdot 9}}}\\

\mathbf{else}:\\
\;\;\;\;0\\

\end{array}
(FPCore (x) :precision binary64 (* (fmod (exp x) (sqrt (cos x))) (exp (- x))))
(FPCore (x)
 :precision binary64
 (if (<= x 2.6134317790376e-310)
   1.0
   (if (<= x 163559103.077314)
     (cbrt (cbrt (exp (* (- (log (fmod (exp x) (sqrt (cos x)))) x) 9.0))))
     0.0)))
double code(double x) {
	return fmod(exp(x), sqrt(cos(x))) * exp(-x);
}
double code(double x) {
	double tmp;
	if (x <= 2.6134317790376e-310) {
		tmp = 1.0;
	} else if (x <= 163559103.077314) {
		tmp = cbrt(cbrt(exp((log(fmod(exp(x), sqrt(cos(x)))) - x) * 9.0)));
	} else {
		tmp = 0.0;
	}
	return tmp;
}

Error

Bits error versus x

Alternatives

Alternative 1
Error23.6
Cost77569
\[\begin{array}{l} \mathbf{if}\;x \leq 2.6134317790376 \cdot 10^{-310}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{e^{-x}} \cdot \log \left({\left(e^{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)}^{\left(\sqrt[3]{{\left(e^{x}\right)}^{-2}}\right)}\right)\\ \end{array}\]
Alternative 2
Error23.8
Cost52162
\[\begin{array}{l} \mathbf{if}\;x \leq 2.6134317790376 \cdot 10^{-310}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 163559103.077314:\\ \;\;\;\;\sqrt[3]{\sqrt[3]{{\left(\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}\right)}^{9}}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]
Alternative 3
Error23.8
Cost32898
\[\begin{array}{l} \mathbf{if}\;x \leq 2.6134317790376 \cdot 10^{-310}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 163559103.077314:\\ \;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]
Alternative 4
Error24.3
Cost385
\[\begin{array}{l} \mathbf{if}\;x \leq 2.6134317790376 \cdot 10^{-310}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]
Alternative 5
Error49.2
Cost64
\[0\]

Error

Derivation

  1. Split input into 3 regimes
  2. if x < 2.613431779037581e-310

    1. Initial program 0

      \[1\]
    2. Simplified0

      \[\leadsto \color{blue}{1}\]

    if 2.613431779037581e-310 < x < 163559103.077313989

    1. Initial program 58.8

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}\]
    2. Simplified58.8

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}}\]
    3. Using strategy rm
    4. Applied add-cbrt-cube_binary64_113758.8

      \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}} \cdot \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}\right) \cdot \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}}}\]
    5. Simplified58.8

      \[\leadsto \sqrt[3]{\color{blue}{{\left(\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}\right)}^{3}}}\]
    6. Using strategy rm
    7. Applied add-cbrt-cube_binary64_113758.8

      \[\leadsto \sqrt[3]{\color{blue}{\sqrt[3]{\left({\left(\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}\right)}^{3} \cdot {\left(\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}\right)}^{3}\right) \cdot {\left(\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}\right)}^{3}}}}\]
    8. Simplified58.8

      \[\leadsto \sqrt[3]{\sqrt[3]{\color{blue}{{\left({\left(\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}\right)}^{3}\right)}^{3}}}}\]
    9. Using strategy rm
    10. Applied pow-to-exp_binary64_117058.8

      \[\leadsto \sqrt[3]{\sqrt[3]{\color{blue}{e^{\log \left({\left(\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}\right)}^{3}\right) \cdot 3}}}}\]
    11. Simplified58.8

      \[\leadsto \sqrt[3]{\sqrt[3]{e^{\color{blue}{\left(\log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) - x\right) \cdot 9}}}}\]
    12. Simplified58.8

      \[\leadsto \color{blue}{\sqrt[3]{\sqrt[3]{e^{\left(\log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) - x\right) \cdot 9}}}}\]

    if 163559103.077313989 < x

    1. Initial program 0

      \[0\]
    2. Simplified0

      \[\leadsto \color{blue}{0}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification23.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2.6134317790376 \cdot 10^{-310}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 163559103.077314:\\ \;\;\;\;\sqrt[3]{\sqrt[3]{e^{\left(\log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) - x\right) \cdot 9}}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]

Reproduce

herbie shell --seed 2021014 
(FPCore (x)
  :name "expfmod"
  :precision binary64
  (* (fmod (exp x) (sqrt (cos x))) (exp (- x))))