expfmod (used to be hard to sample)

Percentage Accurate: 6.9% → 63.3%
Time: 23.2s
Alternatives: 16
Speedup: 5.0×

Specification

?
\[\begin{array}{l} \\ \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \end{array} \]
(FPCore (x) :precision binary64 (* (fmod (exp x) (sqrt (cos x))) (exp (- x))))
double code(double x) {
	return fmod(exp(x), sqrt(cos(x))) * exp(-x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = mod(exp(x), sqrt(cos(x))) * exp(-x)
end function
def code(x):
	return math.fmod(math.exp(x), math.sqrt(math.cos(x))) * math.exp(-x)
function code(x)
	return Float64(rem(exp(x), sqrt(cos(x))) * exp(Float64(-x)))
end
code[x_] := N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 16 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 6.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \end{array} \]
(FPCore (x) :precision binary64 (* (fmod (exp x) (sqrt (cos x))) (exp (- x))))
double code(double x) {
	return fmod(exp(x), sqrt(cos(x))) * exp(-x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = mod(exp(x), sqrt(cos(x))) * exp(-x)
end function
def code(x):
	return math.fmod(math.exp(x), math.sqrt(math.cos(x))) * math.exp(-x)
function code(x)
	return Float64(rem(exp(x), sqrt(cos(x))) * exp(Float64(-x)))
end
code[x_] := N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}
\end{array}

Alternative 1: 63.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt[3]{e^{\cos x}}\\ \mathbf{if}\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \leq 2:\\ \;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left({t\_0}^{2}\right) + \log t\_0}\right)\right)}{e^{x}}\\ \mathbf{else}:\\ \;\;\;\;\left(1 \bmod 1\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (cbrt (exp (cos x)))))
   (if (<= (* (fmod (exp x) (sqrt (cos x))) (exp (- x))) 2.0)
     (/ (fmod (exp x) (sqrt (+ (log (pow t_0 2.0)) (log t_0)))) (exp x))
     (fmod 1.0 1.0))))
double code(double x) {
	double t_0 = cbrt(exp(cos(x)));
	double tmp;
	if ((fmod(exp(x), sqrt(cos(x))) * exp(-x)) <= 2.0) {
		tmp = fmod(exp(x), sqrt((log(pow(t_0, 2.0)) + log(t_0)))) / exp(x);
	} else {
		tmp = fmod(1.0, 1.0);
	}
	return tmp;
}
function code(x)
	t_0 = cbrt(exp(cos(x)))
	tmp = 0.0
	if (Float64(rem(exp(x), sqrt(cos(x))) * exp(Float64(-x))) <= 2.0)
		tmp = Float64(rem(exp(x), sqrt(Float64(log((t_0 ^ 2.0)) + log(t_0)))) / exp(x));
	else
		tmp = rem(1.0, 1.0);
	end
	return tmp
end
code[x_] := Block[{t$95$0 = N[Power[N[Exp[N[Cos[x], $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], 2.0], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[(N[Log[N[Power[t$95$0, 2.0], $MachinePrecision]], $MachinePrecision] + N[Log[t$95$0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt[3]{e^{\cos x}}\\
\mathbf{if}\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \leq 2:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left({t\_0}^{2}\right) + \log t\_0}\right)\right)}{e^{x}}\\

\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2

    1. Initial program 8.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified8.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-log-exp8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\color{blue}{\log \left(e^{\cos x}\right)}}\right)\right)}{e^{x}} \]
      2. add-cube-cbrt59.1%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \color{blue}{\left(\left(\sqrt[3]{e^{\cos x}} \cdot \sqrt[3]{e^{\cos x}}\right) \cdot \sqrt[3]{e^{\cos x}}\right)}}\right)\right)}{e^{x}} \]
      3. log-prod59.1%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\color{blue}{\log \left(\sqrt[3]{e^{\cos x}} \cdot \sqrt[3]{e^{\cos x}}\right) + \log \left(\sqrt[3]{e^{\cos x}}\right)}}\right)\right)}{e^{x}} \]
      4. pow259.1%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \color{blue}{\left({\left(\sqrt[3]{e^{\cos x}}\right)}^{2}\right)} + \log \left(\sqrt[3]{e^{\cos x}}\right)}\right)\right)}{e^{x}} \]
    6. Applied egg-rr59.1%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\color{blue}{\log \left({\left(\sqrt[3]{e^{\cos x}}\right)}^{2}\right) + \log \left(\sqrt[3]{e^{\cos x}}\right)}}\right)\right)}{e^{x}} \]

    if 2 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x)))

    1. Initial program 0.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified0.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 0.1%

      \[\leadsto \color{blue}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)} \]
    6. Taylor expanded in x around 0 3.4%

      \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \]
    7. Taylor expanded in x around 0 5.2%

      \[\leadsto \left(1 \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right) \]
    8. Taylor expanded in x around 0 97.9%

      \[\leadsto \left(1 \bmod \color{blue}{1}\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 28.9% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\\ t_1 := t\_0 \cdot e^{-x}\\ \mathbf{if}\;t\_1 \leq 0:\\ \;\;\;\;\frac{\left(\left(\log \left(\sqrt[3]{e}\right) + \log \left(\sqrt[3]{e^{2}}\right)\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{x + 1}\\ \mathbf{elif}\;t\_1 \leq 2:\\ \;\;\;\;\log \left(e^{\frac{t\_0}{1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 \bmod 1\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (fmod (exp x) (sqrt (cos x)))) (t_1 (* t_0 (exp (- x)))))
   (if (<= t_1 0.0)
     (/
      (fmod
       (+ (log (cbrt E)) (log (cbrt (exp 2.0))))
       (+ 1.0 (* -0.25 (pow x 2.0))))
      (+ x 1.0))
     (if (<= t_1 2.0)
       (log
        (exp
         (/
          t_0
          (+ 1.0 (* x (+ 1.0 (* x (+ 0.5 (* x 0.16666666666666666)))))))))
       (fmod 1.0 1.0)))))
double code(double x) {
	double t_0 = fmod(exp(x), sqrt(cos(x)));
	double t_1 = t_0 * exp(-x);
	double tmp;
	if (t_1 <= 0.0) {
		tmp = fmod((log(cbrt(((double) M_E))) + log(cbrt(exp(2.0)))), (1.0 + (-0.25 * pow(x, 2.0)))) / (x + 1.0);
	} else if (t_1 <= 2.0) {
		tmp = log(exp((t_0 / (1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666)))))))));
	} else {
		tmp = fmod(1.0, 1.0);
	}
	return tmp;
}
function code(x)
	t_0 = rem(exp(x), sqrt(cos(x)))
	t_1 = Float64(t_0 * exp(Float64(-x)))
	tmp = 0.0
	if (t_1 <= 0.0)
		tmp = Float64(rem(Float64(log(cbrt(exp(1))) + log(cbrt(exp(2.0)))), Float64(1.0 + Float64(-0.25 * (x ^ 2.0)))) / Float64(x + 1.0));
	elseif (t_1 <= 2.0)
		tmp = log(exp(Float64(t_0 / Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * 0.16666666666666666)))))))));
	else
		tmp = rem(1.0, 1.0);
	end
	return tmp
end
code[x_] := Block[{t$95$0 = N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(N[With[{TMP1 = N[(N[Log[N[Power[E, 1/3], $MachinePrecision]], $MachinePrecision] + N[Log[N[Power[N[Exp[2.0], $MachinePrecision], 1/3], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], TMP2 = N[(1.0 + N[(-0.25 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[Log[N[Exp[N[(t$95$0 / N[(1.0 + N[(x * N[(1.0 + N[(x * N[(0.5 + N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\\
t_1 := t\_0 \cdot e^{-x}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\frac{\left(\left(\log \left(\sqrt[3]{e}\right) + \log \left(\sqrt[3]{e^{2}}\right)\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{x + 1}\\

\mathbf{elif}\;t\_1 \leq 2:\\
\;\;\;\;\log \left(e^{\frac{t\_0}{1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}}\right)\\

\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 0.0

    1. Initial program 4.1%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity4.1%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/4.1%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg4.1%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg4.1%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified4.1%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 4.1%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right)}{e^{x}} \]
    6. Taylor expanded in x around 0 4.1%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{\color{blue}{1 + x}} \]
    7. Step-by-step derivation
      1. +-commutative4.1%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{\color{blue}{x + 1}} \]
    8. Simplified4.1%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{\color{blue}{x + 1}} \]
    9. Step-by-step derivation
      1. add-log-exp4.1%

        \[\leadsto \frac{\left(\color{blue}{\log \left(e^{e^{x}}\right)} \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{x + 1} \]
      2. add-cube-cbrt8.0%

        \[\leadsto \frac{\left(\log \color{blue}{\left(\left(\sqrt[3]{e^{e^{x}}} \cdot \sqrt[3]{e^{e^{x}}}\right) \cdot \sqrt[3]{e^{e^{x}}}\right)} \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{x + 1} \]
      3. log-prod8.0%

        \[\leadsto \frac{\left(\color{blue}{\left(\log \left(\sqrt[3]{e^{e^{x}}} \cdot \sqrt[3]{e^{e^{x}}}\right) + \log \left(\sqrt[3]{e^{e^{x}}}\right)\right)} \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{x + 1} \]
      4. pow28.0%

        \[\leadsto \frac{\left(\left(\log \color{blue}{\left({\left(\sqrt[3]{e^{e^{x}}}\right)}^{2}\right)} + \log \left(\sqrt[3]{e^{e^{x}}}\right)\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{x + 1} \]
    10. Applied egg-rr8.0%

      \[\leadsto \frac{\left(\color{blue}{\left(\log \left({\left(\sqrt[3]{e^{e^{x}}}\right)}^{2}\right) + \log \left(\sqrt[3]{e^{e^{x}}}\right)\right)} \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{x + 1} \]
    11. Taylor expanded in x around 0 8.0%

      \[\leadsto \frac{\left(\color{blue}{\left(\log \left(\sqrt[3]{e^{1}}\right) + \log \left(\sqrt[3]{{\left(e^{1}\right)}^{2}}\right)\right)} \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{x + 1} \]
    12. Step-by-step derivation
      1. exp-1-e8.0%

        \[\leadsto \frac{\left(\left(\log \left(\sqrt[3]{\color{blue}{e}}\right) + \log \left(\sqrt[3]{{\left(e^{1}\right)}^{2}}\right)\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{x + 1} \]
      2. exp-1-e8.0%

        \[\leadsto \frac{\left(\left(\log \left(\sqrt[3]{e}\right) + \log \left(\sqrt[3]{{\color{blue}{e}}^{2}}\right)\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{x + 1} \]
      3. exp-1-e8.0%

        \[\leadsto \frac{\left(\left(\log \left(\sqrt[3]{e}\right) + \log \left(\sqrt[3]{{\color{blue}{\left(e^{1}\right)}}^{2}}\right)\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{x + 1} \]
      4. unpow28.0%

        \[\leadsto \frac{\left(\left(\log \left(\sqrt[3]{e}\right) + \log \left(\sqrt[3]{\color{blue}{e^{1} \cdot e^{1}}}\right)\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{x + 1} \]
      5. prod-exp8.0%

        \[\leadsto \frac{\left(\left(\log \left(\sqrt[3]{e}\right) + \log \left(\sqrt[3]{\color{blue}{e^{1 + 1}}}\right)\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{x + 1} \]
      6. metadata-eval8.0%

        \[\leadsto \frac{\left(\left(\log \left(\sqrt[3]{e}\right) + \log \left(\sqrt[3]{e^{\color{blue}{2}}}\right)\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{x + 1} \]
    13. Simplified8.0%

      \[\leadsto \frac{\left(\color{blue}{\left(\log \left(\sqrt[3]{e}\right) + \log \left(\sqrt[3]{e^{2}}\right)\right)} \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{x + 1} \]

    if 0.0 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2

    1. Initial program 79.4%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity79.4%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/79.3%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg79.5%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg79.5%

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

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-log-exp80.8%

        \[\leadsto \color{blue}{\log \left(e^{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}}\right)} \]
    6. Applied egg-rr80.8%

      \[\leadsto \color{blue}{\log \left(e^{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}}\right)} \]
    7. Taylor expanded in x around 0 80.8%

      \[\leadsto \log \left(e^{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{1 + x \cdot \left(1 + x \cdot \left(0.5 + 0.16666666666666666 \cdot x\right)\right)}}}\right) \]
    8. Step-by-step derivation
      1. *-commutative80.8%

        \[\leadsto \log \left(e^{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1 + x \cdot \left(1 + x \cdot \left(0.5 + \color{blue}{x \cdot 0.16666666666666666}\right)\right)}}\right) \]
    9. Simplified80.8%

      \[\leadsto \log \left(e^{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}}}\right) \]

    if 2 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x)))

    1. Initial program 0.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified0.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 0.1%

      \[\leadsto \color{blue}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)} \]
    6. Taylor expanded in x around 0 3.4%

      \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \]
    7. Taylor expanded in x around 0 5.2%

      \[\leadsto \left(1 \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right) \]
    8. Taylor expanded in x around 0 97.9%

      \[\leadsto \left(1 \bmod \color{blue}{1}\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 3: 62.9% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \leq 2:\\ \;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left({\left(\sqrt[3]{e^{\cos x}}\right)}^{2}\right) + \log \left(\sqrt[3]{e}\right)}\right)\right)}{e^{x}}\\ \mathbf{else}:\\ \;\;\;\;\left(1 \bmod 1\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= (* (fmod (exp x) (sqrt (cos x))) (exp (- x))) 2.0)
   (/
    (fmod
     (exp x)
     (sqrt (+ (log (pow (cbrt (exp (cos x))) 2.0)) (log (cbrt E)))))
    (exp x))
   (fmod 1.0 1.0)))
double code(double x) {
	double tmp;
	if ((fmod(exp(x), sqrt(cos(x))) * exp(-x)) <= 2.0) {
		tmp = fmod(exp(x), sqrt((log(pow(cbrt(exp(cos(x))), 2.0)) + log(cbrt(((double) M_E)))))) / exp(x);
	} else {
		tmp = fmod(1.0, 1.0);
	}
	return tmp;
}
function code(x)
	tmp = 0.0
	if (Float64(rem(exp(x), sqrt(cos(x))) * exp(Float64(-x))) <= 2.0)
		tmp = Float64(rem(exp(x), sqrt(Float64(log((cbrt(exp(cos(x))) ^ 2.0)) + log(cbrt(exp(1)))))) / exp(x));
	else
		tmp = rem(1.0, 1.0);
	end
	return tmp
end
code[x_] := If[LessEqual[N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], 2.0], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[(N[Log[N[Power[N[Power[N[Exp[N[Cos[x], $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision] + N[Log[N[Power[E, 1/3], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \leq 2:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left({\left(\sqrt[3]{e^{\cos x}}\right)}^{2}\right) + \log \left(\sqrt[3]{e}\right)}\right)\right)}{e^{x}}\\

\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2

    1. Initial program 8.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified8.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-log-exp8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\color{blue}{\log \left(e^{\cos x}\right)}}\right)\right)}{e^{x}} \]
      2. add-cube-cbrt59.1%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \color{blue}{\left(\left(\sqrt[3]{e^{\cos x}} \cdot \sqrt[3]{e^{\cos x}}\right) \cdot \sqrt[3]{e^{\cos x}}\right)}}\right)\right)}{e^{x}} \]
      3. log-prod59.1%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\color{blue}{\log \left(\sqrt[3]{e^{\cos x}} \cdot \sqrt[3]{e^{\cos x}}\right) + \log \left(\sqrt[3]{e^{\cos x}}\right)}}\right)\right)}{e^{x}} \]
      4. pow259.1%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \color{blue}{\left({\left(\sqrt[3]{e^{\cos x}}\right)}^{2}\right)} + \log \left(\sqrt[3]{e^{\cos x}}\right)}\right)\right)}{e^{x}} \]
    6. Applied egg-rr59.1%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\color{blue}{\log \left({\left(\sqrt[3]{e^{\cos x}}\right)}^{2}\right) + \log \left(\sqrt[3]{e^{\cos x}}\right)}}\right)\right)}{e^{x}} \]
    7. Taylor expanded in x around 0 58.6%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left({\left(\sqrt[3]{e^{\cos x}}\right)}^{2}\right) + \log \color{blue}{\left(\sqrt[3]{e^{1}}\right)}}\right)\right)}{e^{x}} \]
    8. Step-by-step derivation
      1. exp-1-e58.6%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left({\left(\sqrt[3]{e^{\cos x}}\right)}^{2}\right) + \log \left(\sqrt[3]{\color{blue}{e}}\right)}\right)\right)}{e^{x}} \]
    9. Simplified58.6%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left({\left(\sqrt[3]{e^{\cos x}}\right)}^{2}\right) + \log \color{blue}{\left(\sqrt[3]{e}\right)}}\right)\right)}{e^{x}} \]

    if 2 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x)))

    1. Initial program 0.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified0.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 0.1%

      \[\leadsto \color{blue}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)} \]
    6. Taylor expanded in x around 0 3.4%

      \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \]
    7. Taylor expanded in x around 0 5.2%

      \[\leadsto \left(1 \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right) \]
    8. Taylor expanded in x around 0 97.9%

      \[\leadsto \left(1 \bmod \color{blue}{1}\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 62.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \leq 2:\\ \;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left(\sqrt[3]{e}\right) + \log \left({\left(\sqrt[3]{e}\right)}^{2}\right)}\right)\right)}{e^{x}}\\ \mathbf{else}:\\ \;\;\;\;\left(1 \bmod 1\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= (* (fmod (exp x) (sqrt (cos x))) (exp (- x))) 2.0)
   (/
    (fmod (exp x) (sqrt (+ (log (cbrt E)) (log (pow (cbrt E) 2.0)))))
    (exp x))
   (fmod 1.0 1.0)))
double code(double x) {
	double tmp;
	if ((fmod(exp(x), sqrt(cos(x))) * exp(-x)) <= 2.0) {
		tmp = fmod(exp(x), sqrt((log(cbrt(((double) M_E))) + log(pow(cbrt(((double) M_E)), 2.0))))) / exp(x);
	} else {
		tmp = fmod(1.0, 1.0);
	}
	return tmp;
}
function code(x)
	tmp = 0.0
	if (Float64(rem(exp(x), sqrt(cos(x))) * exp(Float64(-x))) <= 2.0)
		tmp = Float64(rem(exp(x), sqrt(Float64(log(cbrt(exp(1))) + log((cbrt(exp(1)) ^ 2.0))))) / exp(x));
	else
		tmp = rem(1.0, 1.0);
	end
	return tmp
end
code[x_] := If[LessEqual[N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], 2.0], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[(N[Log[N[Power[E, 1/3], $MachinePrecision]], $MachinePrecision] + N[Log[N[Power[N[Power[E, 1/3], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \leq 2:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left(\sqrt[3]{e}\right) + \log \left({\left(\sqrt[3]{e}\right)}^{2}\right)}\right)\right)}{e^{x}}\\

\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2

    1. Initial program 8.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified8.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-log-exp8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\color{blue}{\log \left(e^{\cos x}\right)}}\right)\right)}{e^{x}} \]
      2. add-cube-cbrt59.1%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \color{blue}{\left(\left(\sqrt[3]{e^{\cos x}} \cdot \sqrt[3]{e^{\cos x}}\right) \cdot \sqrt[3]{e^{\cos x}}\right)}}\right)\right)}{e^{x}} \]
      3. log-prod59.1%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\color{blue}{\log \left(\sqrt[3]{e^{\cos x}} \cdot \sqrt[3]{e^{\cos x}}\right) + \log \left(\sqrt[3]{e^{\cos x}}\right)}}\right)\right)}{e^{x}} \]
      4. pow259.1%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \color{blue}{\left({\left(\sqrt[3]{e^{\cos x}}\right)}^{2}\right)} + \log \left(\sqrt[3]{e^{\cos x}}\right)}\right)\right)}{e^{x}} \]
    6. Applied egg-rr59.1%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\color{blue}{\log \left({\left(\sqrt[3]{e^{\cos x}}\right)}^{2}\right) + \log \left(\sqrt[3]{e^{\cos x}}\right)}}\right)\right)}{e^{x}} \]
    7. Taylor expanded in x around 0 58.6%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left({\left(\sqrt[3]{e^{\cos x}}\right)}^{2}\right) + \log \color{blue}{\left(\sqrt[3]{e^{1}}\right)}}\right)\right)}{e^{x}} \]
    8. Step-by-step derivation
      1. exp-1-e58.6%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left({\left(\sqrt[3]{e^{\cos x}}\right)}^{2}\right) + \log \left(\sqrt[3]{\color{blue}{e}}\right)}\right)\right)}{e^{x}} \]
    9. Simplified58.6%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left({\left(\sqrt[3]{e^{\cos x}}\right)}^{2}\right) + \log \color{blue}{\left(\sqrt[3]{e}\right)}}\right)\right)}{e^{x}} \]
    10. Taylor expanded in x around 0 58.6%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left({\color{blue}{\left(\sqrt[3]{e^{1}}\right)}}^{2}\right) + \log \left(\sqrt[3]{e}\right)}\right)\right)}{e^{x}} \]
    11. Step-by-step derivation
      1. exp-1-e58.6%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left({\left(\sqrt[3]{e^{\cos x}}\right)}^{2}\right) + \log \left(\sqrt[3]{\color{blue}{e}}\right)}\right)\right)}{e^{x}} \]
    12. Simplified58.6%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left({\color{blue}{\left(\sqrt[3]{e}\right)}}^{2}\right) + \log \left(\sqrt[3]{e}\right)}\right)\right)}{e^{x}} \]

    if 2 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x)))

    1. Initial program 0.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified0.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 0.1%

      \[\leadsto \color{blue}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)} \]
    6. Taylor expanded in x around 0 3.4%

      \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \]
    7. Taylor expanded in x around 0 5.2%

      \[\leadsto \left(1 \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right) \]
    8. Taylor expanded in x around 0 97.9%

      \[\leadsto \left(1 \bmod \color{blue}{1}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification65.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \leq 2:\\ \;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left(\sqrt[3]{e}\right) + \log \left({\left(\sqrt[3]{e}\right)}^{2}\right)}\right)\right)}{e^{x}}\\ \mathbf{else}:\\ \;\;\;\;\left(1 \bmod 1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 61.8% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \leq 2:\\ \;\;\;\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left(\sqrt[3]{e}\right) + \log \left({\left(\sqrt[3]{e}\right)}^{2}\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 \bmod 1\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= (* (fmod (exp x) (sqrt (cos x))) (exp (- x))) 2.0)
   (fmod (exp x) (sqrt (+ (log (cbrt E)) (log (pow (cbrt E) 2.0)))))
   (fmod 1.0 1.0)))
double code(double x) {
	double tmp;
	if ((fmod(exp(x), sqrt(cos(x))) * exp(-x)) <= 2.0) {
		tmp = fmod(exp(x), sqrt((log(cbrt(((double) M_E))) + log(pow(cbrt(((double) M_E)), 2.0)))));
	} else {
		tmp = fmod(1.0, 1.0);
	}
	return tmp;
}
function code(x)
	tmp = 0.0
	if (Float64(rem(exp(x), sqrt(cos(x))) * exp(Float64(-x))) <= 2.0)
		tmp = rem(exp(x), sqrt(Float64(log(cbrt(exp(1))) + log((cbrt(exp(1)) ^ 2.0)))));
	else
		tmp = rem(1.0, 1.0);
	end
	return tmp
end
code[x_] := If[LessEqual[N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], 2.0], N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[(N[Log[N[Power[E, 1/3], $MachinePrecision]], $MachinePrecision] + N[Log[N[Power[N[Power[E, 1/3], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \leq 2:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left(\sqrt[3]{e}\right) + \log \left({\left(\sqrt[3]{e}\right)}^{2}\right)}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2

    1. Initial program 8.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified8.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-log-exp8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\color{blue}{\log \left(e^{\cos x}\right)}}\right)\right)}{e^{x}} \]
      2. add-cube-cbrt59.1%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \color{blue}{\left(\left(\sqrt[3]{e^{\cos x}} \cdot \sqrt[3]{e^{\cos x}}\right) \cdot \sqrt[3]{e^{\cos x}}\right)}}\right)\right)}{e^{x}} \]
      3. log-prod59.1%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\color{blue}{\log \left(\sqrt[3]{e^{\cos x}} \cdot \sqrt[3]{e^{\cos x}}\right) + \log \left(\sqrt[3]{e^{\cos x}}\right)}}\right)\right)}{e^{x}} \]
      4. pow259.1%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \color{blue}{\left({\left(\sqrt[3]{e^{\cos x}}\right)}^{2}\right)} + \log \left(\sqrt[3]{e^{\cos x}}\right)}\right)\right)}{e^{x}} \]
    6. Applied egg-rr59.1%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\color{blue}{\log \left({\left(\sqrt[3]{e^{\cos x}}\right)}^{2}\right) + \log \left(\sqrt[3]{e^{\cos x}}\right)}}\right)\right)}{e^{x}} \]
    7. Taylor expanded in x around 0 58.6%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left({\left(\sqrt[3]{e^{\cos x}}\right)}^{2}\right) + \log \color{blue}{\left(\sqrt[3]{e^{1}}\right)}}\right)\right)}{e^{x}} \]
    8. Step-by-step derivation
      1. exp-1-e58.6%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left({\left(\sqrt[3]{e^{\cos x}}\right)}^{2}\right) + \log \left(\sqrt[3]{\color{blue}{e}}\right)}\right)\right)}{e^{x}} \]
    9. Simplified58.6%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left({\left(\sqrt[3]{e^{\cos x}}\right)}^{2}\right) + \log \color{blue}{\left(\sqrt[3]{e}\right)}}\right)\right)}{e^{x}} \]
    10. Taylor expanded in x around 0 58.6%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left({\color{blue}{\left(\sqrt[3]{e^{1}}\right)}}^{2}\right) + \log \left(\sqrt[3]{e}\right)}\right)\right)}{e^{x}} \]
    11. Step-by-step derivation
      1. exp-1-e58.6%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left({\left(\sqrt[3]{e^{\cos x}}\right)}^{2}\right) + \log \left(\sqrt[3]{\color{blue}{e}}\right)}\right)\right)}{e^{x}} \]
    12. Simplified58.6%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left({\color{blue}{\left(\sqrt[3]{e}\right)}}^{2}\right) + \log \left(\sqrt[3]{e}\right)}\right)\right)}{e^{x}} \]
    13. Taylor expanded in x around 0 57.5%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left({\left(\sqrt[3]{e}\right)}^{2}\right) + \log \left(\sqrt[3]{e}\right)}\right)\right)}{\color{blue}{1}} \]

    if 2 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x)))

    1. Initial program 0.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified0.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 0.1%

      \[\leadsto \color{blue}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)} \]
    6. Taylor expanded in x around 0 3.4%

      \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \]
    7. Taylor expanded in x around 0 5.2%

      \[\leadsto \left(1 \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right) \]
    8. Taylor expanded in x around 0 97.9%

      \[\leadsto \left(1 \bmod \color{blue}{1}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification64.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \leq 2:\\ \;\;\;\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left(\sqrt[3]{e}\right) + \log \left({\left(\sqrt[3]{e}\right)}^{2}\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 \bmod 1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 26.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\\ \mathbf{if}\;t\_0 \cdot e^{-x} \leq 2:\\ \;\;\;\;\log \left(e^{\frac{t\_0}{1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 \bmod 1\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (fmod (exp x) (sqrt (cos x)))))
   (if (<= (* t_0 (exp (- x))) 2.0)
     (log
      (exp
       (/ t_0 (+ 1.0 (* x (+ 1.0 (* x (+ 0.5 (* x 0.16666666666666666)))))))))
     (fmod 1.0 1.0))))
double code(double x) {
	double t_0 = fmod(exp(x), sqrt(cos(x)));
	double tmp;
	if ((t_0 * exp(-x)) <= 2.0) {
		tmp = log(exp((t_0 / (1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666)))))))));
	} else {
		tmp = fmod(1.0, 1.0);
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: tmp
    t_0 = mod(exp(x), sqrt(cos(x)))
    if ((t_0 * exp(-x)) <= 2.0d0) then
        tmp = log(exp((t_0 / (1.0d0 + (x * (1.0d0 + (x * (0.5d0 + (x * 0.16666666666666666d0)))))))))
    else
        tmp = mod(1.0d0, 1.0d0)
    end if
    code = tmp
end function
def code(x):
	t_0 = math.fmod(math.exp(x), math.sqrt(math.cos(x)))
	tmp = 0
	if (t_0 * math.exp(-x)) <= 2.0:
		tmp = math.log(math.exp((t_0 / (1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666)))))))))
	else:
		tmp = math.fmod(1.0, 1.0)
	return tmp
function code(x)
	t_0 = rem(exp(x), sqrt(cos(x)))
	tmp = 0.0
	if (Float64(t_0 * exp(Float64(-x))) <= 2.0)
		tmp = log(exp(Float64(t_0 / Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * 0.16666666666666666)))))))));
	else
		tmp = rem(1.0, 1.0);
	end
	return tmp
end
code[x_] := Block[{t$95$0 = N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]}, If[LessEqual[N[(t$95$0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], 2.0], N[Log[N[Exp[N[(t$95$0 / N[(1.0 + N[(x * N[(1.0 + N[(x * N[(0.5 + N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\\
\mathbf{if}\;t\_0 \cdot e^{-x} \leq 2:\\
\;\;\;\;\log \left(e^{\frac{t\_0}{1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}}\right)\\

\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2

    1. Initial program 8.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified8.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-log-exp8.1%

        \[\leadsto \color{blue}{\log \left(e^{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}}\right)} \]
    6. Applied egg-rr8.1%

      \[\leadsto \color{blue}{\log \left(e^{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}}\right)} \]
    7. Taylor expanded in x around 0 8.1%

      \[\leadsto \log \left(e^{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{1 + x \cdot \left(1 + x \cdot \left(0.5 + 0.16666666666666666 \cdot x\right)\right)}}}\right) \]
    8. Step-by-step derivation
      1. *-commutative8.1%

        \[\leadsto \log \left(e^{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1 + x \cdot \left(1 + x \cdot \left(0.5 + \color{blue}{x \cdot 0.16666666666666666}\right)\right)}}\right) \]
    9. Simplified8.1%

      \[\leadsto \log \left(e^{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}}}\right) \]

    if 2 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x)))

    1. Initial program 0.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified0.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 0.1%

      \[\leadsto \color{blue}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)} \]
    6. Taylor expanded in x around 0 3.4%

      \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \]
    7. Taylor expanded in x around 0 5.2%

      \[\leadsto \left(1 \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right) \]
    8. Taylor expanded in x around 0 97.9%

      \[\leadsto \left(1 \bmod \color{blue}{1}\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 26.6% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \leq 2:\\ \;\;\;\;\log \left(e^{\frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{e^{x}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 \bmod 1\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= (* (fmod (exp x) (sqrt (cos x))) (exp (- x))) 2.0)
   (log (exp (/ (fmod (exp x) (+ 1.0 (* -0.25 (pow x 2.0)))) (exp x))))
   (fmod 1.0 1.0)))
double code(double x) {
	double tmp;
	if ((fmod(exp(x), sqrt(cos(x))) * exp(-x)) <= 2.0) {
		tmp = log(exp((fmod(exp(x), (1.0 + (-0.25 * pow(x, 2.0)))) / exp(x))));
	} else {
		tmp = fmod(1.0, 1.0);
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if ((mod(exp(x), sqrt(cos(x))) * exp(-x)) <= 2.0d0) then
        tmp = log(exp((mod(exp(x), (1.0d0 + ((-0.25d0) * (x ** 2.0d0)))) / exp(x))))
    else
        tmp = mod(1.0d0, 1.0d0)
    end if
    code = tmp
end function
def code(x):
	tmp = 0
	if (math.fmod(math.exp(x), math.sqrt(math.cos(x))) * math.exp(-x)) <= 2.0:
		tmp = math.log(math.exp((math.fmod(math.exp(x), (1.0 + (-0.25 * math.pow(x, 2.0)))) / math.exp(x))))
	else:
		tmp = math.fmod(1.0, 1.0)
	return tmp
function code(x)
	tmp = 0.0
	if (Float64(rem(exp(x), sqrt(cos(x))) * exp(Float64(-x))) <= 2.0)
		tmp = log(exp(Float64(rem(exp(x), Float64(1.0 + Float64(-0.25 * (x ^ 2.0)))) / exp(x))));
	else
		tmp = rem(1.0, 1.0);
	end
	return tmp
end
code[x_] := If[LessEqual[N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], 2.0], N[Log[N[Exp[N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(1.0 + N[(-0.25 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \leq 2:\\
\;\;\;\;\log \left(e^{\frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{e^{x}}}\right)\\

\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2

    1. Initial program 8.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified8.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-log-exp8.1%

        \[\leadsto \color{blue}{\log \left(e^{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}}\right)} \]
    6. Applied egg-rr8.1%

      \[\leadsto \color{blue}{\log \left(e^{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}}\right)} \]
    7. Taylor expanded in x around 0 8.1%

      \[\leadsto \log \left(e^{\frac{\left(\left(e^{x}\right) \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right)}{e^{x}}}\right) \]

    if 2 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x)))

    1. Initial program 0.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified0.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 0.1%

      \[\leadsto \color{blue}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)} \]
    6. Taylor expanded in x around 0 3.4%

      \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \]
    7. Taylor expanded in x around 0 5.2%

      \[\leadsto \left(1 \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right) \]
    8. Taylor expanded in x around 0 97.9%

      \[\leadsto \left(1 \bmod \color{blue}{1}\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 8: 26.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \leq 2:\\ \;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left({\left({\cos x}^{0.16666666666666666}\right)}^{3}\right)\right)}{e^{x}}\\ \mathbf{else}:\\ \;\;\;\;\left(1 \bmod 1\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= (* (fmod (exp x) (sqrt (cos x))) (exp (- x))) 2.0)
   (/ (fmod (exp x) (pow (pow (cos x) 0.16666666666666666) 3.0)) (exp x))
   (fmod 1.0 1.0)))
double code(double x) {
	double tmp;
	if ((fmod(exp(x), sqrt(cos(x))) * exp(-x)) <= 2.0) {
		tmp = fmod(exp(x), pow(pow(cos(x), 0.16666666666666666), 3.0)) / exp(x);
	} else {
		tmp = fmod(1.0, 1.0);
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if ((mod(exp(x), sqrt(cos(x))) * exp(-x)) <= 2.0d0) then
        tmp = mod(exp(x), ((cos(x) ** 0.16666666666666666d0) ** 3.0d0)) / exp(x)
    else
        tmp = mod(1.0d0, 1.0d0)
    end if
    code = tmp
end function
def code(x):
	tmp = 0
	if (math.fmod(math.exp(x), math.sqrt(math.cos(x))) * math.exp(-x)) <= 2.0:
		tmp = math.fmod(math.exp(x), math.pow(math.pow(math.cos(x), 0.16666666666666666), 3.0)) / math.exp(x)
	else:
		tmp = math.fmod(1.0, 1.0)
	return tmp
function code(x)
	tmp = 0.0
	if (Float64(rem(exp(x), sqrt(cos(x))) * exp(Float64(-x))) <= 2.0)
		tmp = Float64(rem(exp(x), ((cos(x) ^ 0.16666666666666666) ^ 3.0)) / exp(x));
	else
		tmp = rem(1.0, 1.0);
	end
	return tmp
end
code[x_] := If[LessEqual[N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], 2.0], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Power[N[Power[N[Cos[x], $MachinePrecision], 0.16666666666666666], $MachinePrecision], 3.0], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \leq 2:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left({\left({\cos x}^{0.16666666666666666}\right)}^{3}\right)\right)}{e^{x}}\\

\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2

    1. Initial program 8.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified8.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-cube-cbrt8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \color{blue}{\left(\left(\sqrt[3]{\sqrt{\cos x}} \cdot \sqrt[3]{\sqrt{\cos x}}\right) \cdot \sqrt[3]{\sqrt{\cos x}}\right)}\right)}{e^{x}} \]
      2. associate-*l*8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \color{blue}{\left(\sqrt[3]{\sqrt{\cos x}} \cdot \left(\sqrt[3]{\sqrt{\cos x}} \cdot \sqrt[3]{\sqrt{\cos x}}\right)\right)}\right)}{e^{x}} \]
      3. pow1/38.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\color{blue}{{\left(\sqrt{\cos x}\right)}^{0.3333333333333333}} \cdot \left(\sqrt[3]{\sqrt{\cos x}} \cdot \sqrt[3]{\sqrt{\cos x}}\right)\right)\right)}{e^{x}} \]
      4. pow1/28.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left({\color{blue}{\left({\cos x}^{0.5}\right)}}^{0.3333333333333333} \cdot \left(\sqrt[3]{\sqrt{\cos x}} \cdot \sqrt[3]{\sqrt{\cos x}}\right)\right)\right)}{e^{x}} \]
      5. pow-pow8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\color{blue}{{\cos x}^{\left(0.5 \cdot 0.3333333333333333\right)}} \cdot \left(\sqrt[3]{\sqrt{\cos x}} \cdot \sqrt[3]{\sqrt{\cos x}}\right)\right)\right)}{e^{x}} \]
      6. metadata-eval8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left({\cos x}^{\color{blue}{0.16666666666666666}} \cdot \left(\sqrt[3]{\sqrt{\cos x}} \cdot \sqrt[3]{\sqrt{\cos x}}\right)\right)\right)}{e^{x}} \]
      7. cbrt-prod8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left({\cos x}^{0.16666666666666666} \cdot \color{blue}{\sqrt[3]{\sqrt{\cos x} \cdot \sqrt{\cos x}}}\right)\right)}{e^{x}} \]
      8. add-sqr-sqrt8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left({\cos x}^{0.16666666666666666} \cdot \sqrt[3]{\color{blue}{\cos x}}\right)\right)}{e^{x}} \]
    6. Applied egg-rr8.0%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \color{blue}{\left({\cos x}^{0.16666666666666666} \cdot \sqrt[3]{\cos x}\right)}\right)}{e^{x}} \]
    7. Step-by-step derivation
      1. unpow1/38.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left({\cos x}^{0.16666666666666666} \cdot \color{blue}{{\cos x}^{0.3333333333333333}}\right)\right)}{e^{x}} \]
      2. metadata-eval8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left({\cos x}^{0.16666666666666666} \cdot {\cos x}^{\color{blue}{\left(2 \cdot 0.16666666666666666\right)}}\right)\right)}{e^{x}} \]
      3. pow-sqr8.1%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left({\cos x}^{0.16666666666666666} \cdot \color{blue}{\left({\cos x}^{0.16666666666666666} \cdot {\cos x}^{0.16666666666666666}\right)}\right)\right)}{e^{x}} \]
      4. cube-mult8.1%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \color{blue}{\left({\left({\cos x}^{0.16666666666666666}\right)}^{3}\right)}\right)}{e^{x}} \]
    8. Simplified8.1%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \color{blue}{\left({\left({\cos x}^{0.16666666666666666}\right)}^{3}\right)}\right)}{e^{x}} \]

    if 2 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x)))

    1. Initial program 0.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified0.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 0.1%

      \[\leadsto \color{blue}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)} \]
    6. Taylor expanded in x around 0 3.4%

      \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \]
    7. Taylor expanded in x around 0 5.2%

      \[\leadsto \left(1 \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right) \]
    8. Taylor expanded in x around 0 97.9%

      \[\leadsto \left(1 \bmod \color{blue}{1}\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 26.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\\ \mathbf{if}\;t\_0 \cdot e^{-x} \leq 2:\\ \;\;\;\;\frac{t\_0}{1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(1 \bmod 1\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (fmod (exp x) (sqrt (cos x)))))
   (if (<= (* t_0 (exp (- x))) 2.0)
     (/ t_0 (+ 1.0 (* x (+ 1.0 (* x (+ 0.5 (* x 0.16666666666666666)))))))
     (fmod 1.0 1.0))))
double code(double x) {
	double t_0 = fmod(exp(x), sqrt(cos(x)));
	double tmp;
	if ((t_0 * exp(-x)) <= 2.0) {
		tmp = t_0 / (1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))));
	} else {
		tmp = fmod(1.0, 1.0);
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: tmp
    t_0 = mod(exp(x), sqrt(cos(x)))
    if ((t_0 * exp(-x)) <= 2.0d0) then
        tmp = t_0 / (1.0d0 + (x * (1.0d0 + (x * (0.5d0 + (x * 0.16666666666666666d0))))))
    else
        tmp = mod(1.0d0, 1.0d0)
    end if
    code = tmp
end function
def code(x):
	t_0 = math.fmod(math.exp(x), math.sqrt(math.cos(x)))
	tmp = 0
	if (t_0 * math.exp(-x)) <= 2.0:
		tmp = t_0 / (1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))))
	else:
		tmp = math.fmod(1.0, 1.0)
	return tmp
function code(x)
	t_0 = rem(exp(x), sqrt(cos(x)))
	tmp = 0.0
	if (Float64(t_0 * exp(Float64(-x))) <= 2.0)
		tmp = Float64(t_0 / Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * 0.16666666666666666)))))));
	else
		tmp = rem(1.0, 1.0);
	end
	return tmp
end
code[x_] := Block[{t$95$0 = N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]}, If[LessEqual[N[(t$95$0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], 2.0], N[(t$95$0 / N[(1.0 + N[(x * N[(1.0 + N[(x * N[(0.5 + N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\\
\mathbf{if}\;t\_0 \cdot e^{-x} \leq 2:\\
\;\;\;\;\frac{t\_0}{1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2

    1. Initial program 8.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified8.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 8.0%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{1 + x \cdot \left(1 + x \cdot \left(0.5 + 0.16666666666666666 \cdot x\right)\right)}} \]
    6. Step-by-step derivation
      1. *-commutative8.1%

        \[\leadsto \log \left(e^{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1 + x \cdot \left(1 + x \cdot \left(0.5 + \color{blue}{x \cdot 0.16666666666666666}\right)\right)}}\right) \]
    7. Simplified8.0%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}} \]

    if 2 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x)))

    1. Initial program 0.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified0.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 0.1%

      \[\leadsto \color{blue}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)} \]
    6. Taylor expanded in x around 0 3.4%

      \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \]
    7. Taylor expanded in x around 0 5.2%

      \[\leadsto \left(1 \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right) \]
    8. Taylor expanded in x around 0 97.9%

      \[\leadsto \left(1 \bmod \color{blue}{1}\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 26.3% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 20:\\ \;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(1 \bmod 1\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 20.0)
   (/
    (fmod (exp x) (+ 1.0 (* -0.25 (pow x 2.0))))
    (+ 1.0 (* x (+ 1.0 (* x (+ 0.5 (* x 0.16666666666666666)))))))
   (fmod 1.0 1.0)))
double code(double x) {
	double tmp;
	if (x <= 20.0) {
		tmp = fmod(exp(x), (1.0 + (-0.25 * pow(x, 2.0)))) / (1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))));
	} else {
		tmp = fmod(1.0, 1.0);
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 20.0d0) then
        tmp = mod(exp(x), (1.0d0 + ((-0.25d0) * (x ** 2.0d0)))) / (1.0d0 + (x * (1.0d0 + (x * (0.5d0 + (x * 0.16666666666666666d0))))))
    else
        tmp = mod(1.0d0, 1.0d0)
    end if
    code = tmp
end function
def code(x):
	tmp = 0
	if x <= 20.0:
		tmp = math.fmod(math.exp(x), (1.0 + (-0.25 * math.pow(x, 2.0)))) / (1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))))
	else:
		tmp = math.fmod(1.0, 1.0)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 20.0)
		tmp = Float64(rem(exp(x), Float64(1.0 + Float64(-0.25 * (x ^ 2.0)))) / Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * 0.16666666666666666)))))));
	else
		tmp = rem(1.0, 1.0);
	end
	return tmp
end
code[x_] := If[LessEqual[x, 20.0], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(1.0 + N[(-0.25 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[(1.0 + N[(x * N[(1.0 + N[(x * N[(0.5 + N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 20:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 20

    1. Initial program 8.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified8.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 8.0%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right)}{e^{x}} \]
    6. Taylor expanded in x around 0 8.0%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{\color{blue}{1 + x \cdot \left(1 + x \cdot \left(0.5 + 0.16666666666666666 \cdot x\right)\right)}} \]
    7. Step-by-step derivation
      1. *-commutative8.1%

        \[\leadsto \log \left(e^{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1 + x \cdot \left(1 + x \cdot \left(0.5 + \color{blue}{x \cdot 0.16666666666666666}\right)\right)}}\right) \]
    8. Simplified8.0%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{\color{blue}{1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}} \]

    if 20 < x

    1. Initial program 0.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified0.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 0.0%

      \[\leadsto \color{blue}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)} \]
    6. Taylor expanded in x around 0 3.1%

      \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \]
    7. Taylor expanded in x around 0 3.1%

      \[\leadsto \left(1 \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right) \]
    8. Taylor expanded in x around 0 100.0%

      \[\leadsto \left(1 \bmod \color{blue}{1}\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 26.6% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 20:\\ \;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot \left(x \cdot x\right)\right)\right)}{e^{x}}\\ \mathbf{else}:\\ \;\;\;\;\left(1 \bmod 1\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 20.0)
   (/ (fmod (exp x) (+ 1.0 (* -0.25 (* x x)))) (exp x))
   (fmod 1.0 1.0)))
double code(double x) {
	double tmp;
	if (x <= 20.0) {
		tmp = fmod(exp(x), (1.0 + (-0.25 * (x * x)))) / exp(x);
	} else {
		tmp = fmod(1.0, 1.0);
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 20.0d0) then
        tmp = mod(exp(x), (1.0d0 + ((-0.25d0) * (x * x)))) / exp(x)
    else
        tmp = mod(1.0d0, 1.0d0)
    end if
    code = tmp
end function
def code(x):
	tmp = 0
	if x <= 20.0:
		tmp = math.fmod(math.exp(x), (1.0 + (-0.25 * (x * x)))) / math.exp(x)
	else:
		tmp = math.fmod(1.0, 1.0)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 20.0)
		tmp = Float64(rem(exp(x), Float64(1.0 + Float64(-0.25 * Float64(x * x)))) / exp(x));
	else
		tmp = rem(1.0, 1.0);
	end
	return tmp
end
code[x_] := If[LessEqual[x, 20.0], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(1.0 + N[(-0.25 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 20:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot \left(x \cdot x\right)\right)\right)}{e^{x}}\\

\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 20

    1. Initial program 8.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified8.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 8.0%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right)}{e^{x}} \]
    6. Step-by-step derivation
      1. unpow28.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot \color{blue}{\left(x \cdot x\right)}\right)\right)}{e^{x}} \]
    7. Applied egg-rr8.0%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot \color{blue}{\left(x \cdot x\right)}\right)\right)}{e^{x}} \]

    if 20 < x

    1. Initial program 0.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified0.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 0.0%

      \[\leadsto \color{blue}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)} \]
    6. Taylor expanded in x around 0 3.1%

      \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \]
    7. Taylor expanded in x around 0 3.1%

      \[\leadsto \left(1 \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right) \]
    8. Taylor expanded in x around 0 100.0%

      \[\leadsto \left(1 \bmod \color{blue}{1}\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 12: 26.2% accurate, 2.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 20:\\ \;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot \left(x \cdot x\right)\right)\right)}{1 + x \cdot \left(1 + x \cdot 0.5\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(1 \bmod 1\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 20.0)
   (/ (fmod (exp x) (+ 1.0 (* -0.25 (* x x)))) (+ 1.0 (* x (+ 1.0 (* x 0.5)))))
   (fmod 1.0 1.0)))
double code(double x) {
	double tmp;
	if (x <= 20.0) {
		tmp = fmod(exp(x), (1.0 + (-0.25 * (x * x)))) / (1.0 + (x * (1.0 + (x * 0.5))));
	} else {
		tmp = fmod(1.0, 1.0);
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 20.0d0) then
        tmp = mod(exp(x), (1.0d0 + ((-0.25d0) * (x * x)))) / (1.0d0 + (x * (1.0d0 + (x * 0.5d0))))
    else
        tmp = mod(1.0d0, 1.0d0)
    end if
    code = tmp
end function
def code(x):
	tmp = 0
	if x <= 20.0:
		tmp = math.fmod(math.exp(x), (1.0 + (-0.25 * (x * x)))) / (1.0 + (x * (1.0 + (x * 0.5))))
	else:
		tmp = math.fmod(1.0, 1.0)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 20.0)
		tmp = Float64(rem(exp(x), Float64(1.0 + Float64(-0.25 * Float64(x * x)))) / Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * 0.5)))));
	else
		tmp = rem(1.0, 1.0);
	end
	return tmp
end
code[x_] := If[LessEqual[x, 20.0], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(1.0 + N[(-0.25 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[(1.0 + N[(x * N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 20:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot \left(x \cdot x\right)\right)\right)}{1 + x \cdot \left(1 + x \cdot 0.5\right)}\\

\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 20

    1. Initial program 8.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified8.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 8.0%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right)}{e^{x}} \]
    6. Taylor expanded in x around 0 7.9%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{\color{blue}{1 + x \cdot \left(1 + 0.5 \cdot x\right)}} \]
    7. Step-by-step derivation
      1. *-commutative7.9%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{1 + x \cdot \left(1 + \color{blue}{x \cdot 0.5}\right)} \]
    8. Simplified7.9%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{\color{blue}{1 + x \cdot \left(1 + x \cdot 0.5\right)}} \]
    9. Step-by-step derivation
      1. unpow28.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot \color{blue}{\left(x \cdot x\right)}\right)\right)}{e^{x}} \]
    10. Applied egg-rr7.9%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot \color{blue}{\left(x \cdot x\right)}\right)\right)}{1 + x \cdot \left(1 + x \cdot 0.5\right)} \]

    if 20 < x

    1. Initial program 0.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified0.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 0.0%

      \[\leadsto \color{blue}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)} \]
    6. Taylor expanded in x around 0 3.1%

      \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \]
    7. Taylor expanded in x around 0 3.1%

      \[\leadsto \left(1 \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right) \]
    8. Taylor expanded in x around 0 100.0%

      \[\leadsto \left(1 \bmod \color{blue}{1}\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 13: 26.6% accurate, 2.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 20:\\ \;\;\;\;\frac{\left(\left(x + 1\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\left(1 \bmod 1\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 20.0)
   (/ (fmod (+ x 1.0) (+ 1.0 (* -0.25 (pow x 2.0)))) (+ x 1.0))
   (fmod 1.0 1.0)))
double code(double x) {
	double tmp;
	if (x <= 20.0) {
		tmp = fmod((x + 1.0), (1.0 + (-0.25 * pow(x, 2.0)))) / (x + 1.0);
	} else {
		tmp = fmod(1.0, 1.0);
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 20.0d0) then
        tmp = mod((x + 1.0d0), (1.0d0 + ((-0.25d0) * (x ** 2.0d0)))) / (x + 1.0d0)
    else
        tmp = mod(1.0d0, 1.0d0)
    end if
    code = tmp
end function
def code(x):
	tmp = 0
	if x <= 20.0:
		tmp = math.fmod((x + 1.0), (1.0 + (-0.25 * math.pow(x, 2.0)))) / (x + 1.0)
	else:
		tmp = math.fmod(1.0, 1.0)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 20.0)
		tmp = Float64(rem(Float64(x + 1.0), Float64(1.0 + Float64(-0.25 * (x ^ 2.0)))) / Float64(x + 1.0));
	else
		tmp = rem(1.0, 1.0);
	end
	return tmp
end
code[x_] := If[LessEqual[x, 20.0], N[(N[With[{TMP1 = N[(x + 1.0), $MachinePrecision], TMP2 = N[(1.0 + N[(-0.25 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 20:\\
\;\;\;\;\frac{\left(\left(x + 1\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{x + 1}\\

\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 20

    1. Initial program 8.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified8.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 8.0%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right)}{e^{x}} \]
    6. Taylor expanded in x around 0 7.5%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{\color{blue}{1 + x}} \]
    7. Step-by-step derivation
      1. +-commutative7.5%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{\color{blue}{x + 1}} \]
    8. Simplified7.5%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{\color{blue}{x + 1}} \]
    9. Taylor expanded in x around 0 7.9%

      \[\leadsto \frac{\left(\color{blue}{\left(1 + x\right)} \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{x + 1} \]
    10. Step-by-step derivation
      1. +-commutative7.5%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{\color{blue}{x + 1}} \]
    11. Simplified7.9%

      \[\leadsto \frac{\left(\color{blue}{\left(x + 1\right)} \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{x + 1} \]

    if 20 < x

    1. Initial program 0.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified0.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 0.0%

      \[\leadsto \color{blue}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)} \]
    6. Taylor expanded in x around 0 3.1%

      \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \]
    7. Taylor expanded in x around 0 3.1%

      \[\leadsto \left(1 \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right) \]
    8. Taylor expanded in x around 0 100.0%

      \[\leadsto \left(1 \bmod \color{blue}{1}\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 14: 25.9% accurate, 2.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 20:\\ \;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot \left(x \cdot x\right)\right)\right)}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\left(1 \bmod 1\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 20.0)
   (/ (fmod (exp x) (+ 1.0 (* -0.25 (* x x)))) (+ x 1.0))
   (fmod 1.0 1.0)))
double code(double x) {
	double tmp;
	if (x <= 20.0) {
		tmp = fmod(exp(x), (1.0 + (-0.25 * (x * x)))) / (x + 1.0);
	} else {
		tmp = fmod(1.0, 1.0);
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 20.0d0) then
        tmp = mod(exp(x), (1.0d0 + ((-0.25d0) * (x * x)))) / (x + 1.0d0)
    else
        tmp = mod(1.0d0, 1.0d0)
    end if
    code = tmp
end function
def code(x):
	tmp = 0
	if x <= 20.0:
		tmp = math.fmod(math.exp(x), (1.0 + (-0.25 * (x * x)))) / (x + 1.0)
	else:
		tmp = math.fmod(1.0, 1.0)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 20.0)
		tmp = Float64(rem(exp(x), Float64(1.0 + Float64(-0.25 * Float64(x * x)))) / Float64(x + 1.0));
	else
		tmp = rem(1.0, 1.0);
	end
	return tmp
end
code[x_] := If[LessEqual[x, 20.0], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(1.0 + N[(-0.25 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 20:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot \left(x \cdot x\right)\right)\right)}{x + 1}\\

\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 20

    1. Initial program 8.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified8.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 8.0%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right)}{e^{x}} \]
    6. Taylor expanded in x around 0 7.5%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{\color{blue}{1 + x}} \]
    7. Step-by-step derivation
      1. +-commutative7.5%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{\color{blue}{x + 1}} \]
    8. Simplified7.5%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{\color{blue}{x + 1}} \]
    9. Step-by-step derivation
      1. unpow28.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot \color{blue}{\left(x \cdot x\right)}\right)\right)}{e^{x}} \]
    10. Applied egg-rr7.5%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot \color{blue}{\left(x \cdot x\right)}\right)\right)}{x + 1} \]

    if 20 < x

    1. Initial program 0.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified0.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 0.0%

      \[\leadsto \color{blue}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)} \]
    6. Taylor expanded in x around 0 3.1%

      \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \]
    7. Taylor expanded in x around 0 3.1%

      \[\leadsto \left(1 \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right) \]
    8. Taylor expanded in x around 0 100.0%

      \[\leadsto \left(1 \bmod \color{blue}{1}\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 15: 25.9% accurate, 2.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 20:\\ \;\;\;\;\frac{\left(\left(e^{x}\right) \bmod 1\right)}{1 + x \cdot \left(1 + x \cdot 0.5\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(1 \bmod 1\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 20.0)
   (/ (fmod (exp x) 1.0) (+ 1.0 (* x (+ 1.0 (* x 0.5)))))
   (fmod 1.0 1.0)))
double code(double x) {
	double tmp;
	if (x <= 20.0) {
		tmp = fmod(exp(x), 1.0) / (1.0 + (x * (1.0 + (x * 0.5))));
	} else {
		tmp = fmod(1.0, 1.0);
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 20.0d0) then
        tmp = mod(exp(x), 1.0d0) / (1.0d0 + (x * (1.0d0 + (x * 0.5d0))))
    else
        tmp = mod(1.0d0, 1.0d0)
    end if
    code = tmp
end function
def code(x):
	tmp = 0
	if x <= 20.0:
		tmp = math.fmod(math.exp(x), 1.0) / (1.0 + (x * (1.0 + (x * 0.5))))
	else:
		tmp = math.fmod(1.0, 1.0)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 20.0)
		tmp = Float64(rem(exp(x), 1.0) / Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * 0.5)))));
	else
		tmp = rem(1.0, 1.0);
	end
	return tmp
end
code[x_] := If[LessEqual[x, 20.0], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[(1.0 + N[(x * N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 20:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod 1\right)}{1 + x \cdot \left(1 + x \cdot 0.5\right)}\\

\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 20

    1. Initial program 8.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/8.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg8.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified8.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 8.0%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right)}{e^{x}} \]
    6. Taylor expanded in x around 0 7.9%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{\color{blue}{1 + x \cdot \left(1 + 0.5 \cdot x\right)}} \]
    7. Step-by-step derivation
      1. *-commutative7.9%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{1 + x \cdot \left(1 + \color{blue}{x \cdot 0.5}\right)} \]
    8. Simplified7.9%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{\color{blue}{1 + x \cdot \left(1 + x \cdot 0.5\right)}} \]
    9. Taylor expanded in x around 0 7.4%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \color{blue}{1}\right)}{1 + x \cdot \left(1 + x \cdot 0.5\right)} \]

    if 20 < x

    1. Initial program 0.0%

      \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    2. Step-by-step derivation
      1. /-rgt-identity0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
      2. associate-/r/0.0%

        \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
      3. exp-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
      4. remove-double-neg0.0%

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
    3. Simplified0.0%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 0.0%

      \[\leadsto \color{blue}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)} \]
    6. Taylor expanded in x around 0 3.1%

      \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \]
    7. Taylor expanded in x around 0 3.1%

      \[\leadsto \left(1 \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right) \]
    8. Taylor expanded in x around 0 100.0%

      \[\leadsto \left(1 \bmod \color{blue}{1}\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 16: 23.2% accurate, 5.0× speedup?

\[\begin{array}{l} \\ \left(1 \bmod 1\right) \end{array} \]
(FPCore (x) :precision binary64 (fmod 1.0 1.0))
double code(double x) {
	return fmod(1.0, 1.0);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = mod(1.0d0, 1.0d0)
end function
def code(x):
	return math.fmod(1.0, 1.0)
function code(x)
	return rem(1.0, 1.0)
end
code[x_] := N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]
\begin{array}{l}

\\
\left(1 \bmod 1\right)
\end{array}
Derivation
  1. Initial program 6.6%

    \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
  2. Step-by-step derivation
    1. /-rgt-identity6.6%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{1}} \cdot e^{-x} \]
    2. associate-/r/6.6%

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\frac{1}{e^{-x}}}} \]
    3. exp-neg6.6%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{\color{blue}{e^{-\left(-x\right)}}} \]
    4. remove-double-neg6.6%

      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
  3. Simplified6.6%

    \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
  4. Add Preprocessing
  5. Taylor expanded in x around 0 5.3%

    \[\leadsto \color{blue}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)} \]
  6. Taylor expanded in x around 0 4.1%

    \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \]
  7. Taylor expanded in x around 0 4.5%

    \[\leadsto \left(1 \bmod \color{blue}{\left(1 + -0.25 \cdot {x}^{2}\right)}\right) \]
  8. Taylor expanded in x around 0 20.9%

    \[\leadsto \left(1 \bmod \color{blue}{1}\right) \]
  9. Add Preprocessing

Reproduce

?
herbie shell --seed 2024165 
(FPCore (x)
  :name "expfmod (used to be hard to sample)"
  :precision binary64
  (* (fmod (exp x) (sqrt (cos x))) (exp (- x))))