expfmod (used to be hard to sample)

Percentage Accurate: 9.0% → 97.7%
Time: 15.7s
Alternatives: 8
Speedup: 1.4×

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);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x)
use fmin_fmax_functions
    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}

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 8 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: 9.0% 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);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x)
use fmin_fmax_functions
    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: 97.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\cos x}\\ t_1 := e^{-x}\\ t_2 := \left(\left(e^{x}\right) \bmod t\_0\right) \cdot t\_1\\ \mathbf{if}\;t\_2 \leq 2 \cdot 10^{-9}:\\ \;\;\;\;\left(\left(\left(1 + \frac{\frac{0.25 - 0.5 \cdot 0.5}{\sinh x}}{\sinh x}\right) \cdot \sinh x\right) \bmod t\_0\right) \cdot t\_1\\ \mathbf{elif}\;t\_2 \leq 2:\\ \;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \left(\mathsf{fma}\left(\pi, 0.5, x\right)\right)}\right)\right)}{e^{x}}\\ \mathbf{else}:\\ \;\;\;\;\left(1 \bmod t\_0\right) \cdot t\_1\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (sqrt (cos x)))
        (t_1 (exp (- x)))
        (t_2 (* (fmod (exp x) t_0) t_1)))
   (if (<= t_2 2e-9)
     (*
      (fmod
       (* (+ 1.0 (/ (/ (- 0.25 (* 0.5 0.5)) (sinh x)) (sinh x))) (sinh x))
       t_0)
      t_1)
     (if (<= t_2 2.0)
       (/ (fmod (exp x) (sqrt (sin (fma PI 0.5 x)))) (exp x))
       (* (fmod 1.0 t_0) t_1)))))
double code(double x) {
	double t_0 = sqrt(cos(x));
	double t_1 = exp(-x);
	double t_2 = fmod(exp(x), t_0) * t_1;
	double tmp;
	if (t_2 <= 2e-9) {
		tmp = fmod(((1.0 + (((0.25 - (0.5 * 0.5)) / sinh(x)) / sinh(x))) * sinh(x)), t_0) * t_1;
	} else if (t_2 <= 2.0) {
		tmp = fmod(exp(x), sqrt(sin(fma(((double) M_PI), 0.5, x)))) / exp(x);
	} else {
		tmp = fmod(1.0, t_0) * t_1;
	}
	return tmp;
}
function code(x)
	t_0 = sqrt(cos(x))
	t_1 = exp(Float64(-x))
	t_2 = Float64(rem(exp(x), t_0) * t_1)
	tmp = 0.0
	if (t_2 <= 2e-9)
		tmp = Float64(rem(Float64(Float64(1.0 + Float64(Float64(Float64(0.25 - Float64(0.5 * 0.5)) / sinh(x)) / sinh(x))) * sinh(x)), t_0) * t_1);
	elseif (t_2 <= 2.0)
		tmp = Float64(rem(exp(x), sqrt(sin(fma(pi, 0.5, x)))) / exp(x));
	else
		tmp = Float64(rem(1.0, t_0) * t_1);
	end
	return tmp
end
code[x_] := Block[{t$95$0 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[(-x)], $MachinePrecision]}, Block[{t$95$2 = N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = t$95$0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, 2e-9], N[(N[With[{TMP1 = N[(N[(1.0 + N[(N[(N[(0.25 - N[(0.5 * 0.5), $MachinePrecision]), $MachinePrecision] / N[Sinh[x], $MachinePrecision]), $MachinePrecision] / N[Sinh[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sinh[x], $MachinePrecision]), $MachinePrecision], TMP2 = t$95$0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 2.0], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Sin[N[(Pi * 0.5 + x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = 1.0, TMP2 = t$95$0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{\cos x}\\
t_1 := e^{-x}\\
t_2 := \left(\left(e^{x}\right) \bmod t\_0\right) \cdot t\_1\\
\mathbf{if}\;t\_2 \leq 2 \cdot 10^{-9}:\\
\;\;\;\;\left(\left(\left(1 + \frac{\frac{0.25 - 0.5 \cdot 0.5}{\sinh x}}{\sinh x}\right) \cdot \sinh x\right) \bmod t\_0\right) \cdot t\_1\\

\mathbf{elif}\;t\_2 \leq 2:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \left(\mathsf{fma}\left(\pi, 0.5, x\right)\right)}\right)\right)}{e^{x}}\\

\mathbf{else}:\\
\;\;\;\;\left(1 \bmod t\_0\right) \cdot t\_1\\


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

    1. Initial program 9.0%

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

        \[\leadsto \left(\color{blue}{\left(e^{x}\right)} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
      2. sinh-+-cosh-revN/A

        \[\leadsto \left(\color{blue}{\left(\cosh x + \sinh x\right)} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
      3. +-commutativeN/A

        \[\leadsto \left(\color{blue}{\left(\sinh x + \cosh x\right)} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
      4. sum-to-multN/A

        \[\leadsto \left(\color{blue}{\left(\left(1 + \frac{\cosh x}{\sinh x}\right) \cdot \sinh x\right)} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
      5. lower-special-*.f64N/A

        \[\leadsto \left(\color{blue}{\left(\left(1 + \frac{\cosh x}{\sinh x}\right) \cdot \sinh x\right)} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
      6. lower-special-+.f64N/A

        \[\leadsto \left(\left(\color{blue}{\left(1 + \frac{\cosh x}{\sinh x}\right)} \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
      7. lower-special-/.f64N/A

        \[\leadsto \left(\left(\left(1 + \color{blue}{\frac{\cosh x}{\sinh x}}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
      8. lower-cosh.f64N/A

        \[\leadsto \left(\left(\left(1 + \frac{\color{blue}{\cosh x}}{\sinh x}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
      9. lower-sinh.f64N/A

        \[\leadsto \left(\left(\left(1 + \frac{\cosh x}{\color{blue}{\sinh x}}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
      10. lower-sinh.f648.9

        \[\leadsto \left(\left(\left(1 + \frac{\cosh x}{\sinh x}\right) \cdot \color{blue}{\sinh x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    3. Applied rewrites8.9%

      \[\leadsto \left(\color{blue}{\left(\left(1 + \frac{\cosh x}{\sinh x}\right) \cdot \sinh x\right)} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    4. Applied rewrites63.6%

      \[\leadsto \left(\left(\left(1 + \frac{\color{blue}{\frac{\left(e^{x} \cdot 0.5\right) \cdot \left(e^{x} \cdot 0.5\right) - \left(0.5 \cdot e^{-x}\right) \cdot \left(0.5 \cdot e^{-x}\right)}{\sinh x}}}{\sinh x}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    5. Taylor expanded in x around 0

      \[\leadsto \left(\left(\left(1 + \frac{\frac{\color{blue}{\frac{1}{4}} - \left(\frac{1}{2} \cdot e^{-x}\right) \cdot \left(\frac{1}{2} \cdot e^{-x}\right)}{\sinh x}}{\sinh x}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
    6. Step-by-step derivation
      1. Applied rewrites61.5%

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

        \[\leadsto \left(\left(\left(1 + \frac{\frac{\frac{1}{4} - \color{blue}{\frac{1}{2}} \cdot \left(\frac{1}{2} \cdot e^{-x}\right)}{\sinh x}}{\sinh x}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
      3. Step-by-step derivation
        1. Applied rewrites61.4%

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

          \[\leadsto \left(\left(\left(1 + \frac{\frac{\frac{1}{4} - \frac{1}{2} \cdot \color{blue}{\frac{1}{2}}}{\sinh x}}{\sinh x}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
        3. Step-by-step derivation
          1. Applied rewrites62.6%

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

          if 2.00000000000000012e-9 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2

          1. Initial program 9.0%

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

              \[\leadsto \color{blue}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}} \]
            2. lift-exp.f64N/A

              \[\leadsto \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot \color{blue}{e^{-x}} \]
            3. lift-neg.f64N/A

              \[\leadsto \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{\color{blue}{\mathsf{neg}\left(x\right)}} \]
            4. exp-negN/A

              \[\leadsto \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot \color{blue}{\frac{1}{e^{x}}} \]
            5. lift-exp.f64N/A

              \[\leadsto \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot \frac{1}{\color{blue}{e^{x}}} \]
            6. mult-flip-revN/A

              \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
            7. lower-/.f649.1

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

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

              \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\color{blue}{\cos x}}\right)\right)}{e^{x}} \]
            2. sin-+PI/2-revN/A

              \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\color{blue}{\sin \left(x + \frac{\mathsf{PI}\left(\right)}{2}\right)}}\right)\right)}{e^{x}} \]
            3. sum-to-multN/A

              \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \color{blue}{\left(\left(1 + \frac{\frac{\mathsf{PI}\left(\right)}{2}}{x}\right) \cdot x\right)}}\right)\right)}{e^{x}} \]
            4. lift-PI.f64N/A

              \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \left(\left(1 + \frac{\frac{\color{blue}{\pi}}{2}}{x}\right) \cdot x\right)}\right)\right)}{e^{x}} \]
            5. mult-flipN/A

              \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \left(\left(1 + \frac{\color{blue}{\pi \cdot \frac{1}{2}}}{x}\right) \cdot x\right)}\right)\right)}{e^{x}} \]
            6. metadata-evalN/A

              \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \left(\left(1 + \frac{\pi \cdot \color{blue}{\frac{1}{2}}}{x}\right) \cdot x\right)}\right)\right)}{e^{x}} \]
            7. *-commutativeN/A

              \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \left(\left(1 + \frac{\color{blue}{\frac{1}{2} \cdot \pi}}{x}\right) \cdot x\right)}\right)\right)}{e^{x}} \]
            8. sum-to-multN/A

              \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \color{blue}{\left(x + \frac{1}{2} \cdot \pi\right)}}\right)\right)}{e^{x}} \]
            9. +-commutativeN/A

              \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \color{blue}{\left(\frac{1}{2} \cdot \pi + x\right)}}\right)\right)}{e^{x}} \]
            10. lift-fma.f64N/A

              \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \color{blue}{\left(\mathsf{fma}\left(\frac{1}{2}, \pi, x\right)\right)}}\right)\right)}{e^{x}} \]
            11. lift-sin.f649.1

              \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\color{blue}{\sin \left(\mathsf{fma}\left(0.5, \pi, x\right)\right)}}\right)\right)}{e^{x}} \]
            12. lift-fma.f64N/A

              \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \color{blue}{\left(\frac{1}{2} \cdot \pi + x\right)}}\right)\right)}{e^{x}} \]
            13. add-flipN/A

              \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \color{blue}{\left(\frac{1}{2} \cdot \pi - \left(\mathsf{neg}\left(x\right)\right)\right)}}\right)\right)}{e^{x}} \]
            14. lift-neg.f64N/A

              \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \left(\frac{1}{2} \cdot \pi - \color{blue}{\left(-x\right)}\right)}\right)\right)}{e^{x}} \]
            15. sub-flipN/A

              \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \color{blue}{\left(\frac{1}{2} \cdot \pi + \left(\mathsf{neg}\left(\left(-x\right)\right)\right)\right)}}\right)\right)}{e^{x}} \]
            16. *-commutativeN/A

              \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \left(\color{blue}{\pi \cdot \frac{1}{2}} + \left(\mathsf{neg}\left(\left(-x\right)\right)\right)\right)}\right)\right)}{e^{x}} \]
            17. lift-neg.f64N/A

              \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \left(\pi \cdot \frac{1}{2} + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right)}\right)\right)}{e^{x}} \]
            18. remove-double-negN/A

              \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \left(\pi \cdot \frac{1}{2} + \color{blue}{x}\right)}\right)\right)}{e^{x}} \]
            19. lower-fma.f649.1

              \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \color{blue}{\left(\mathsf{fma}\left(\pi, 0.5, x\right)\right)}}\right)\right)}{e^{x}} \]
          5. Applied rewrites9.1%

            \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\color{blue}{\sin \left(\mathsf{fma}\left(\pi, 0.5, x\right)\right)}}\right)\right)}{e^{x}} \]

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

          1. Initial program 9.0%

            \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
          2. Taylor expanded in x around 0

            \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
          3. Step-by-step derivation
            1. Applied rewrites34.8%

              \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
          4. Recombined 3 regimes into one program.
          5. Add Preprocessing

          Alternative 2: 96.9% accurate, 0.3× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\cos x}\\ t_1 := e^{-x}\\ t_2 := \left(\left(e^{x}\right) \bmod t\_0\right) \cdot t\_1\\ \mathbf{if}\;t\_2 \leq 10^{-18}:\\ \;\;\;\;\frac{\left(\left(\frac{\mathsf{fma}\left(e^{\left(-x\right) - x}, -0.25, 0.25\right)}{\sinh x} + \sinh x\right) \bmod t\_0\right)}{e^{x}}\\ \mathbf{elif}\;t\_2 \leq 2:\\ \;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \left(\mathsf{fma}\left(\pi, 0.5, x\right)\right)}\right)\right)}{e^{x}}\\ \mathbf{else}:\\ \;\;\;\;\left(1 \bmod t\_0\right) \cdot t\_1\\ \end{array} \end{array} \]
          (FPCore (x)
           :precision binary64
           (let* ((t_0 (sqrt (cos x)))
                  (t_1 (exp (- x)))
                  (t_2 (* (fmod (exp x) t_0) t_1)))
             (if (<= t_2 1e-18)
               (/
                (fmod (+ (/ (fma (exp (- (- x) x)) -0.25 0.25) (sinh x)) (sinh x)) t_0)
                (exp x))
               (if (<= t_2 2.0)
                 (/ (fmod (exp x) (sqrt (sin (fma PI 0.5 x)))) (exp x))
                 (* (fmod 1.0 t_0) t_1)))))
          double code(double x) {
          	double t_0 = sqrt(cos(x));
          	double t_1 = exp(-x);
          	double t_2 = fmod(exp(x), t_0) * t_1;
          	double tmp;
          	if (t_2 <= 1e-18) {
          		tmp = fmod(((fma(exp((-x - x)), -0.25, 0.25) / sinh(x)) + sinh(x)), t_0) / exp(x);
          	} else if (t_2 <= 2.0) {
          		tmp = fmod(exp(x), sqrt(sin(fma(((double) M_PI), 0.5, x)))) / exp(x);
          	} else {
          		tmp = fmod(1.0, t_0) * t_1;
          	}
          	return tmp;
          }
          
          function code(x)
          	t_0 = sqrt(cos(x))
          	t_1 = exp(Float64(-x))
          	t_2 = Float64(rem(exp(x), t_0) * t_1)
          	tmp = 0.0
          	if (t_2 <= 1e-18)
          		tmp = Float64(rem(Float64(Float64(fma(exp(Float64(Float64(-x) - x)), -0.25, 0.25) / sinh(x)) + sinh(x)), t_0) / exp(x));
          	elseif (t_2 <= 2.0)
          		tmp = Float64(rem(exp(x), sqrt(sin(fma(pi, 0.5, x)))) / exp(x));
          	else
          		tmp = Float64(rem(1.0, t_0) * t_1);
          	end
          	return tmp
          end
          
          code[x_] := Block[{t$95$0 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[(-x)], $MachinePrecision]}, Block[{t$95$2 = N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = t$95$0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, 1e-18], N[(N[With[{TMP1 = N[(N[(N[(N[Exp[N[((-x) - x), $MachinePrecision]], $MachinePrecision] * -0.25 + 0.25), $MachinePrecision] / N[Sinh[x], $MachinePrecision]), $MachinePrecision] + N[Sinh[x], $MachinePrecision]), $MachinePrecision], TMP2 = t$95$0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2.0], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Sin[N[(Pi * 0.5 + x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = 1.0, TMP2 = t$95$0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$1), $MachinePrecision]]]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \sqrt{\cos x}\\
          t_1 := e^{-x}\\
          t_2 := \left(\left(e^{x}\right) \bmod t\_0\right) \cdot t\_1\\
          \mathbf{if}\;t\_2 \leq 10^{-18}:\\
          \;\;\;\;\frac{\left(\left(\frac{\mathsf{fma}\left(e^{\left(-x\right) - x}, -0.25, 0.25\right)}{\sinh x} + \sinh x\right) \bmod t\_0\right)}{e^{x}}\\
          
          \mathbf{elif}\;t\_2 \leq 2:\\
          \;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \left(\mathsf{fma}\left(\pi, 0.5, x\right)\right)}\right)\right)}{e^{x}}\\
          
          \mathbf{else}:\\
          \;\;\;\;\left(1 \bmod t\_0\right) \cdot t\_1\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 1.0000000000000001e-18

            1. Initial program 9.0%

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

                \[\leadsto \left(\color{blue}{\left(e^{x}\right)} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
              2. sinh-+-cosh-revN/A

                \[\leadsto \left(\color{blue}{\left(\cosh x + \sinh x\right)} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
              3. +-commutativeN/A

                \[\leadsto \left(\color{blue}{\left(\sinh x + \cosh x\right)} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
              4. sum-to-multN/A

                \[\leadsto \left(\color{blue}{\left(\left(1 + \frac{\cosh x}{\sinh x}\right) \cdot \sinh x\right)} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
              5. lower-special-*.f64N/A

                \[\leadsto \left(\color{blue}{\left(\left(1 + \frac{\cosh x}{\sinh x}\right) \cdot \sinh x\right)} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
              6. lower-special-+.f64N/A

                \[\leadsto \left(\left(\color{blue}{\left(1 + \frac{\cosh x}{\sinh x}\right)} \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
              7. lower-special-/.f64N/A

                \[\leadsto \left(\left(\left(1 + \color{blue}{\frac{\cosh x}{\sinh x}}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
              8. lower-cosh.f64N/A

                \[\leadsto \left(\left(\left(1 + \frac{\color{blue}{\cosh x}}{\sinh x}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
              9. lower-sinh.f64N/A

                \[\leadsto \left(\left(\left(1 + \frac{\cosh x}{\color{blue}{\sinh x}}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
              10. lower-sinh.f648.9

                \[\leadsto \left(\left(\left(1 + \frac{\cosh x}{\sinh x}\right) \cdot \color{blue}{\sinh x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
            3. Applied rewrites8.9%

              \[\leadsto \left(\color{blue}{\left(\left(1 + \frac{\cosh x}{\sinh x}\right) \cdot \sinh x\right)} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
            4. Applied rewrites63.6%

              \[\leadsto \left(\left(\left(1 + \frac{\color{blue}{\frac{\left(e^{x} \cdot 0.5\right) \cdot \left(e^{x} \cdot 0.5\right) - \left(0.5 \cdot e^{-x}\right) \cdot \left(0.5 \cdot e^{-x}\right)}{\sinh x}}}{\sinh x}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
            5. Taylor expanded in x around 0

              \[\leadsto \left(\left(\left(1 + \frac{\frac{\color{blue}{\frac{1}{4}} - \left(\frac{1}{2} \cdot e^{-x}\right) \cdot \left(\frac{1}{2} \cdot e^{-x}\right)}{\sinh x}}{\sinh x}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
            6. Step-by-step derivation
              1. Applied rewrites61.5%

                \[\leadsto \left(\left(\left(1 + \frac{\frac{\color{blue}{0.25} - \left(0.5 \cdot e^{-x}\right) \cdot \left(0.5 \cdot e^{-x}\right)}{\sinh x}}{\sinh x}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
              2. Step-by-step derivation
                1. lift-*.f64N/A

                  \[\leadsto \color{blue}{\left(\left(\left(1 + \frac{\frac{\frac{1}{4} - \left(\frac{1}{2} \cdot e^{-x}\right) \cdot \left(\frac{1}{2} \cdot e^{-x}\right)}{\sinh x}}{\sinh x}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}} \]
                2. lift-exp.f64N/A

                  \[\leadsto \left(\left(\left(1 + \frac{\frac{\frac{1}{4} - \left(\frac{1}{2} \cdot e^{-x}\right) \cdot \left(\frac{1}{2} \cdot e^{-x}\right)}{\sinh x}}{\sinh x}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot \color{blue}{e^{-x}} \]
                3. lift-neg.f64N/A

                  \[\leadsto \left(\left(\left(1 + \frac{\frac{\frac{1}{4} - \left(\frac{1}{2} \cdot e^{-x}\right) \cdot \left(\frac{1}{2} \cdot e^{-x}\right)}{\sinh x}}{\sinh x}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{\color{blue}{\mathsf{neg}\left(x\right)}} \]
                4. exp-negN/A

                  \[\leadsto \left(\left(\left(1 + \frac{\frac{\frac{1}{4} - \left(\frac{1}{2} \cdot e^{-x}\right) \cdot \left(\frac{1}{2} \cdot e^{-x}\right)}{\sinh x}}{\sinh x}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot \color{blue}{\frac{1}{e^{x}}} \]
                5. lift-exp.f64N/A

                  \[\leadsto \left(\left(\left(1 + \frac{\frac{\frac{1}{4} - \left(\frac{1}{2} \cdot e^{-x}\right) \cdot \left(\frac{1}{2} \cdot e^{-x}\right)}{\sinh x}}{\sinh x}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot \frac{1}{\color{blue}{e^{x}}} \]
                6. mult-flip-revN/A

                  \[\leadsto \color{blue}{\frac{\left(\left(\left(1 + \frac{\frac{\frac{1}{4} - \left(\frac{1}{2} \cdot e^{-x}\right) \cdot \left(\frac{1}{2} \cdot e^{-x}\right)}{\sinh x}}{\sinh x}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
                7. lower-/.f6461.5

                  \[\leadsto \color{blue}{\frac{\left(\left(\left(1 + \frac{\frac{0.25 - \left(0.5 \cdot e^{-x}\right) \cdot \left(0.5 \cdot e^{-x}\right)}{\sinh x}}{\sinh x}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
              3. Applied rewrites61.5%

                \[\leadsto \color{blue}{\frac{\left(\left(\frac{\mathsf{fma}\left(e^{\left(-x\right) - x}, -0.25, 0.25\right)}{\sinh x} + \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]

              if 1.0000000000000001e-18 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2

              1. Initial program 9.0%

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

                  \[\leadsto \color{blue}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}} \]
                2. lift-exp.f64N/A

                  \[\leadsto \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot \color{blue}{e^{-x}} \]
                3. lift-neg.f64N/A

                  \[\leadsto \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{\color{blue}{\mathsf{neg}\left(x\right)}} \]
                4. exp-negN/A

                  \[\leadsto \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot \color{blue}{\frac{1}{e^{x}}} \]
                5. lift-exp.f64N/A

                  \[\leadsto \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot \frac{1}{\color{blue}{e^{x}}} \]
                6. mult-flip-revN/A

                  \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
                7. lower-/.f649.1

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

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

                  \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\color{blue}{\cos x}}\right)\right)}{e^{x}} \]
                2. sin-+PI/2-revN/A

                  \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\color{blue}{\sin \left(x + \frac{\mathsf{PI}\left(\right)}{2}\right)}}\right)\right)}{e^{x}} \]
                3. sum-to-multN/A

                  \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \color{blue}{\left(\left(1 + \frac{\frac{\mathsf{PI}\left(\right)}{2}}{x}\right) \cdot x\right)}}\right)\right)}{e^{x}} \]
                4. lift-PI.f64N/A

                  \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \left(\left(1 + \frac{\frac{\color{blue}{\pi}}{2}}{x}\right) \cdot x\right)}\right)\right)}{e^{x}} \]
                5. mult-flipN/A

                  \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \left(\left(1 + \frac{\color{blue}{\pi \cdot \frac{1}{2}}}{x}\right) \cdot x\right)}\right)\right)}{e^{x}} \]
                6. metadata-evalN/A

                  \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \left(\left(1 + \frac{\pi \cdot \color{blue}{\frac{1}{2}}}{x}\right) \cdot x\right)}\right)\right)}{e^{x}} \]
                7. *-commutativeN/A

                  \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \left(\left(1 + \frac{\color{blue}{\frac{1}{2} \cdot \pi}}{x}\right) \cdot x\right)}\right)\right)}{e^{x}} \]
                8. sum-to-multN/A

                  \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \color{blue}{\left(x + \frac{1}{2} \cdot \pi\right)}}\right)\right)}{e^{x}} \]
                9. +-commutativeN/A

                  \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \color{blue}{\left(\frac{1}{2} \cdot \pi + x\right)}}\right)\right)}{e^{x}} \]
                10. lift-fma.f64N/A

                  \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \color{blue}{\left(\mathsf{fma}\left(\frac{1}{2}, \pi, x\right)\right)}}\right)\right)}{e^{x}} \]
                11. lift-sin.f649.1

                  \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\color{blue}{\sin \left(\mathsf{fma}\left(0.5, \pi, x\right)\right)}}\right)\right)}{e^{x}} \]
                12. lift-fma.f64N/A

                  \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \color{blue}{\left(\frac{1}{2} \cdot \pi + x\right)}}\right)\right)}{e^{x}} \]
                13. add-flipN/A

                  \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \color{blue}{\left(\frac{1}{2} \cdot \pi - \left(\mathsf{neg}\left(x\right)\right)\right)}}\right)\right)}{e^{x}} \]
                14. lift-neg.f64N/A

                  \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \left(\frac{1}{2} \cdot \pi - \color{blue}{\left(-x\right)}\right)}\right)\right)}{e^{x}} \]
                15. sub-flipN/A

                  \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \color{blue}{\left(\frac{1}{2} \cdot \pi + \left(\mathsf{neg}\left(\left(-x\right)\right)\right)\right)}}\right)\right)}{e^{x}} \]
                16. *-commutativeN/A

                  \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \left(\color{blue}{\pi \cdot \frac{1}{2}} + \left(\mathsf{neg}\left(\left(-x\right)\right)\right)\right)}\right)\right)}{e^{x}} \]
                17. lift-neg.f64N/A

                  \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \left(\pi \cdot \frac{1}{2} + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right)}\right)\right)}{e^{x}} \]
                18. remove-double-negN/A

                  \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \left(\pi \cdot \frac{1}{2} + \color{blue}{x}\right)}\right)\right)}{e^{x}} \]
                19. lower-fma.f649.1

                  \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\sin \color{blue}{\left(\mathsf{fma}\left(\pi, 0.5, x\right)\right)}}\right)\right)}{e^{x}} \]
              5. Applied rewrites9.1%

                \[\leadsto \frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\color{blue}{\sin \left(\mathsf{fma}\left(\pi, 0.5, x\right)\right)}}\right)\right)}{e^{x}} \]

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

              1. Initial program 9.0%

                \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
              2. Taylor expanded in x around 0

                \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
              3. Step-by-step derivation
                1. Applied rewrites34.8%

                  \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
              4. Recombined 3 regimes into one program.
              5. Add Preprocessing

              Alternative 3: 39.9% accurate, 0.4× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\cos x}\\ t_1 := e^{-x}\\ \mathbf{if}\;\left(\left(e^{x}\right) \bmod t\_0\right) \cdot t\_1 \leq 2:\\ \;\;\;\;\left(\left(\frac{-e^{x}}{\frac{-1}{\sinh x} \cdot \sinh x}\right) \bmod t\_0\right) \cdot t\_1\\ \mathbf{else}:\\ \;\;\;\;\left(1 \bmod t\_0\right) \cdot t\_1\\ \end{array} \end{array} \]
              (FPCore (x)
               :precision binary64
               (let* ((t_0 (sqrt (cos x))) (t_1 (exp (- x))))
                 (if (<= (* (fmod (exp x) t_0) t_1) 2.0)
                   (* (fmod (/ (- (exp x)) (* (/ -1.0 (sinh x)) (sinh x))) t_0) t_1)
                   (* (fmod 1.0 t_0) t_1))))
              double code(double x) {
              	double t_0 = sqrt(cos(x));
              	double t_1 = exp(-x);
              	double tmp;
              	if ((fmod(exp(x), t_0) * t_1) <= 2.0) {
              		tmp = fmod((-exp(x) / ((-1.0 / sinh(x)) * sinh(x))), t_0) * t_1;
              	} else {
              		tmp = fmod(1.0, t_0) * t_1;
              	}
              	return tmp;
              }
              
              module fmin_fmax_functions
                  implicit none
                  private
                  public fmax
                  public fmin
              
                  interface fmax
                      module procedure fmax88
                      module procedure fmax44
                      module procedure fmax84
                      module procedure fmax48
                  end interface
                  interface fmin
                      module procedure fmin88
                      module procedure fmin44
                      module procedure fmin84
                      module procedure fmin48
                  end interface
              contains
                  real(8) function fmax88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmax44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmax84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmax48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                  end function
                  real(8) function fmin88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmin44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmin84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmin48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                  end function
              end module
              
              real(8) function code(x)
              use fmin_fmax_functions
                  real(8), intent (in) :: x
                  real(8) :: t_0
                  real(8) :: t_1
                  real(8) :: tmp
                  t_0 = sqrt(cos(x))
                  t_1 = exp(-x)
                  if ((mod(exp(x), t_0) * t_1) <= 2.0d0) then
                      tmp = mod((-exp(x) / (((-1.0d0) / sinh(x)) * sinh(x))), t_0) * t_1
                  else
                      tmp = mod(1.0d0, t_0) * t_1
                  end if
                  code = tmp
              end function
              
              def code(x):
              	t_0 = math.sqrt(math.cos(x))
              	t_1 = math.exp(-x)
              	tmp = 0
              	if (math.fmod(math.exp(x), t_0) * t_1) <= 2.0:
              		tmp = math.fmod((-math.exp(x) / ((-1.0 / math.sinh(x)) * math.sinh(x))), t_0) * t_1
              	else:
              		tmp = math.fmod(1.0, t_0) * t_1
              	return tmp
              
              function code(x)
              	t_0 = sqrt(cos(x))
              	t_1 = exp(Float64(-x))
              	tmp = 0.0
              	if (Float64(rem(exp(x), t_0) * t_1) <= 2.0)
              		tmp = Float64(rem(Float64(Float64(-exp(x)) / Float64(Float64(-1.0 / sinh(x)) * sinh(x))), t_0) * t_1);
              	else
              		tmp = Float64(rem(1.0, t_0) * t_1);
              	end
              	return tmp
              end
              
              code[x_] := Block[{t$95$0 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = t$95$0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$1), $MachinePrecision], 2.0], N[(N[With[{TMP1 = N[((-N[Exp[x], $MachinePrecision]) / N[(N[(-1.0 / N[Sinh[x], $MachinePrecision]), $MachinePrecision] * N[Sinh[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], TMP2 = t$95$0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[With[{TMP1 = 1.0, TMP2 = t$95$0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$1), $MachinePrecision]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \sqrt{\cos x}\\
              t_1 := e^{-x}\\
              \mathbf{if}\;\left(\left(e^{x}\right) \bmod t\_0\right) \cdot t\_1 \leq 2:\\
              \;\;\;\;\left(\left(\frac{-e^{x}}{\frac{-1}{\sinh x} \cdot \sinh x}\right) \bmod t\_0\right) \cdot t\_1\\
              
              \mathbf{else}:\\
              \;\;\;\;\left(1 \bmod t\_0\right) \cdot t\_1\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2

                1. Initial program 9.0%

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

                    \[\leadsto \left(\color{blue}{\left(e^{x}\right)} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                  2. sinh-+-cosh-revN/A

                    \[\leadsto \left(\color{blue}{\left(\cosh x + \sinh x\right)} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                  3. +-commutativeN/A

                    \[\leadsto \left(\color{blue}{\left(\sinh x + \cosh x\right)} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                  4. sum-to-multN/A

                    \[\leadsto \left(\color{blue}{\left(\left(1 + \frac{\cosh x}{\sinh x}\right) \cdot \sinh x\right)} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                  5. lower-special-*.f64N/A

                    \[\leadsto \left(\color{blue}{\left(\left(1 + \frac{\cosh x}{\sinh x}\right) \cdot \sinh x\right)} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                  6. lower-special-+.f64N/A

                    \[\leadsto \left(\left(\color{blue}{\left(1 + \frac{\cosh x}{\sinh x}\right)} \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                  7. lower-special-/.f64N/A

                    \[\leadsto \left(\left(\left(1 + \color{blue}{\frac{\cosh x}{\sinh x}}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                  8. lower-cosh.f64N/A

                    \[\leadsto \left(\left(\left(1 + \frac{\color{blue}{\cosh x}}{\sinh x}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                  9. lower-sinh.f64N/A

                    \[\leadsto \left(\left(\left(1 + \frac{\cosh x}{\color{blue}{\sinh x}}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                  10. lower-sinh.f648.9

                    \[\leadsto \left(\left(\left(1 + \frac{\cosh x}{\sinh x}\right) \cdot \color{blue}{\sinh x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                3. Applied rewrites8.9%

                  \[\leadsto \left(\color{blue}{\left(\left(1 + \frac{\cosh x}{\sinh x}\right) \cdot \sinh x\right)} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                4. Applied rewrites63.6%

                  \[\leadsto \left(\left(\left(1 + \frac{\color{blue}{\frac{\left(e^{x} \cdot 0.5\right) \cdot \left(e^{x} \cdot 0.5\right) - \left(0.5 \cdot e^{-x}\right) \cdot \left(0.5 \cdot e^{-x}\right)}{\sinh x}}}{\sinh x}\right) \cdot \sinh x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                5. Applied rewrites9.0%

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

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

                1. Initial program 9.0%

                  \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                2. Taylor expanded in x around 0

                  \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                3. Step-by-step derivation
                  1. Applied rewrites34.8%

                    \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                4. Recombined 2 regimes into one program.
                5. Add Preprocessing

                Alternative 4: 39.9% accurate, 0.5× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\cos x}\\ t_1 := \left(\left(e^{x}\right) \bmod t\_0\right)\\ t_2 := e^{-x}\\ \mathbf{if}\;t\_1 \cdot t\_2 \leq 2:\\ \;\;\;\;\frac{t\_1}{e^{x}}\\ \mathbf{else}:\\ \;\;\;\;\left(1 \bmod t\_0\right) \cdot t\_2\\ \end{array} \end{array} \]
                (FPCore (x)
                 :precision binary64
                 (let* ((t_0 (sqrt (cos x))) (t_1 (fmod (exp x) t_0)) (t_2 (exp (- x))))
                   (if (<= (* t_1 t_2) 2.0) (/ t_1 (exp x)) (* (fmod 1.0 t_0) t_2))))
                double code(double x) {
                	double t_0 = sqrt(cos(x));
                	double t_1 = fmod(exp(x), t_0);
                	double t_2 = exp(-x);
                	double tmp;
                	if ((t_1 * t_2) <= 2.0) {
                		tmp = t_1 / exp(x);
                	} else {
                		tmp = fmod(1.0, t_0) * t_2;
                	}
                	return tmp;
                }
                
                module fmin_fmax_functions
                    implicit none
                    private
                    public fmax
                    public fmin
                
                    interface fmax
                        module procedure fmax88
                        module procedure fmax44
                        module procedure fmax84
                        module procedure fmax48
                    end interface
                    interface fmin
                        module procedure fmin88
                        module procedure fmin44
                        module procedure fmin84
                        module procedure fmin48
                    end interface
                contains
                    real(8) function fmax88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmax44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmax84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmax48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                    end function
                    real(8) function fmin88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmin44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmin84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmin48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                    end function
                end module
                
                real(8) function code(x)
                use fmin_fmax_functions
                    real(8), intent (in) :: x
                    real(8) :: t_0
                    real(8) :: t_1
                    real(8) :: t_2
                    real(8) :: tmp
                    t_0 = sqrt(cos(x))
                    t_1 = mod(exp(x), t_0)
                    t_2 = exp(-x)
                    if ((t_1 * t_2) <= 2.0d0) then
                        tmp = t_1 / exp(x)
                    else
                        tmp = mod(1.0d0, t_0) * t_2
                    end if
                    code = tmp
                end function
                
                def code(x):
                	t_0 = math.sqrt(math.cos(x))
                	t_1 = math.fmod(math.exp(x), t_0)
                	t_2 = math.exp(-x)
                	tmp = 0
                	if (t_1 * t_2) <= 2.0:
                		tmp = t_1 / math.exp(x)
                	else:
                		tmp = math.fmod(1.0, t_0) * t_2
                	return tmp
                
                function code(x)
                	t_0 = sqrt(cos(x))
                	t_1 = rem(exp(x), t_0)
                	t_2 = exp(Float64(-x))
                	tmp = 0.0
                	if (Float64(t_1 * t_2) <= 2.0)
                		tmp = Float64(t_1 / exp(x));
                	else
                		tmp = Float64(rem(1.0, t_0) * t_2);
                	end
                	return tmp
                end
                
                code[x_] := Block[{t$95$0 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = t$95$0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]}, Block[{t$95$2 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[N[(t$95$1 * t$95$2), $MachinePrecision], 2.0], N[(t$95$1 / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = 1.0, TMP2 = t$95$0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$2), $MachinePrecision]]]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_0 := \sqrt{\cos x}\\
                t_1 := \left(\left(e^{x}\right) \bmod t\_0\right)\\
                t_2 := e^{-x}\\
                \mathbf{if}\;t\_1 \cdot t\_2 \leq 2:\\
                \;\;\;\;\frac{t\_1}{e^{x}}\\
                
                \mathbf{else}:\\
                \;\;\;\;\left(1 \bmod t\_0\right) \cdot t\_2\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2

                  1. Initial program 9.0%

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

                      \[\leadsto \color{blue}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}} \]
                    2. lift-exp.f64N/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot \color{blue}{e^{-x}} \]
                    3. lift-neg.f64N/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{\color{blue}{\mathsf{neg}\left(x\right)}} \]
                    4. exp-negN/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot \color{blue}{\frac{1}{e^{x}}} \]
                    5. lift-exp.f64N/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot \frac{1}{\color{blue}{e^{x}}} \]
                    6. mult-flip-revN/A

                      \[\leadsto \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
                    7. lower-/.f649.1

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

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

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

                  1. Initial program 9.0%

                    \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                  2. Taylor expanded in x around 0

                    \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                  3. Step-by-step derivation
                    1. Applied rewrites34.8%

                      \[\leadsto \left(\color{blue}{1} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                  4. Recombined 2 regimes into one program.
                  5. Add Preprocessing

                  Alternative 5: 38.2% accurate, 1.1× speedup?

                  \[\begin{array}{l} \\ \frac{\left(\left(x - -1\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}} \end{array} \]
                  (FPCore (x) :precision binary64 (/ (fmod (- x -1.0) (sqrt (cos x))) (exp x)))
                  double code(double x) {
                  	return fmod((x - -1.0), sqrt(cos(x))) / exp(x);
                  }
                  
                  module fmin_fmax_functions
                      implicit none
                      private
                      public fmax
                      public fmin
                  
                      interface fmax
                          module procedure fmax88
                          module procedure fmax44
                          module procedure fmax84
                          module procedure fmax48
                      end interface
                      interface fmin
                          module procedure fmin88
                          module procedure fmin44
                          module procedure fmin84
                          module procedure fmin48
                      end interface
                  contains
                      real(8) function fmax88(x, y) result (res)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                      end function
                      real(4) function fmax44(x, y) result (res)
                          real(4), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                      end function
                      real(8) function fmax84(x, y) result(res)
                          real(8), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                      end function
                      real(8) function fmax48(x, y) result(res)
                          real(4), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                      end function
                      real(8) function fmin88(x, y) result (res)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                      end function
                      real(4) function fmin44(x, y) result (res)
                          real(4), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                      end function
                      real(8) function fmin84(x, y) result(res)
                          real(8), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                      end function
                      real(8) function fmin48(x, y) result(res)
                          real(4), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                      end function
                  end module
                  
                  real(8) function code(x)
                  use fmin_fmax_functions
                      real(8), intent (in) :: x
                      code = mod((x - (-1.0d0)), sqrt(cos(x))) / exp(x)
                  end function
                  
                  def code(x):
                  	return math.fmod((x - -1.0), math.sqrt(math.cos(x))) / math.exp(x)
                  
                  function code(x)
                  	return Float64(rem(Float64(x - -1.0), sqrt(cos(x))) / exp(x))
                  end
                  
                  code[x_] := N[(N[With[{TMP1 = N[(x - -1.0), $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}
                  
                  \\
                  \frac{\left(\left(x - -1\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}
                  \end{array}
                  
                  Derivation
                  1. Initial program 9.0%

                    \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                  2. Taylor expanded in x around 0

                    \[\leadsto \left(\color{blue}{\left(1 + x\right)} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                  3. Step-by-step derivation
                    1. lower-+.f6438.2

                      \[\leadsto \left(\left(1 + \color{blue}{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                  4. Applied rewrites38.2%

                    \[\leadsto \left(\color{blue}{\left(1 + x\right)} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                  5. Step-by-step derivation
                    1. lift-*.f64N/A

                      \[\leadsto \color{blue}{\left(\left(1 + x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}} \]
                    2. lift-exp.f64N/A

                      \[\leadsto \left(\left(1 + x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot \color{blue}{e^{-x}} \]
                    3. lift-neg.f64N/A

                      \[\leadsto \left(\left(1 + x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{\color{blue}{\mathsf{neg}\left(x\right)}} \]
                    4. exp-negN/A

                      \[\leadsto \left(\left(1 + x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot \color{blue}{\frac{1}{e^{x}}} \]
                    5. lift-exp.f64N/A

                      \[\leadsto \left(\left(1 + x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot \frac{1}{\color{blue}{e^{x}}} \]
                    6. mult-flip-revN/A

                      \[\leadsto \color{blue}{\frac{\left(\left(1 + x\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
                    7. lower-/.f6438.2

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

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

                      \[\leadsto \frac{\left(\left(x + \color{blue}{1}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}} \]
                    10. add-flipN/A

                      \[\leadsto \frac{\left(\left(x - \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}} \]
                    11. metadata-evalN/A

                      \[\leadsto \frac{\left(\left(x - -1\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}} \]
                    12. lower--.f6438.2

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

                    \[\leadsto \color{blue}{\frac{\left(\left(x - -1\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
                  7. Add Preprocessing

                  Alternative 6: 38.2% accurate, 1.4× speedup?

                  \[\begin{array}{l} \\ \frac{\left(\left(x - -1\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{e^{x}} \end{array} \]
                  (FPCore (x)
                   :precision binary64
                   (/ (fmod (- x -1.0) (+ 1.0 (* -0.25 (pow x 2.0)))) (exp x)))
                  double code(double x) {
                  	return fmod((x - -1.0), (1.0 + (-0.25 * pow(x, 2.0)))) / exp(x);
                  }
                  
                  module fmin_fmax_functions
                      implicit none
                      private
                      public fmax
                      public fmin
                  
                      interface fmax
                          module procedure fmax88
                          module procedure fmax44
                          module procedure fmax84
                          module procedure fmax48
                      end interface
                      interface fmin
                          module procedure fmin88
                          module procedure fmin44
                          module procedure fmin84
                          module procedure fmin48
                      end interface
                  contains
                      real(8) function fmax88(x, y) result (res)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                      end function
                      real(4) function fmax44(x, y) result (res)
                          real(4), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                      end function
                      real(8) function fmax84(x, y) result(res)
                          real(8), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                      end function
                      real(8) function fmax48(x, y) result(res)
                          real(4), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                      end function
                      real(8) function fmin88(x, y) result (res)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                      end function
                      real(4) function fmin44(x, y) result (res)
                          real(4), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                      end function
                      real(8) function fmin84(x, y) result(res)
                          real(8), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                      end function
                      real(8) function fmin48(x, y) result(res)
                          real(4), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                      end function
                  end module
                  
                  real(8) function code(x)
                  use fmin_fmax_functions
                      real(8), intent (in) :: x
                      code = mod((x - (-1.0d0)), (1.0d0 + ((-0.25d0) * (x ** 2.0d0)))) / exp(x)
                  end function
                  
                  def code(x):
                  	return math.fmod((x - -1.0), (1.0 + (-0.25 * math.pow(x, 2.0)))) / math.exp(x)
                  
                  function code(x)
                  	return Float64(rem(Float64(x - -1.0), Float64(1.0 + Float64(-0.25 * (x ^ 2.0)))) / exp(x))
                  end
                  
                  code[x_] := N[(N[With[{TMP1 = N[(x - -1.0), $MachinePrecision], TMP2 = N[(1.0 + N[(-0.25 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]
                  
                  \begin{array}{l}
                  
                  \\
                  \frac{\left(\left(x - -1\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{e^{x}}
                  \end{array}
                  
                  Derivation
                  1. Initial program 9.0%

                    \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                  2. Taylor expanded in x around 0

                    \[\leadsto \left(\color{blue}{\left(1 + x\right)} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                  3. Step-by-step derivation
                    1. lower-+.f6438.2

                      \[\leadsto \left(\left(1 + \color{blue}{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                  4. Applied rewrites38.2%

                    \[\leadsto \left(\color{blue}{\left(1 + x\right)} \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                  5. Step-by-step derivation
                    1. lift-*.f64N/A

                      \[\leadsto \color{blue}{\left(\left(1 + x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}} \]
                    2. lift-exp.f64N/A

                      \[\leadsto \left(\left(1 + x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot \color{blue}{e^{-x}} \]
                    3. lift-neg.f64N/A

                      \[\leadsto \left(\left(1 + x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{\color{blue}{\mathsf{neg}\left(x\right)}} \]
                    4. exp-negN/A

                      \[\leadsto \left(\left(1 + x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot \color{blue}{\frac{1}{e^{x}}} \]
                    5. lift-exp.f64N/A

                      \[\leadsto \left(\left(1 + x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot \frac{1}{\color{blue}{e^{x}}} \]
                    6. mult-flip-revN/A

                      \[\leadsto \color{blue}{\frac{\left(\left(1 + x\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}} \]
                    7. lower-/.f6438.2

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

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

                      \[\leadsto \frac{\left(\left(x + \color{blue}{1}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}} \]
                    10. add-flipN/A

                      \[\leadsto \frac{\left(\left(x - \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}} \]
                    11. metadata-evalN/A

                      \[\leadsto \frac{\left(\left(x - -1\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}} \]
                    12. lower--.f6438.2

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

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

                    \[\leadsto \frac{\left(\left(x - -1\right) \bmod \color{blue}{\left(1 + \frac{-1}{4} \cdot {x}^{2}\right)}\right)}{e^{x}} \]
                  8. Step-by-step derivation
                    1. lower-+.f64N/A

                      \[\leadsto \frac{\left(\left(x - -1\right) \bmod \left(1 + \color{blue}{\frac{-1}{4} \cdot {x}^{2}}\right)\right)}{e^{x}} \]
                    2. lower-*.f64N/A

                      \[\leadsto \frac{\left(\left(x - -1\right) \bmod \left(1 + \frac{-1}{4} \cdot \color{blue}{{x}^{2}}\right)\right)}{e^{x}} \]
                    3. lower-pow.f6438.2

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

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

                  Alternative 7: 6.7% accurate, 2.0× speedup?

                  \[\begin{array}{l} \\ \left(\left(\frac{1}{e^{-x}}\right) \bmod \left(\mathsf{fma}\left(x \cdot x, -0.25, 1\right)\right)\right) \end{array} \]
                  (FPCore (x)
                   :precision binary64
                   (fmod (/ 1.0 (exp (- x))) (fma (* x x) -0.25 1.0)))
                  double code(double x) {
                  	return fmod((1.0 / exp(-x)), fma((x * x), -0.25, 1.0));
                  }
                  
                  function code(x)
                  	return rem(Float64(1.0 / exp(Float64(-x))), fma(Float64(x * x), -0.25, 1.0))
                  end
                  
                  code[x_] := N[With[{TMP1 = N[(1.0 / N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], TMP2 = N[(N[(x * x), $MachinePrecision] * -0.25 + 1.0), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]
                  
                  \begin{array}{l}
                  
                  \\
                  \left(\left(\frac{1}{e^{-x}}\right) \bmod \left(\mathsf{fma}\left(x \cdot x, -0.25, 1\right)\right)\right)
                  \end{array}
                  
                  Derivation
                  1. Initial program 9.0%

                    \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                  2. Taylor expanded in x around 0

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

                      \[\leadsto \left(\left(e^{x}\right) \bmod \color{blue}{\left(\sqrt{\cos x}\right)}\right) \]
                    2. lower-exp.f64N/A

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

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \]
                    4. lower-cos.f646.7

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \]
                  4. Applied rewrites6.7%

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

                    \[\leadsto \left(\left(e^{x}\right) \bmod \left(1 + \color{blue}{\frac{-1}{4} \cdot {x}^{2}}\right)\right) \]
                  6. Step-by-step derivation
                    1. lower-+.f64N/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(1 + \frac{-1}{4} \cdot \color{blue}{{x}^{2}}\right)\right) \]
                    2. lower-*.f64N/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(1 + \frac{-1}{4} \cdot {x}^{\color{blue}{2}}\right)\right) \]
                    3. lower-pow.f646.7

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right) \]
                  7. Applied rewrites6.7%

                    \[\leadsto \left(\left(e^{x}\right) \bmod \left(1 + \color{blue}{-0.25 \cdot {x}^{2}}\right)\right) \]
                  8. Step-by-step derivation
                    1. lift-+.f64N/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(1 + \frac{-1}{4} \cdot \color{blue}{{x}^{2}}\right)\right) \]
                    2. +-commutativeN/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(\frac{-1}{4} \cdot {x}^{2} + 1\right)\right) \]
                    3. lift-*.f64N/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(\frac{-1}{4} \cdot {x}^{2} + 1\right)\right) \]
                    4. *-commutativeN/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left({x}^{2} \cdot \frac{-1}{4} + 1\right)\right) \]
                    5. lift-pow.f64N/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left({x}^{2} \cdot \frac{-1}{4} + 1\right)\right) \]
                    6. unpow2N/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(\left(x \cdot x\right) \cdot \frac{-1}{4} + 1\right)\right) \]
                    7. lower-*.f32N/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(\left(x \cdot x\right) \cdot \frac{-1}{4} + 1\right)\right) \]
                    8. lower-special-*.f32N/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(\left(x \cdot x\right) \cdot \frac{-1}{4} + 1\right)\right) \]
                    9. lower-fma.f64N/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(\mathsf{fma}\left(x \cdot x, \frac{-1}{4}, 1\right)\right)\right) \]
                    10. lower-special-*.f646.7

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(\mathsf{fma}\left(x \cdot x, -0.25, 1\right)\right)\right) \]
                  9. Applied rewrites6.7%

                    \[\leadsto \left(\left(e^{x}\right) \bmod \left(\mathsf{fma}\left(x \cdot x, -0.25, 1\right)\right)\right) \]
                  10. Step-by-step derivation
                    1. *-rgt-identityN/A

                      \[\leadsto \left(\left(e^{x} \cdot 1\right) \bmod \left(\mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{-1}{4}, 1\right)\right)\right) \]
                    2. metadata-evalN/A

                      \[\leadsto \left(\left(e^{x} \cdot \frac{1}{1}\right) \bmod \left(\mathsf{fma}\left(x \cdot \color{blue}{x}, \frac{-1}{4}, 1\right)\right)\right) \]
                    3. mult-flip-revN/A

                      \[\leadsto \left(\left(\frac{e^{x}}{1}\right) \bmod \left(\mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{-1}{4}, 1\right)\right)\right) \]
                    4. div-flipN/A

                      \[\leadsto \left(\left(\frac{1}{\frac{1}{e^{x}}}\right) \bmod \left(\mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{-1}{4}, 1\right)\right)\right) \]
                    5. lower-special-/.f32N/A

                      \[\leadsto \left(\left(\frac{1}{\frac{1}{e^{x}}}\right) \bmod \left(\mathsf{fma}\left(x \cdot \color{blue}{x}, \frac{-1}{4}, 1\right)\right)\right) \]
                    6. lower-/.f32N/A

                      \[\leadsto \left(\left(\frac{1}{\frac{1}{e^{x}}}\right) \bmod \left(\mathsf{fma}\left(x \cdot \color{blue}{x}, \frac{-1}{4}, 1\right)\right)\right) \]
                    7. lift-exp.f64N/A

                      \[\leadsto \left(\left(\frac{1}{\frac{1}{e^{x}}}\right) \bmod \left(\mathsf{fma}\left(x \cdot x, \frac{-1}{4}, 1\right)\right)\right) \]
                    8. exp-negN/A

                      \[\leadsto \left(\left(\frac{1}{e^{\mathsf{neg}\left(x\right)}}\right) \bmod \left(\mathsf{fma}\left(x \cdot \color{blue}{x}, \frac{-1}{4}, 1\right)\right)\right) \]
                    9. lift-neg.f64N/A

                      \[\leadsto \left(\left(\frac{1}{e^{-x}}\right) \bmod \left(\mathsf{fma}\left(x \cdot x, \frac{-1}{4}, 1\right)\right)\right) \]
                    10. lift-exp.f64N/A

                      \[\leadsto \left(\left(\frac{1}{e^{-x}}\right) \bmod \left(\mathsf{fma}\left(x \cdot \color{blue}{x}, \frac{-1}{4}, 1\right)\right)\right) \]
                    11. lower-special-/.f646.6

                      \[\leadsto \left(\left(\frac{1}{e^{-x}}\right) \bmod \left(\mathsf{fma}\left(\color{blue}{x \cdot x}, -0.25, 1\right)\right)\right) \]
                  11. Applied rewrites6.6%

                    \[\leadsto \left(\left(\frac{1}{e^{-x}}\right) \bmod \left(\mathsf{fma}\left(\color{blue}{x \cdot x}, -0.25, 1\right)\right)\right) \]
                  12. Add Preprocessing

                  Alternative 8: 6.6% accurate, 2.2× speedup?

                  \[\begin{array}{l} \\ \left(\left(e^{x}\right) \bmod \left(\mathsf{fma}\left(x \cdot x, -0.25, 1\right)\right)\right) \end{array} \]
                  (FPCore (x) :precision binary64 (fmod (exp x) (fma (* x x) -0.25 1.0)))
                  double code(double x) {
                  	return fmod(exp(x), fma((x * x), -0.25, 1.0));
                  }
                  
                  function code(x)
                  	return rem(exp(x), fma(Float64(x * x), -0.25, 1.0))
                  end
                  
                  code[x_] := N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(N[(x * x), $MachinePrecision] * -0.25 + 1.0), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]
                  
                  \begin{array}{l}
                  
                  \\
                  \left(\left(e^{x}\right) \bmod \left(\mathsf{fma}\left(x \cdot x, -0.25, 1\right)\right)\right)
                  \end{array}
                  
                  Derivation
                  1. Initial program 9.0%

                    \[\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \]
                  2. Taylor expanded in x around 0

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

                      \[\leadsto \left(\left(e^{x}\right) \bmod \color{blue}{\left(\sqrt{\cos x}\right)}\right) \]
                    2. lower-exp.f64N/A

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

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \]
                    4. lower-cos.f646.7

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \]
                  4. Applied rewrites6.7%

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

                    \[\leadsto \left(\left(e^{x}\right) \bmod \left(1 + \color{blue}{\frac{-1}{4} \cdot {x}^{2}}\right)\right) \]
                  6. Step-by-step derivation
                    1. lower-+.f64N/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(1 + \frac{-1}{4} \cdot \color{blue}{{x}^{2}}\right)\right) \]
                    2. lower-*.f64N/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(1 + \frac{-1}{4} \cdot {x}^{\color{blue}{2}}\right)\right) \]
                    3. lower-pow.f646.7

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right) \]
                  7. Applied rewrites6.7%

                    \[\leadsto \left(\left(e^{x}\right) \bmod \left(1 + \color{blue}{-0.25 \cdot {x}^{2}}\right)\right) \]
                  8. Step-by-step derivation
                    1. lift-+.f64N/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(1 + \frac{-1}{4} \cdot \color{blue}{{x}^{2}}\right)\right) \]
                    2. +-commutativeN/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(\frac{-1}{4} \cdot {x}^{2} + 1\right)\right) \]
                    3. lift-*.f64N/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(\frac{-1}{4} \cdot {x}^{2} + 1\right)\right) \]
                    4. *-commutativeN/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left({x}^{2} \cdot \frac{-1}{4} + 1\right)\right) \]
                    5. lift-pow.f64N/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left({x}^{2} \cdot \frac{-1}{4} + 1\right)\right) \]
                    6. unpow2N/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(\left(x \cdot x\right) \cdot \frac{-1}{4} + 1\right)\right) \]
                    7. lower-*.f32N/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(\left(x \cdot x\right) \cdot \frac{-1}{4} + 1\right)\right) \]
                    8. lower-special-*.f32N/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(\left(x \cdot x\right) \cdot \frac{-1}{4} + 1\right)\right) \]
                    9. lower-fma.f64N/A

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(\mathsf{fma}\left(x \cdot x, \frac{-1}{4}, 1\right)\right)\right) \]
                    10. lower-special-*.f646.7

                      \[\leadsto \left(\left(e^{x}\right) \bmod \left(\mathsf{fma}\left(x \cdot x, -0.25, 1\right)\right)\right) \]
                  9. Applied rewrites6.7%

                    \[\leadsto \left(\left(e^{x}\right) \bmod \left(\mathsf{fma}\left(x \cdot x, -0.25, 1\right)\right)\right) \]
                  10. Add Preprocessing

                  Reproduce

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