expfmod (used to be hard to sample)

Percentage Accurate: 7.3% → 61.9%
Time: 20.3s
Alternatives: 6
Speedup: 505.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 6 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: 7.3% 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: 61.9% accurate, 4.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-310}:\\
\;\;\;\;1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.999999999999985e-310

    1. Initial program 13.5%

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

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

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot 1}{\color{blue}{e^{x}}} \]
      3. *-rgt-identityN/A

        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right), \color{blue}{\left(e^{x}\right)}\right) \]
      5. fmod-lowering-fmod.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\left(e^{x}\right), \left(\sqrt{\cos x}\right)\right), \left(e^{\color{blue}{x}}\right)\right) \]
      6. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\cos x}\right)\right), \left(e^{x}\right)\right) \]
      7. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\cos x\right)\right), \left(e^{x}\right)\right) \]
      8. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \left(e^{x}\right)\right) \]
      9. exp-lowering-exp.f6413.5%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \mathsf{exp.f64}\left(x\right)\right) \]
    3. Simplified13.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. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}}} \]
      2. inv-powN/A

        \[\leadsto {\left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)}^{\color{blue}{-1}} \]
      3. pow-to-expN/A

        \[\leadsto e^{\log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right) \cdot -1} \]
      4. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right) \cdot -1\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 \cdot \log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)\right)\right) \]
      7. log-divN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \left(\log \left(e^{x}\right) - \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
      8. rem-log-expN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \left(x - \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
      9. --lowering--.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
      10. log-lowering-log.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
      11. fmod-lowering-fmod.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\left(e^{x}\right), \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
      12. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
      13. pow1/2N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left({\cos x}^{\frac{1}{2}}\right)\right)\right)\right)\right)\right) \]
      14. pow-lowering-pow.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{pow.f64}\left(\cos x, \frac{1}{2}\right)\right)\right)\right)\right)\right) \]
      15. cos-lowering-cos.f6413.5%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{cos.f64}\left(x\right), \frac{1}{2}\right)\right)\right)\right)\right)\right) \]
    6. Applied egg-rr13.5%

      \[\leadsto \color{blue}{e^{-1 \cdot \left(x - \log \left(\left(e^{x}\right) \bmod \left({\cos x}^{0.5}\right)\right)\right)}} \]
    7. Taylor expanded in x around inf

      \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot x\right)}\right) \]
    8. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(x\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - x\right)\right) \]
      3. --lowering--.f6494.7%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, x\right)\right) \]
    9. Simplified94.7%

      \[\leadsto e^{\color{blue}{0 - x}} \]
    10. Taylor expanded in x around 0

      \[\leadsto \color{blue}{1} \]
    11. Step-by-step derivation
      1. Simplified100.0%

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

      if -4.999999999999985e-310 < x

      1. Initial program 6.3%

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

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

          \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot 1}{\color{blue}{e^{x}}} \]
        3. *-rgt-identityN/A

          \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
        4. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right), \color{blue}{\left(e^{x}\right)}\right) \]
        5. fmod-lowering-fmod.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\left(e^{x}\right), \left(\sqrt{\cos x}\right)\right), \left(e^{\color{blue}{x}}\right)\right) \]
        6. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\cos x}\right)\right), \left(e^{x}\right)\right) \]
        7. sqrt-lowering-sqrt.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\cos x\right)\right), \left(e^{x}\right)\right) \]
        8. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \left(e^{x}\right)\right) \]
        9. exp-lowering-exp.f646.3%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \mathsf{exp.f64}\left(x\right)\right) \]
      3. Simplified6.3%

        \[\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

        \[\leadsto \color{blue}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)} \]
      6. Step-by-step derivation
        1. fmod-lowering-fmod.f64N/A

          \[\leadsto \mathsf{fmod.f64}\left(\left(e^{x}\right), \color{blue}{\left(\sqrt{\cos x}\right)}\right) \]
        2. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\color{blue}{\cos x}}\right)\right) \]
        3. sqrt-lowering-sqrt.f64N/A

          \[\leadsto \mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\cos x\right)\right) \]
        4. cos-lowering-cos.f645.3%

          \[\leadsto \mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right) \]
      7. Simplified5.3%

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

        \[\leadsto \mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \color{blue}{1}\right) \]
      9. Step-by-step derivation
        1. Simplified5.4%

          \[\leadsto \left(\left(e^{x}\right) \bmod \color{blue}{1}\right) \]
        2. Taylor expanded in x around 0

          \[\leadsto \mathsf{fmod.f64}\left(\color{blue}{\left(1 + x\right)}, 1\right) \]
        3. Step-by-step derivation
          1. +-lowering-+.f6435.3%

            \[\leadsto \mathsf{fmod.f64}\left(\mathsf{+.f64}\left(1, x\right), 1\right) \]
        4. Simplified35.3%

          \[\leadsto \left(\color{blue}{\left(1 + x\right)} \bmod 1\right) \]
      10. Recombined 2 regimes into one program.
      11. Final simplification63.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{-310}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\left(\left(x + 1\right) \bmod 1\right)\\ \end{array} \]
      12. Add Preprocessing

      Alternative 2: 61.9% accurate, 4.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{-16}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;e^{0 - x}\\ \end{array} \end{array} \]
      (FPCore (x) :precision binary64 (if (<= x -1e-16) 1.0 (exp (- 0.0 x))))
      double code(double x) {
      	double tmp;
      	if (x <= -1e-16) {
      		tmp = 1.0;
      	} else {
      		tmp = exp((0.0 - x));
      	}
      	return tmp;
      }
      
      real(8) function code(x)
          real(8), intent (in) :: x
          real(8) :: tmp
          if (x <= (-1d-16)) then
              tmp = 1.0d0
          else
              tmp = exp((0.0d0 - x))
          end if
          code = tmp
      end function
      
      public static double code(double x) {
      	double tmp;
      	if (x <= -1e-16) {
      		tmp = 1.0;
      	} else {
      		tmp = Math.exp((0.0 - x));
      	}
      	return tmp;
      }
      
      def code(x):
      	tmp = 0
      	if x <= -1e-16:
      		tmp = 1.0
      	else:
      		tmp = math.exp((0.0 - x))
      	return tmp
      
      function code(x)
      	tmp = 0.0
      	if (x <= -1e-16)
      		tmp = 1.0;
      	else
      		tmp = exp(Float64(0.0 - x));
      	end
      	return tmp
      end
      
      function tmp_2 = code(x)
      	tmp = 0.0;
      	if (x <= -1e-16)
      		tmp = 1.0;
      	else
      		tmp = exp((0.0 - x));
      	end
      	tmp_2 = tmp;
      end
      
      code[x_] := If[LessEqual[x, -1e-16], 1.0, N[Exp[N[(0.0 - x), $MachinePrecision]], $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;x \leq -1 \cdot 10^{-16}:\\
      \;\;\;\;1\\
      
      \mathbf{else}:\\
      \;\;\;\;e^{0 - x}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if x < -9.9999999999999998e-17

        1. Initial program 99.7%

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

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

            \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot 1}{\color{blue}{e^{x}}} \]
          3. *-rgt-identityN/A

            \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
          4. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right), \color{blue}{\left(e^{x}\right)}\right) \]
          5. fmod-lowering-fmod.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\left(e^{x}\right), \left(\sqrt{\cos x}\right)\right), \left(e^{\color{blue}{x}}\right)\right) \]
          6. exp-lowering-exp.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\cos x}\right)\right), \left(e^{x}\right)\right) \]
          7. sqrt-lowering-sqrt.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\cos x\right)\right), \left(e^{x}\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \left(e^{x}\right)\right) \]
          9. exp-lowering-exp.f64100.0%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \mathsf{exp.f64}\left(x\right)\right) \]
        3. Simplified100.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. clear-numN/A

            \[\leadsto \frac{1}{\color{blue}{\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}}} \]
          2. inv-powN/A

            \[\leadsto {\left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)}^{\color{blue}{-1}} \]
          3. pow-to-expN/A

            \[\leadsto e^{\log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right) \cdot -1} \]
          4. exp-lowering-exp.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\left(\log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right) \cdot -1\right)\right) \]
          5. *-commutativeN/A

            \[\leadsto \mathsf{exp.f64}\left(\left(-1 \cdot \log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)\right)\right) \]
          6. *-lowering-*.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)\right)\right) \]
          7. log-divN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \left(\log \left(e^{x}\right) - \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
          8. rem-log-expN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \left(x - \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
          9. --lowering--.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
          10. log-lowering-log.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
          11. fmod-lowering-fmod.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\left(e^{x}\right), \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
          12. exp-lowering-exp.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
          13. pow1/2N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left({\cos x}^{\frac{1}{2}}\right)\right)\right)\right)\right)\right) \]
          14. pow-lowering-pow.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{pow.f64}\left(\cos x, \frac{1}{2}\right)\right)\right)\right)\right)\right) \]
          15. cos-lowering-cos.f64100.0%

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{cos.f64}\left(x\right), \frac{1}{2}\right)\right)\right)\right)\right)\right) \]
        6. Applied egg-rr100.0%

          \[\leadsto \color{blue}{e^{-1 \cdot \left(x - \log \left(\left(e^{x}\right) \bmod \left({\cos x}^{0.5}\right)\right)\right)}} \]
        7. Taylor expanded in x around inf

          \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot x\right)}\right) \]
        8. Step-by-step derivation
          1. mul-1-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(x\right)\right)\right) \]
          2. neg-sub0N/A

            \[\leadsto \mathsf{exp.f64}\left(\left(0 - x\right)\right) \]
          3. --lowering--.f6450.2%

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, x\right)\right) \]
        9. Simplified50.2%

          \[\leadsto e^{\color{blue}{0 - x}} \]
        10. Taylor expanded in x around 0

          \[\leadsto \color{blue}{1} \]
        11. Step-by-step derivation
          1. Simplified100.0%

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

          if -9.9999999999999998e-17 < x

          1. Initial program 5.0%

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

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

              \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot 1}{\color{blue}{e^{x}}} \]
            3. *-rgt-identityN/A

              \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
            4. /-lowering-/.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right), \color{blue}{\left(e^{x}\right)}\right) \]
            5. fmod-lowering-fmod.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\left(e^{x}\right), \left(\sqrt{\cos x}\right)\right), \left(e^{\color{blue}{x}}\right)\right) \]
            6. exp-lowering-exp.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\cos x}\right)\right), \left(e^{x}\right)\right) \]
            7. sqrt-lowering-sqrt.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\cos x\right)\right), \left(e^{x}\right)\right) \]
            8. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \left(e^{x}\right)\right) \]
            9. exp-lowering-exp.f645.0%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \mathsf{exp.f64}\left(x\right)\right) \]
          3. Simplified5.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. clear-numN/A

              \[\leadsto \frac{1}{\color{blue}{\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}}} \]
            2. inv-powN/A

              \[\leadsto {\left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)}^{\color{blue}{-1}} \]
            3. pow-to-expN/A

              \[\leadsto e^{\log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right) \cdot -1} \]
            4. exp-lowering-exp.f64N/A

              \[\leadsto \mathsf{exp.f64}\left(\left(\log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right) \cdot -1\right)\right) \]
            5. *-commutativeN/A

              \[\leadsto \mathsf{exp.f64}\left(\left(-1 \cdot \log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)\right)\right) \]
            6. *-lowering-*.f64N/A

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)\right)\right) \]
            7. log-divN/A

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \left(\log \left(e^{x}\right) - \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
            8. rem-log-expN/A

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \left(x - \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
            9. --lowering--.f64N/A

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
            10. log-lowering-log.f64N/A

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
            11. fmod-lowering-fmod.f64N/A

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\left(e^{x}\right), \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
            12. exp-lowering-exp.f64N/A

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
            13. pow1/2N/A

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left({\cos x}^{\frac{1}{2}}\right)\right)\right)\right)\right)\right) \]
            14. pow-lowering-pow.f64N/A

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{pow.f64}\left(\cos x, \frac{1}{2}\right)\right)\right)\right)\right)\right) \]
            15. cos-lowering-cos.f645.0%

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{cos.f64}\left(x\right), \frac{1}{2}\right)\right)\right)\right)\right)\right) \]
          6. Applied egg-rr5.0%

            \[\leadsto \color{blue}{e^{-1 \cdot \left(x - \log \left(\left(e^{x}\right) \bmod \left({\cos x}^{0.5}\right)\right)\right)}} \]
          7. Taylor expanded in x around inf

            \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot x\right)}\right) \]
          8. Step-by-step derivation
            1. mul-1-negN/A

              \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(x\right)\right)\right) \]
            2. neg-sub0N/A

              \[\leadsto \mathsf{exp.f64}\left(\left(0 - x\right)\right) \]
            3. --lowering--.f6460.8%

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, x\right)\right) \]
          9. Simplified60.8%

            \[\leadsto e^{\color{blue}{0 - x}} \]
        12. Recombined 2 regimes into one program.
        13. Add Preprocessing

        Alternative 3: 61.8% accurate, 4.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.0001:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\left(1 \bmod 1\right)\\ \end{array} \end{array} \]
        (FPCore (x) :precision binary64 (if (<= x 0.0001) 1.0 (fmod 1.0 1.0)))
        double code(double x) {
        	double tmp;
        	if (x <= 0.0001) {
        		tmp = 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 <= 0.0001d0) then
                tmp = 1.0d0
            else
                tmp = mod(1.0d0, 1.0d0)
            end if
            code = tmp
        end function
        
        def code(x):
        	tmp = 0
        	if x <= 0.0001:
        		tmp = 1.0
        	else:
        		tmp = math.fmod(1.0, 1.0)
        	return tmp
        
        function code(x)
        	tmp = 0.0
        	if (x <= 0.0001)
        		tmp = 1.0;
        	else
        		tmp = rem(1.0, 1.0);
        	end
        	return tmp
        end
        
        code[x_] := If[LessEqual[x, 0.0001], 1.0, 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 0.0001:\\
        \;\;\;\;1\\
        
        \mathbf{else}:\\
        \;\;\;\;\left(1 \bmod 1\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if x < 1.00000000000000005e-4

          1. Initial program 11.3%

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

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

              \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot 1}{\color{blue}{e^{x}}} \]
            3. *-rgt-identityN/A

              \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
            4. /-lowering-/.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right), \color{blue}{\left(e^{x}\right)}\right) \]
            5. fmod-lowering-fmod.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\left(e^{x}\right), \left(\sqrt{\cos x}\right)\right), \left(e^{\color{blue}{x}}\right)\right) \]
            6. exp-lowering-exp.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\cos x}\right)\right), \left(e^{x}\right)\right) \]
            7. sqrt-lowering-sqrt.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\cos x\right)\right), \left(e^{x}\right)\right) \]
            8. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \left(e^{x}\right)\right) \]
            9. exp-lowering-exp.f6411.3%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \mathsf{exp.f64}\left(x\right)\right) \]
          3. Simplified11.3%

            \[\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. clear-numN/A

              \[\leadsto \frac{1}{\color{blue}{\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}}} \]
            2. inv-powN/A

              \[\leadsto {\left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)}^{\color{blue}{-1}} \]
            3. pow-to-expN/A

              \[\leadsto e^{\log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right) \cdot -1} \]
            4. exp-lowering-exp.f64N/A

              \[\leadsto \mathsf{exp.f64}\left(\left(\log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right) \cdot -1\right)\right) \]
            5. *-commutativeN/A

              \[\leadsto \mathsf{exp.f64}\left(\left(-1 \cdot \log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)\right)\right) \]
            6. *-lowering-*.f64N/A

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)\right)\right) \]
            7. log-divN/A

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \left(\log \left(e^{x}\right) - \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
            8. rem-log-expN/A

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \left(x - \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
            9. --lowering--.f64N/A

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
            10. log-lowering-log.f64N/A

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
            11. fmod-lowering-fmod.f64N/A

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\left(e^{x}\right), \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
            12. exp-lowering-exp.f64N/A

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
            13. pow1/2N/A

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left({\cos x}^{\frac{1}{2}}\right)\right)\right)\right)\right)\right) \]
            14. pow-lowering-pow.f64N/A

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{pow.f64}\left(\cos x, \frac{1}{2}\right)\right)\right)\right)\right)\right) \]
            15. cos-lowering-cos.f6411.3%

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{cos.f64}\left(x\right), \frac{1}{2}\right)\right)\right)\right)\right)\right) \]
          6. Applied egg-rr11.3%

            \[\leadsto \color{blue}{e^{-1 \cdot \left(x - \log \left(\left(e^{x}\right) \bmod \left({\cos x}^{0.5}\right)\right)\right)}} \]
          7. Taylor expanded in x around inf

            \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot x\right)}\right) \]
          8. Step-by-step derivation
            1. mul-1-negN/A

              \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(x\right)\right)\right) \]
            2. neg-sub0N/A

              \[\leadsto \mathsf{exp.f64}\left(\left(0 - x\right)\right) \]
            3. --lowering--.f6452.3%

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, x\right)\right) \]
          9. Simplified52.3%

            \[\leadsto e^{\color{blue}{0 - x}} \]
          10. Taylor expanded in x around 0

            \[\leadsto \color{blue}{1} \]
          11. Step-by-step derivation
            1. Simplified55.1%

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

            if 1.00000000000000005e-4 < 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. exp-negN/A

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

                \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot 1}{\color{blue}{e^{x}}} \]
              3. *-rgt-identityN/A

                \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
              4. /-lowering-/.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right), \color{blue}{\left(e^{x}\right)}\right) \]
              5. fmod-lowering-fmod.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\left(e^{x}\right), \left(\sqrt{\cos x}\right)\right), \left(e^{\color{blue}{x}}\right)\right) \]
              6. exp-lowering-exp.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\cos x}\right)\right), \left(e^{x}\right)\right) \]
              7. sqrt-lowering-sqrt.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\cos x\right)\right), \left(e^{x}\right)\right) \]
              8. cos-lowering-cos.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \left(e^{x}\right)\right) \]
              9. exp-lowering-exp.f640.0%

                \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \mathsf{exp.f64}\left(x\right)\right) \]
            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

              \[\leadsto \color{blue}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)} \]
            6. Step-by-step derivation
              1. fmod-lowering-fmod.f64N/A

                \[\leadsto \mathsf{fmod.f64}\left(\left(e^{x}\right), \color{blue}{\left(\sqrt{\cos x}\right)}\right) \]
              2. exp-lowering-exp.f64N/A

                \[\leadsto \mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\color{blue}{\cos x}}\right)\right) \]
              3. sqrt-lowering-sqrt.f64N/A

                \[\leadsto \mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\cos x\right)\right) \]
              4. cos-lowering-cos.f640.0%

                \[\leadsto \mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right) \]
            7. Simplified0.0%

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

              \[\leadsto \mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \color{blue}{1}\right) \]
            9. Step-by-step derivation
              1. Simplified0.0%

                \[\leadsto \left(\left(e^{x}\right) \bmod \color{blue}{1}\right) \]
              2. Taylor expanded in x around 0

                \[\leadsto \mathsf{fmod.f64}\left(\color{blue}{1}, 1\right) \]
              3. Step-by-step derivation
                1. Simplified100.0%

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

              Alternative 4: 47.8% accurate, 9.5× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(x + 1\right)\\ t_1 := x \cdot \left(x \cdot x\right)\\ \mathbf{if}\;x \leq 5 \cdot 10^{+50}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 4 \cdot 10^{+76}:\\ \;\;\;\;\frac{1 - t\_1}{1 + t\_0 \cdot \left(t\_0 \cdot t\_0\right)} \cdot \left(1 + t\_0 \cdot \left(t\_0 + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x \cdot x}{1 + t\_1} \cdot \left(1 + x \cdot \left(x + -1\right)\right)\\ \end{array} \end{array} \]
              (FPCore (x)
               :precision binary64
               (let* ((t_0 (* x (+ x 1.0))) (t_1 (* x (* x x))))
                 (if (<= x 5e+50)
                   1.0
                   (if (<= x 4e+76)
                     (*
                      (/ (- 1.0 t_1) (+ 1.0 (* t_0 (* t_0 t_0))))
                      (+ 1.0 (* t_0 (+ t_0 -1.0))))
                     (* (/ (- 1.0 (* x x)) (+ 1.0 t_1)) (+ 1.0 (* x (+ x -1.0))))))))
              double code(double x) {
              	double t_0 = x * (x + 1.0);
              	double t_1 = x * (x * x);
              	double tmp;
              	if (x <= 5e+50) {
              		tmp = 1.0;
              	} else if (x <= 4e+76) {
              		tmp = ((1.0 - t_1) / (1.0 + (t_0 * (t_0 * t_0)))) * (1.0 + (t_0 * (t_0 + -1.0)));
              	} else {
              		tmp = ((1.0 - (x * x)) / (1.0 + t_1)) * (1.0 + (x * (x + -1.0)));
              	}
              	return tmp;
              }
              
              real(8) function code(x)
                  real(8), intent (in) :: x
                  real(8) :: t_0
                  real(8) :: t_1
                  real(8) :: tmp
                  t_0 = x * (x + 1.0d0)
                  t_1 = x * (x * x)
                  if (x <= 5d+50) then
                      tmp = 1.0d0
                  else if (x <= 4d+76) then
                      tmp = ((1.0d0 - t_1) / (1.0d0 + (t_0 * (t_0 * t_0)))) * (1.0d0 + (t_0 * (t_0 + (-1.0d0))))
                  else
                      tmp = ((1.0d0 - (x * x)) / (1.0d0 + t_1)) * (1.0d0 + (x * (x + (-1.0d0))))
                  end if
                  code = tmp
              end function
              
              public static double code(double x) {
              	double t_0 = x * (x + 1.0);
              	double t_1 = x * (x * x);
              	double tmp;
              	if (x <= 5e+50) {
              		tmp = 1.0;
              	} else if (x <= 4e+76) {
              		tmp = ((1.0 - t_1) / (1.0 + (t_0 * (t_0 * t_0)))) * (1.0 + (t_0 * (t_0 + -1.0)));
              	} else {
              		tmp = ((1.0 - (x * x)) / (1.0 + t_1)) * (1.0 + (x * (x + -1.0)));
              	}
              	return tmp;
              }
              
              def code(x):
              	t_0 = x * (x + 1.0)
              	t_1 = x * (x * x)
              	tmp = 0
              	if x <= 5e+50:
              		tmp = 1.0
              	elif x <= 4e+76:
              		tmp = ((1.0 - t_1) / (1.0 + (t_0 * (t_0 * t_0)))) * (1.0 + (t_0 * (t_0 + -1.0)))
              	else:
              		tmp = ((1.0 - (x * x)) / (1.0 + t_1)) * (1.0 + (x * (x + -1.0)))
              	return tmp
              
              function code(x)
              	t_0 = Float64(x * Float64(x + 1.0))
              	t_1 = Float64(x * Float64(x * x))
              	tmp = 0.0
              	if (x <= 5e+50)
              		tmp = 1.0;
              	elseif (x <= 4e+76)
              		tmp = Float64(Float64(Float64(1.0 - t_1) / Float64(1.0 + Float64(t_0 * Float64(t_0 * t_0)))) * Float64(1.0 + Float64(t_0 * Float64(t_0 + -1.0))));
              	else
              		tmp = Float64(Float64(Float64(1.0 - Float64(x * x)) / Float64(1.0 + t_1)) * Float64(1.0 + Float64(x * Float64(x + -1.0))));
              	end
              	return tmp
              end
              
              function tmp_2 = code(x)
              	t_0 = x * (x + 1.0);
              	t_1 = x * (x * x);
              	tmp = 0.0;
              	if (x <= 5e+50)
              		tmp = 1.0;
              	elseif (x <= 4e+76)
              		tmp = ((1.0 - t_1) / (1.0 + (t_0 * (t_0 * t_0)))) * (1.0 + (t_0 * (t_0 + -1.0)));
              	else
              		tmp = ((1.0 - (x * x)) / (1.0 + t_1)) * (1.0 + (x * (x + -1.0)));
              	end
              	tmp_2 = tmp;
              end
              
              code[x_] := Block[{t$95$0 = N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 5e+50], 1.0, If[LessEqual[x, 4e+76], N[(N[(N[(1.0 - t$95$1), $MachinePrecision] / N[(1.0 + N[(t$95$0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(t$95$0 * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(x * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := x \cdot \left(x + 1\right)\\
              t_1 := x \cdot \left(x \cdot x\right)\\
              \mathbf{if}\;x \leq 5 \cdot 10^{+50}:\\
              \;\;\;\;1\\
              
              \mathbf{elif}\;x \leq 4 \cdot 10^{+76}:\\
              \;\;\;\;\frac{1 - t\_1}{1 + t\_0 \cdot \left(t\_0 \cdot t\_0\right)} \cdot \left(1 + t\_0 \cdot \left(t\_0 + -1\right)\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{1 - x \cdot x}{1 + t\_1} \cdot \left(1 + x \cdot \left(x + -1\right)\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if x < 5e50

                1. Initial program 11.0%

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

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

                    \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot 1}{\color{blue}{e^{x}}} \]
                  3. *-rgt-identityN/A

                    \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
                  4. /-lowering-/.f64N/A

                    \[\leadsto \mathsf{/.f64}\left(\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right), \color{blue}{\left(e^{x}\right)}\right) \]
                  5. fmod-lowering-fmod.f64N/A

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\left(e^{x}\right), \left(\sqrt{\cos x}\right)\right), \left(e^{\color{blue}{x}}\right)\right) \]
                  6. exp-lowering-exp.f64N/A

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\cos x}\right)\right), \left(e^{x}\right)\right) \]
                  7. sqrt-lowering-sqrt.f64N/A

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\cos x\right)\right), \left(e^{x}\right)\right) \]
                  8. cos-lowering-cos.f64N/A

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \left(e^{x}\right)\right) \]
                  9. exp-lowering-exp.f6411.0%

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \mathsf{exp.f64}\left(x\right)\right) \]
                3. Simplified11.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. clear-numN/A

                    \[\leadsto \frac{1}{\color{blue}{\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}}} \]
                  2. inv-powN/A

                    \[\leadsto {\left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)}^{\color{blue}{-1}} \]
                  3. pow-to-expN/A

                    \[\leadsto e^{\log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right) \cdot -1} \]
                  4. exp-lowering-exp.f64N/A

                    \[\leadsto \mathsf{exp.f64}\left(\left(\log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right) \cdot -1\right)\right) \]
                  5. *-commutativeN/A

                    \[\leadsto \mathsf{exp.f64}\left(\left(-1 \cdot \log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)\right)\right) \]
                  6. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)\right)\right) \]
                  7. log-divN/A

                    \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \left(\log \left(e^{x}\right) - \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
                  8. rem-log-expN/A

                    \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \left(x - \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
                  9. --lowering--.f64N/A

                    \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
                  10. log-lowering-log.f64N/A

                    \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
                  11. fmod-lowering-fmod.f64N/A

                    \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\left(e^{x}\right), \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
                  12. exp-lowering-exp.f64N/A

                    \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
                  13. pow1/2N/A

                    \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left({\cos x}^{\frac{1}{2}}\right)\right)\right)\right)\right)\right) \]
                  14. pow-lowering-pow.f64N/A

                    \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{pow.f64}\left(\cos x, \frac{1}{2}\right)\right)\right)\right)\right)\right) \]
                  15. cos-lowering-cos.f6411.0%

                    \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{cos.f64}\left(x\right), \frac{1}{2}\right)\right)\right)\right)\right)\right) \]
                6. Applied egg-rr11.0%

                  \[\leadsto \color{blue}{e^{-1 \cdot \left(x - \log \left(\left(e^{x}\right) \bmod \left({\cos x}^{0.5}\right)\right)\right)}} \]
                7. Taylor expanded in x around inf

                  \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot x\right)}\right) \]
                8. Step-by-step derivation
                  1. mul-1-negN/A

                    \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(x\right)\right)\right) \]
                  2. neg-sub0N/A

                    \[\leadsto \mathsf{exp.f64}\left(\left(0 - x\right)\right) \]
                  3. --lowering--.f6453.6%

                    \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, x\right)\right) \]
                9. Simplified53.6%

                  \[\leadsto e^{\color{blue}{0 - x}} \]
                10. Taylor expanded in x around 0

                  \[\leadsto \color{blue}{1} \]
                11. Step-by-step derivation
                  1. Simplified53.7%

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

                  if 5e50 < x < 4.0000000000000002e76

                  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. exp-negN/A

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

                      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot 1}{\color{blue}{e^{x}}} \]
                    3. *-rgt-identityN/A

                      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
                    4. /-lowering-/.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right), \color{blue}{\left(e^{x}\right)}\right) \]
                    5. fmod-lowering-fmod.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\left(e^{x}\right), \left(\sqrt{\cos x}\right)\right), \left(e^{\color{blue}{x}}\right)\right) \]
                    6. exp-lowering-exp.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\cos x}\right)\right), \left(e^{x}\right)\right) \]
                    7. sqrt-lowering-sqrt.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\cos x\right)\right), \left(e^{x}\right)\right) \]
                    8. cos-lowering-cos.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \left(e^{x}\right)\right) \]
                    9. exp-lowering-exp.f640.0%

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \mathsf{exp.f64}\left(x\right)\right) \]
                  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. Step-by-step derivation
                    1. clear-numN/A

                      \[\leadsto \frac{1}{\color{blue}{\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}}} \]
                    2. inv-powN/A

                      \[\leadsto {\left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)}^{\color{blue}{-1}} \]
                    3. pow-to-expN/A

                      \[\leadsto e^{\log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right) \cdot -1} \]
                    4. exp-lowering-exp.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\left(\log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right) \cdot -1\right)\right) \]
                    5. *-commutativeN/A

                      \[\leadsto \mathsf{exp.f64}\left(\left(-1 \cdot \log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)\right)\right) \]
                    6. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)\right)\right) \]
                    7. log-divN/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \left(\log \left(e^{x}\right) - \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
                    8. rem-log-expN/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \left(x - \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
                    9. --lowering--.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
                    10. log-lowering-log.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
                    11. fmod-lowering-fmod.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\left(e^{x}\right), \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
                    12. exp-lowering-exp.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
                    13. pow1/2N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left({\cos x}^{\frac{1}{2}}\right)\right)\right)\right)\right)\right) \]
                    14. pow-lowering-pow.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{pow.f64}\left(\cos x, \frac{1}{2}\right)\right)\right)\right)\right)\right) \]
                    15. cos-lowering-cos.f640.0%

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{cos.f64}\left(x\right), \frac{1}{2}\right)\right)\right)\right)\right)\right) \]
                  6. Applied egg-rr0.0%

                    \[\leadsto \color{blue}{e^{-1 \cdot \left(x - \log \left(\left(e^{x}\right) \bmod \left({\cos x}^{0.5}\right)\right)\right)}} \]
                  7. Taylor expanded in x around inf

                    \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot x\right)}\right) \]
                  8. Step-by-step derivation
                    1. mul-1-negN/A

                      \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(x\right)\right)\right) \]
                    2. neg-sub0N/A

                      \[\leadsto \mathsf{exp.f64}\left(\left(0 - x\right)\right) \]
                    3. --lowering--.f64100.0%

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, x\right)\right) \]
                  9. Simplified100.0%

                    \[\leadsto e^{\color{blue}{0 - x}} \]
                  10. Taylor expanded in x around 0

                    \[\leadsto \color{blue}{1 + -1 \cdot x} \]
                  11. Step-by-step derivation
                    1. neg-mul-1N/A

                      \[\leadsto 1 + \left(\mathsf{neg}\left(x\right)\right) \]
                    2. unsub-negN/A

                      \[\leadsto 1 - \color{blue}{x} \]
                    3. --lowering--.f642.7%

                      \[\leadsto \mathsf{\_.f64}\left(1, \color{blue}{x}\right) \]
                  12. Simplified2.7%

                    \[\leadsto \color{blue}{1 - x} \]
                  13. Applied egg-rr100.0%

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

                  if 4.0000000000000002e76 < 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. exp-negN/A

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

                      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot 1}{\color{blue}{e^{x}}} \]
                    3. *-rgt-identityN/A

                      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
                    4. /-lowering-/.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right), \color{blue}{\left(e^{x}\right)}\right) \]
                    5. fmod-lowering-fmod.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\left(e^{x}\right), \left(\sqrt{\cos x}\right)\right), \left(e^{\color{blue}{x}}\right)\right) \]
                    6. exp-lowering-exp.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\cos x}\right)\right), \left(e^{x}\right)\right) \]
                    7. sqrt-lowering-sqrt.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\cos x\right)\right), \left(e^{x}\right)\right) \]
                    8. cos-lowering-cos.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \left(e^{x}\right)\right) \]
                    9. exp-lowering-exp.f640.0%

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \mathsf{exp.f64}\left(x\right)\right) \]
                  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. Step-by-step derivation
                    1. clear-numN/A

                      \[\leadsto \frac{1}{\color{blue}{\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}}} \]
                    2. inv-powN/A

                      \[\leadsto {\left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)}^{\color{blue}{-1}} \]
                    3. pow-to-expN/A

                      \[\leadsto e^{\log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right) \cdot -1} \]
                    4. exp-lowering-exp.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\left(\log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right) \cdot -1\right)\right) \]
                    5. *-commutativeN/A

                      \[\leadsto \mathsf{exp.f64}\left(\left(-1 \cdot \log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)\right)\right) \]
                    6. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)\right)\right) \]
                    7. log-divN/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \left(\log \left(e^{x}\right) - \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
                    8. rem-log-expN/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \left(x - \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
                    9. --lowering--.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
                    10. log-lowering-log.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
                    11. fmod-lowering-fmod.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\left(e^{x}\right), \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
                    12. exp-lowering-exp.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
                    13. pow1/2N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left({\cos x}^{\frac{1}{2}}\right)\right)\right)\right)\right)\right) \]
                    14. pow-lowering-pow.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{pow.f64}\left(\cos x, \frac{1}{2}\right)\right)\right)\right)\right)\right) \]
                    15. cos-lowering-cos.f640.0%

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{cos.f64}\left(x\right), \frac{1}{2}\right)\right)\right)\right)\right)\right) \]
                  6. Applied egg-rr0.0%

                    \[\leadsto \color{blue}{e^{-1 \cdot \left(x - \log \left(\left(e^{x}\right) \bmod \left({\cos x}^{0.5}\right)\right)\right)}} \]
                  7. Taylor expanded in x around inf

                    \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot x\right)}\right) \]
                  8. Step-by-step derivation
                    1. mul-1-negN/A

                      \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(x\right)\right)\right) \]
                    2. neg-sub0N/A

                      \[\leadsto \mathsf{exp.f64}\left(\left(0 - x\right)\right) \]
                    3. --lowering--.f64100.0%

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, x\right)\right) \]
                  9. Simplified100.0%

                    \[\leadsto e^{\color{blue}{0 - x}} \]
                  10. Taylor expanded in x around 0

                    \[\leadsto \color{blue}{1 + -1 \cdot x} \]
                  11. Step-by-step derivation
                    1. neg-mul-1N/A

                      \[\leadsto 1 + \left(\mathsf{neg}\left(x\right)\right) \]
                    2. unsub-negN/A

                      \[\leadsto 1 - \color{blue}{x} \]
                    3. --lowering--.f642.0%

                      \[\leadsto \mathsf{\_.f64}\left(1, \color{blue}{x}\right) \]
                  12. Simplified2.0%

                    \[\leadsto \color{blue}{1 - x} \]
                  13. Step-by-step derivation
                    1. flip--N/A

                      \[\leadsto \frac{1 \cdot 1 - x \cdot x}{\color{blue}{1 + x}} \]
                    2. +-commutativeN/A

                      \[\leadsto \frac{1 \cdot 1 - x \cdot x}{x + \color{blue}{1}} \]
                    3. flip3-+N/A

                      \[\leadsto \frac{1 \cdot 1 - x \cdot x}{\frac{{x}^{3} + {1}^{3}}{\color{blue}{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)}}} \]
                    4. associate-/r/N/A

                      \[\leadsto \frac{1 \cdot 1 - x \cdot x}{{x}^{3} + {1}^{3}} \cdot \color{blue}{\left(x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)\right)} \]
                    5. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\left(\frac{1 \cdot 1 - x \cdot x}{{x}^{3} + {1}^{3}}\right), \color{blue}{\left(x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)\right)}\right) \]
                    6. /-lowering-/.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(1 \cdot 1 - x \cdot x\right), \left({x}^{3} + {1}^{3}\right)\right), \left(\color{blue}{x \cdot x} + \left(1 \cdot 1 - x \cdot 1\right)\right)\right) \]
                    7. metadata-evalN/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(1 - x \cdot x\right), \left({x}^{3} + {1}^{3}\right)\right), \left(x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)\right)\right) \]
                    8. --lowering--.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \left(x \cdot x\right)\right), \left({x}^{3} + {1}^{3}\right)\right), \left(\color{blue}{x} \cdot x + \left(1 \cdot 1 - x \cdot 1\right)\right)\right) \]
                    9. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \left({x}^{3} + {1}^{3}\right)\right), \left(x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)\right)\right) \]
                    10. metadata-evalN/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \left({x}^{3} + 1\right)\right), \left(x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)\right)\right) \]
                    11. +-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \left(1 + {x}^{3}\right)\right), \left(x \cdot \color{blue}{x} + \left(1 \cdot 1 - x \cdot 1\right)\right)\right) \]
                    12. +-lowering-+.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(1, \left({x}^{3}\right)\right)\right), \left(x \cdot \color{blue}{x} + \left(1 \cdot 1 - x \cdot 1\right)\right)\right) \]
                    13. cube-multN/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(1, \left(x \cdot \left(x \cdot x\right)\right)\right)\right), \left(x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)\right)\right) \]
                    14. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(x \cdot x\right)\right)\right)\right), \left(x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)\right)\right) \]
                    15. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right)\right), \left(x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)\right)\right) \]
                    16. metadata-evalN/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right)\right), \left(x \cdot x + \left(1 - \color{blue}{x} \cdot 1\right)\right)\right) \]
                    17. *-rgt-identityN/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right)\right), \left(x \cdot x + \left(1 - x\right)\right)\right) \]
                    18. associate-+r-N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right)\right), \left(\left(x \cdot x + 1\right) - \color{blue}{x}\right)\right) \]
                    19. +-commutativeN/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right)\right), \left(\left(1 + x \cdot x\right) - x\right)\right) \]
                    20. associate-+r-N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right)\right), \left(1 + \color{blue}{\left(x \cdot x - x\right)}\right)\right) \]
                    21. +-lowering-+.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(x \cdot x - x\right)}\right)\right) \]
                  14. Applied egg-rr16.9%

                    \[\leadsto \color{blue}{\frac{1 - x \cdot x}{1 + x \cdot \left(x \cdot x\right)} \cdot \left(1 + x \cdot \left(x + -1\right)\right)} \]
                12. Recombined 3 regimes into one program.
                13. Final simplification50.7%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 5 \cdot 10^{+50}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 4 \cdot 10^{+76}:\\ \;\;\;\;\frac{1 - x \cdot \left(x \cdot x\right)}{1 + \left(x \cdot \left(x + 1\right)\right) \cdot \left(\left(x \cdot \left(x + 1\right)\right) \cdot \left(x \cdot \left(x + 1\right)\right)\right)} \cdot \left(1 + \left(x \cdot \left(x + 1\right)\right) \cdot \left(x \cdot \left(x + 1\right) + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x \cdot x}{1 + x \cdot \left(x \cdot x\right)} \cdot \left(1 + x \cdot \left(x + -1\right)\right)\\ \end{array} \]
                14. Add Preprocessing

                Alternative 5: 46.3% accurate, 19.4× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 10^{+99}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x \cdot x}{1 + x \cdot \left(x \cdot x\right)} \cdot \left(1 + x \cdot \left(x + -1\right)\right)\\ \end{array} \end{array} \]
                (FPCore (x)
                 :precision binary64
                 (if (<= x 1e+99)
                   1.0
                   (* (/ (- 1.0 (* x x)) (+ 1.0 (* x (* x x)))) (+ 1.0 (* x (+ x -1.0))))))
                double code(double x) {
                	double tmp;
                	if (x <= 1e+99) {
                		tmp = 1.0;
                	} else {
                		tmp = ((1.0 - (x * x)) / (1.0 + (x * (x * x)))) * (1.0 + (x * (x + -1.0)));
                	}
                	return tmp;
                }
                
                real(8) function code(x)
                    real(8), intent (in) :: x
                    real(8) :: tmp
                    if (x <= 1d+99) then
                        tmp = 1.0d0
                    else
                        tmp = ((1.0d0 - (x * x)) / (1.0d0 + (x * (x * x)))) * (1.0d0 + (x * (x + (-1.0d0))))
                    end if
                    code = tmp
                end function
                
                public static double code(double x) {
                	double tmp;
                	if (x <= 1e+99) {
                		tmp = 1.0;
                	} else {
                		tmp = ((1.0 - (x * x)) / (1.0 + (x * (x * x)))) * (1.0 + (x * (x + -1.0)));
                	}
                	return tmp;
                }
                
                def code(x):
                	tmp = 0
                	if x <= 1e+99:
                		tmp = 1.0
                	else:
                		tmp = ((1.0 - (x * x)) / (1.0 + (x * (x * x)))) * (1.0 + (x * (x + -1.0)))
                	return tmp
                
                function code(x)
                	tmp = 0.0
                	if (x <= 1e+99)
                		tmp = 1.0;
                	else
                		tmp = Float64(Float64(Float64(1.0 - Float64(x * x)) / Float64(1.0 + Float64(x * Float64(x * x)))) * Float64(1.0 + Float64(x * Float64(x + -1.0))));
                	end
                	return tmp
                end
                
                function tmp_2 = code(x)
                	tmp = 0.0;
                	if (x <= 1e+99)
                		tmp = 1.0;
                	else
                		tmp = ((1.0 - (x * x)) / (1.0 + (x * (x * x)))) * (1.0 + (x * (x + -1.0)));
                	end
                	tmp_2 = tmp;
                end
                
                code[x_] := If[LessEqual[x, 1e+99], 1.0, N[(N[(N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(x * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;x \leq 10^{+99}:\\
                \;\;\;\;1\\
                
                \mathbf{else}:\\
                \;\;\;\;\frac{1 - x \cdot x}{1 + x \cdot \left(x \cdot x\right)} \cdot \left(1 + x \cdot \left(x + -1\right)\right)\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if x < 9.9999999999999997e98

                  1. Initial program 10.5%

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

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

                      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot 1}{\color{blue}{e^{x}}} \]
                    3. *-rgt-identityN/A

                      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
                    4. /-lowering-/.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right), \color{blue}{\left(e^{x}\right)}\right) \]
                    5. fmod-lowering-fmod.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\left(e^{x}\right), \left(\sqrt{\cos x}\right)\right), \left(e^{\color{blue}{x}}\right)\right) \]
                    6. exp-lowering-exp.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\cos x}\right)\right), \left(e^{x}\right)\right) \]
                    7. sqrt-lowering-sqrt.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\cos x\right)\right), \left(e^{x}\right)\right) \]
                    8. cos-lowering-cos.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \left(e^{x}\right)\right) \]
                    9. exp-lowering-exp.f6410.5%

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \mathsf{exp.f64}\left(x\right)\right) \]
                  3. Simplified10.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. clear-numN/A

                      \[\leadsto \frac{1}{\color{blue}{\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}}} \]
                    2. inv-powN/A

                      \[\leadsto {\left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)}^{\color{blue}{-1}} \]
                    3. pow-to-expN/A

                      \[\leadsto e^{\log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right) \cdot -1} \]
                    4. exp-lowering-exp.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\left(\log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right) \cdot -1\right)\right) \]
                    5. *-commutativeN/A

                      \[\leadsto \mathsf{exp.f64}\left(\left(-1 \cdot \log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)\right)\right) \]
                    6. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)\right)\right) \]
                    7. log-divN/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \left(\log \left(e^{x}\right) - \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
                    8. rem-log-expN/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \left(x - \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
                    9. --lowering--.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
                    10. log-lowering-log.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
                    11. fmod-lowering-fmod.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\left(e^{x}\right), \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
                    12. exp-lowering-exp.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
                    13. pow1/2N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left({\cos x}^{\frac{1}{2}}\right)\right)\right)\right)\right)\right) \]
                    14. pow-lowering-pow.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{pow.f64}\left(\cos x, \frac{1}{2}\right)\right)\right)\right)\right)\right) \]
                    15. cos-lowering-cos.f6410.5%

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{cos.f64}\left(x\right), \frac{1}{2}\right)\right)\right)\right)\right)\right) \]
                  6. Applied egg-rr10.5%

                    \[\leadsto \color{blue}{e^{-1 \cdot \left(x - \log \left(\left(e^{x}\right) \bmod \left({\cos x}^{0.5}\right)\right)\right)}} \]
                  7. Taylor expanded in x around inf

                    \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot x\right)}\right) \]
                  8. Step-by-step derivation
                    1. mul-1-negN/A

                      \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(x\right)\right)\right) \]
                    2. neg-sub0N/A

                      \[\leadsto \mathsf{exp.f64}\left(\left(0 - x\right)\right) \]
                    3. --lowering--.f6455.7%

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, x\right)\right) \]
                  9. Simplified55.7%

                    \[\leadsto e^{\color{blue}{0 - x}} \]
                  10. Taylor expanded in x around 0

                    \[\leadsto \color{blue}{1} \]
                  11. Step-by-step derivation
                    1. Simplified51.5%

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

                    if 9.9999999999999997e98 < 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. exp-negN/A

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

                        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot 1}{\color{blue}{e^{x}}} \]
                      3. *-rgt-identityN/A

                        \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
                      4. /-lowering-/.f64N/A

                        \[\leadsto \mathsf{/.f64}\left(\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right), \color{blue}{\left(e^{x}\right)}\right) \]
                      5. fmod-lowering-fmod.f64N/A

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\left(e^{x}\right), \left(\sqrt{\cos x}\right)\right), \left(e^{\color{blue}{x}}\right)\right) \]
                      6. exp-lowering-exp.f64N/A

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\cos x}\right)\right), \left(e^{x}\right)\right) \]
                      7. sqrt-lowering-sqrt.f64N/A

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\cos x\right)\right), \left(e^{x}\right)\right) \]
                      8. cos-lowering-cos.f64N/A

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \left(e^{x}\right)\right) \]
                      9. exp-lowering-exp.f640.0%

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \mathsf{exp.f64}\left(x\right)\right) \]
                    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. Step-by-step derivation
                      1. clear-numN/A

                        \[\leadsto \frac{1}{\color{blue}{\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}}} \]
                      2. inv-powN/A

                        \[\leadsto {\left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)}^{\color{blue}{-1}} \]
                      3. pow-to-expN/A

                        \[\leadsto e^{\log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right) \cdot -1} \]
                      4. exp-lowering-exp.f64N/A

                        \[\leadsto \mathsf{exp.f64}\left(\left(\log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right) \cdot -1\right)\right) \]
                      5. *-commutativeN/A

                        \[\leadsto \mathsf{exp.f64}\left(\left(-1 \cdot \log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)\right)\right) \]
                      6. *-lowering-*.f64N/A

                        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)\right)\right) \]
                      7. log-divN/A

                        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \left(\log \left(e^{x}\right) - \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
                      8. rem-log-expN/A

                        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \left(x - \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
                      9. --lowering--.f64N/A

                        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
                      10. log-lowering-log.f64N/A

                        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
                      11. fmod-lowering-fmod.f64N/A

                        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\left(e^{x}\right), \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
                      12. exp-lowering-exp.f64N/A

                        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
                      13. pow1/2N/A

                        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left({\cos x}^{\frac{1}{2}}\right)\right)\right)\right)\right)\right) \]
                      14. pow-lowering-pow.f64N/A

                        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{pow.f64}\left(\cos x, \frac{1}{2}\right)\right)\right)\right)\right)\right) \]
                      15. cos-lowering-cos.f640.0%

                        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{cos.f64}\left(x\right), \frac{1}{2}\right)\right)\right)\right)\right)\right) \]
                    6. Applied egg-rr0.0%

                      \[\leadsto \color{blue}{e^{-1 \cdot \left(x - \log \left(\left(e^{x}\right) \bmod \left({\cos x}^{0.5}\right)\right)\right)}} \]
                    7. Taylor expanded in x around inf

                      \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot x\right)}\right) \]
                    8. Step-by-step derivation
                      1. mul-1-negN/A

                        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(x\right)\right)\right) \]
                      2. neg-sub0N/A

                        \[\leadsto \mathsf{exp.f64}\left(\left(0 - x\right)\right) \]
                      3. --lowering--.f64100.0%

                        \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, x\right)\right) \]
                    9. Simplified100.0%

                      \[\leadsto e^{\color{blue}{0 - x}} \]
                    10. Taylor expanded in x around 0

                      \[\leadsto \color{blue}{1 + -1 \cdot x} \]
                    11. Step-by-step derivation
                      1. neg-mul-1N/A

                        \[\leadsto 1 + \left(\mathsf{neg}\left(x\right)\right) \]
                      2. unsub-negN/A

                        \[\leadsto 1 - \color{blue}{x} \]
                      3. --lowering--.f641.9%

                        \[\leadsto \mathsf{\_.f64}\left(1, \color{blue}{x}\right) \]
                    12. Simplified1.9%

                      \[\leadsto \color{blue}{1 - x} \]
                    13. Step-by-step derivation
                      1. flip--N/A

                        \[\leadsto \frac{1 \cdot 1 - x \cdot x}{\color{blue}{1 + x}} \]
                      2. +-commutativeN/A

                        \[\leadsto \frac{1 \cdot 1 - x \cdot x}{x + \color{blue}{1}} \]
                      3. flip3-+N/A

                        \[\leadsto \frac{1 \cdot 1 - x \cdot x}{\frac{{x}^{3} + {1}^{3}}{\color{blue}{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)}}} \]
                      4. associate-/r/N/A

                        \[\leadsto \frac{1 \cdot 1 - x \cdot x}{{x}^{3} + {1}^{3}} \cdot \color{blue}{\left(x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)\right)} \]
                      5. *-lowering-*.f64N/A

                        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1 \cdot 1 - x \cdot x}{{x}^{3} + {1}^{3}}\right), \color{blue}{\left(x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)\right)}\right) \]
                      6. /-lowering-/.f64N/A

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(1 \cdot 1 - x \cdot x\right), \left({x}^{3} + {1}^{3}\right)\right), \left(\color{blue}{x \cdot x} + \left(1 \cdot 1 - x \cdot 1\right)\right)\right) \]
                      7. metadata-evalN/A

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(1 - x \cdot x\right), \left({x}^{3} + {1}^{3}\right)\right), \left(x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)\right)\right) \]
                      8. --lowering--.f64N/A

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \left(x \cdot x\right)\right), \left({x}^{3} + {1}^{3}\right)\right), \left(\color{blue}{x} \cdot x + \left(1 \cdot 1 - x \cdot 1\right)\right)\right) \]
                      9. *-lowering-*.f64N/A

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \left({x}^{3} + {1}^{3}\right)\right), \left(x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)\right)\right) \]
                      10. metadata-evalN/A

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \left({x}^{3} + 1\right)\right), \left(x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)\right)\right) \]
                      11. +-commutativeN/A

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \left(1 + {x}^{3}\right)\right), \left(x \cdot \color{blue}{x} + \left(1 \cdot 1 - x \cdot 1\right)\right)\right) \]
                      12. +-lowering-+.f64N/A

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(1, \left({x}^{3}\right)\right)\right), \left(x \cdot \color{blue}{x} + \left(1 \cdot 1 - x \cdot 1\right)\right)\right) \]
                      13. cube-multN/A

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(1, \left(x \cdot \left(x \cdot x\right)\right)\right)\right), \left(x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)\right)\right) \]
                      14. *-lowering-*.f64N/A

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(x \cdot x\right)\right)\right)\right), \left(x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)\right)\right) \]
                      15. *-lowering-*.f64N/A

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right)\right), \left(x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)\right)\right) \]
                      16. metadata-evalN/A

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right)\right), \left(x \cdot x + \left(1 - \color{blue}{x} \cdot 1\right)\right)\right) \]
                      17. *-rgt-identityN/A

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right)\right), \left(x \cdot x + \left(1 - x\right)\right)\right) \]
                      18. associate-+r-N/A

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right)\right), \left(\left(x \cdot x + 1\right) - \color{blue}{x}\right)\right) \]
                      19. +-commutativeN/A

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right)\right), \left(\left(1 + x \cdot x\right) - x\right)\right) \]
                      20. associate-+r-N/A

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right)\right), \left(1 + \color{blue}{\left(x \cdot x - x\right)}\right)\right) \]
                      21. +-lowering-+.f64N/A

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(x \cdot x - x\right)}\right)\right) \]
                    14. Applied egg-rr18.5%

                      \[\leadsto \color{blue}{\frac{1 - x \cdot x}{1 + x \cdot \left(x \cdot x\right)} \cdot \left(1 + x \cdot \left(x + -1\right)\right)} \]
                  12. Recombined 2 regimes into one program.
                  13. Add Preprocessing

                  Alternative 6: 43.4% accurate, 505.0× speedup?

                  \[\begin{array}{l} \\ 1 \end{array} \]
                  (FPCore (x) :precision binary64 1.0)
                  double code(double x) {
                  	return 1.0;
                  }
                  
                  real(8) function code(x)
                      real(8), intent (in) :: x
                      code = 1.0d0
                  end function
                  
                  public static double code(double x) {
                  	return 1.0;
                  }
                  
                  def code(x):
                  	return 1.0
                  
                  function code(x)
                  	return 1.0
                  end
                  
                  function tmp = code(x)
                  	tmp = 1.0;
                  end
                  
                  code[x_] := 1.0
                  
                  \begin{array}{l}
                  
                  \\
                  1
                  \end{array}
                  
                  Derivation
                  1. Initial program 9.4%

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

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

                      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot 1}{\color{blue}{e^{x}}} \]
                    3. *-rgt-identityN/A

                      \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{\color{blue}{x}}} \]
                    4. /-lowering-/.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right), \color{blue}{\left(e^{x}\right)}\right) \]
                    5. fmod-lowering-fmod.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\left(e^{x}\right), \left(\sqrt{\cos x}\right)\right), \left(e^{\color{blue}{x}}\right)\right) \]
                    6. exp-lowering-exp.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\cos x}\right)\right), \left(e^{x}\right)\right) \]
                    7. sqrt-lowering-sqrt.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\cos x\right)\right), \left(e^{x}\right)\right) \]
                    8. cos-lowering-cos.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \left(e^{x}\right)\right) \]
                    9. exp-lowering-exp.f649.4%

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{sqrt.f64}\left(\mathsf{cos.f64}\left(x\right)\right)\right), \mathsf{exp.f64}\left(x\right)\right) \]
                  3. Simplified9.4%

                    \[\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. clear-numN/A

                      \[\leadsto \frac{1}{\color{blue}{\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}}} \]
                    2. inv-powN/A

                      \[\leadsto {\left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)}^{\color{blue}{-1}} \]
                    3. pow-to-expN/A

                      \[\leadsto e^{\log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right) \cdot -1} \]
                    4. exp-lowering-exp.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\left(\log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right) \cdot -1\right)\right) \]
                    5. *-commutativeN/A

                      \[\leadsto \mathsf{exp.f64}\left(\left(-1 \cdot \log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)\right)\right) \]
                    6. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \log \left(\frac{e^{x}}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}\right)\right)\right) \]
                    7. log-divN/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \left(\log \left(e^{x}\right) - \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
                    8. rem-log-expN/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \left(x - \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
                    9. --lowering--.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \log \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right) \]
                    10. log-lowering-log.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
                    11. fmod-lowering-fmod.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\left(e^{x}\right), \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
                    12. exp-lowering-exp.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left(\sqrt{\cos x}\right)\right)\right)\right)\right)\right) \]
                    13. pow1/2N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \left({\cos x}^{\frac{1}{2}}\right)\right)\right)\right)\right)\right) \]
                    14. pow-lowering-pow.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{pow.f64}\left(\cos x, \frac{1}{2}\right)\right)\right)\right)\right)\right) \]
                    15. cos-lowering-cos.f649.4%

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(\mathsf{fmod.f64}\left(\mathsf{exp.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{cos.f64}\left(x\right), \frac{1}{2}\right)\right)\right)\right)\right)\right) \]
                  6. Applied egg-rr9.4%

                    \[\leadsto \color{blue}{e^{-1 \cdot \left(x - \log \left(\left(e^{x}\right) \bmod \left({\cos x}^{0.5}\right)\right)\right)}} \]
                  7. Taylor expanded in x around inf

                    \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot x\right)}\right) \]
                  8. Step-by-step derivation
                    1. mul-1-negN/A

                      \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(x\right)\right)\right) \]
                    2. neg-sub0N/A

                      \[\leadsto \mathsf{exp.f64}\left(\left(0 - x\right)\right) \]
                    3. --lowering--.f6460.3%

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, x\right)\right) \]
                  9. Simplified60.3%

                    \[\leadsto e^{\color{blue}{0 - x}} \]
                  10. Taylor expanded in x around 0

                    \[\leadsto \color{blue}{1} \]
                  11. Step-by-step derivation
                    1. Simplified46.4%

                      \[\leadsto \color{blue}{1} \]
                    2. Add Preprocessing

                    Reproduce

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