mixedcos

Percentage Accurate: 66.7% → 97.2%
Time: 10.1s
Alternatives: 17
Speedup: 9.0×

Specification

?
\[\begin{array}{l} \\ \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \end{array} \]
(FPCore (x c s)
 :precision binary64
 (/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))
double code(double x, double c, double s) {
	return cos((2.0 * x)) / (pow(c, 2.0) * ((x * pow(s, 2.0)) * x));
}
real(8) function code(x, c, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c
    real(8), intent (in) :: s
    code = cos((2.0d0 * x)) / ((c ** 2.0d0) * ((x * (s ** 2.0d0)) * x))
end function
public static double code(double x, double c, double s) {
	return Math.cos((2.0 * x)) / (Math.pow(c, 2.0) * ((x * Math.pow(s, 2.0)) * x));
}
def code(x, c, s):
	return math.cos((2.0 * x)) / (math.pow(c, 2.0) * ((x * math.pow(s, 2.0)) * x))
function code(x, c, s)
	return Float64(cos(Float64(2.0 * x)) / Float64((c ^ 2.0) * Float64(Float64(x * (s ^ 2.0)) * x)))
end
function tmp = code(x, c, s)
	tmp = cos((2.0 * x)) / ((c ^ 2.0) * ((x * (s ^ 2.0)) * x));
end
code[x_, c_, s_] := N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[Power[c, 2.0], $MachinePrecision] * N[(N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}
\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 17 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: 66.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \end{array} \]
(FPCore (x c s)
 :precision binary64
 (/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))
double code(double x, double c, double s) {
	return cos((2.0 * x)) / (pow(c, 2.0) * ((x * pow(s, 2.0)) * x));
}
real(8) function code(x, c, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c
    real(8), intent (in) :: s
    code = cos((2.0d0 * x)) / ((c ** 2.0d0) * ((x * (s ** 2.0d0)) * x))
end function
public static double code(double x, double c, double s) {
	return Math.cos((2.0 * x)) / (Math.pow(c, 2.0) * ((x * Math.pow(s, 2.0)) * x));
}
def code(x, c, s):
	return math.cos((2.0 * x)) / (math.pow(c, 2.0) * ((x * math.pow(s, 2.0)) * x))
function code(x, c, s)
	return Float64(cos(Float64(2.0 * x)) / Float64((c ^ 2.0) * Float64(Float64(x * (s ^ 2.0)) * x)))
end
function tmp = code(x, c, s)
	tmp = cos((2.0 * x)) / ((c ^ 2.0) * ((x * (s ^ 2.0)) * x));
end
code[x_, c_, s_] := N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[Power[c, 2.0], $MachinePrecision] * N[(N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}
\end{array}

Alternative 1: 97.2% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \frac{\cos \left(2 \cdot x\right)}{{\left(\left(s \cdot c\right) \cdot x\right)}^{2}} \end{array} \]
(FPCore (x c s)
 :precision binary64
 (/ (cos (* 2.0 x)) (pow (* (* s c) x) 2.0)))
double code(double x, double c, double s) {
	return cos((2.0 * x)) / pow(((s * c) * x), 2.0);
}
real(8) function code(x, c, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c
    real(8), intent (in) :: s
    code = cos((2.0d0 * x)) / (((s * c) * x) ** 2.0d0)
end function
public static double code(double x, double c, double s) {
	return Math.cos((2.0 * x)) / Math.pow(((s * c) * x), 2.0);
}
def code(x, c, s):
	return math.cos((2.0 * x)) / math.pow(((s * c) * x), 2.0)
function code(x, c, s)
	return Float64(cos(Float64(2.0 * x)) / (Float64(Float64(s * c) * x) ^ 2.0))
end
function tmp = code(x, c, s)
	tmp = cos((2.0 * x)) / (((s * c) * x) ^ 2.0);
end
code[x_, c_, s_] := N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[Power[N[(N[(s * c), $MachinePrecision] * x), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\cos \left(2 \cdot x\right)}{{\left(\left(s \cdot c\right) \cdot x\right)}^{2}}
\end{array}
Derivation
  1. Initial program 66.2%

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \frac{\cos \color{blue}{\left(2 \cdot x\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
    2. *-commutativeN/A

      \[\leadsto \frac{\cos \color{blue}{\left(x \cdot 2\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
    3. lower-*.f6466.2

      \[\leadsto \frac{\cos \color{blue}{\left(x \cdot 2\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
    4. lift-*.f64N/A

      \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
    5. *-commutativeN/A

      \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right) \cdot {c}^{2}}} \]
    6. lift-*.f64N/A

      \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \cdot {c}^{2}} \]
    7. *-commutativeN/A

      \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \cdot {c}^{2}} \]
    8. lift-*.f64N/A

      \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(x \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}\right) \cdot {c}^{2}} \]
    9. associate-*r*N/A

      \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot x\right) \cdot {s}^{2}\right)} \cdot {c}^{2}} \]
    10. associate-*l*N/A

      \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot x\right) \cdot \left({s}^{2} \cdot {c}^{2}\right)}} \]
    11. pow2N/A

      \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{x}^{2}} \cdot \left({s}^{2} \cdot {c}^{2}\right)} \]
    12. *-commutativeN/A

      \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}} \]
    13. lift-pow.f64N/A

      \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \left(\color{blue}{{c}^{2}} \cdot {s}^{2}\right)} \]
    14. lift-pow.f64N/A

      \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \left({c}^{2} \cdot \color{blue}{{s}^{2}}\right)} \]
    15. pow-prod-downN/A

      \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \color{blue}{{\left(c \cdot s\right)}^{2}}} \]
    16. pow-prod-downN/A

      \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
    17. lower-pow.f64N/A

      \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
    18. lower-*.f64N/A

      \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}}^{2}} \]
    19. lower-*.f6498.1

      \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{\left(x \cdot \color{blue}{\left(c \cdot s\right)}\right)}^{2}} \]
  4. Applied rewrites98.1%

    \[\leadsto \color{blue}{\frac{\cos \left(x \cdot 2\right)}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
  5. Final simplification98.1%

    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{\left(\left(s \cdot c\right) \cdot x\right)}^{2}} \]
  6. Add Preprocessing

Alternative 2: 82.2% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot x\right) \cdot x\right) \cdot {c}^{2}} \leq -5 \cdot 10^{-121}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(s \cdot x\right) \cdot \left(\left(\left(s \cdot c\right) \cdot c\right) \cdot x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{{\left(\left(s \cdot c\right) \cdot x\right)}^{2}}\\ \end{array} \end{array} \]
(FPCore (x c s)
 :precision binary64
 (if (<= (/ (cos (* 2.0 x)) (* (* (* (pow s 2.0) x) x) (pow c 2.0))) -5e-121)
   (/ (fma -2.0 (* x x) 1.0) (* (* s x) (* (* (* s c) c) x)))
   (/ 1.0 (pow (* (* s c) x) 2.0))))
double code(double x, double c, double s) {
	double tmp;
	if ((cos((2.0 * x)) / (((pow(s, 2.0) * x) * x) * pow(c, 2.0))) <= -5e-121) {
		tmp = fma(-2.0, (x * x), 1.0) / ((s * x) * (((s * c) * c) * x));
	} else {
		tmp = 1.0 / pow(((s * c) * x), 2.0);
	}
	return tmp;
}
function code(x, c, s)
	tmp = 0.0
	if (Float64(cos(Float64(2.0 * x)) / Float64(Float64(Float64((s ^ 2.0) * x) * x) * (c ^ 2.0))) <= -5e-121)
		tmp = Float64(fma(-2.0, Float64(x * x), 1.0) / Float64(Float64(s * x) * Float64(Float64(Float64(s * c) * c) * x)));
	else
		tmp = Float64(1.0 / (Float64(Float64(s * c) * x) ^ 2.0));
	end
	return tmp
end
code[x_, c_, s_] := If[LessEqual[N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[(N[(N[Power[s, 2.0], $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-121], N[(N[(-2.0 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[(s * x), $MachinePrecision] * N[(N[(N[(s * c), $MachinePrecision] * c), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Power[N[(N[(s * c), $MachinePrecision] * x), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot x\right) \cdot x\right) \cdot {c}^{2}} \leq -5 \cdot 10^{-121}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(s \cdot x\right) \cdot \left(\left(\left(s \cdot c\right) \cdot c\right) \cdot x\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{{\left(\left(s \cdot c\right) \cdot x\right)}^{2}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) < -4.99999999999999989e-121

    1. Initial program 52.5%

      \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(x \cdot \left(x \cdot {s}^{2}\right)\right)}} \]
      4. associate-*r*N/A

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot x\right) \cdot \left(x \cdot {s}^{2}\right)}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}} \]
      6. *-commutativeN/A

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left({s}^{2} \cdot x\right)}} \]
      7. lift-pow.f64N/A

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \left(\color{blue}{{s}^{2}} \cdot x\right)} \]
      8. unpow2N/A

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \left(\color{blue}{\left(s \cdot s\right)} \cdot x\right)} \]
      9. associate-*l*N/A

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left(s \cdot \left(s \cdot x\right)\right)}} \]
      10. associate-*r*N/A

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right) \cdot \left(s \cdot x\right)}} \]
      11. lower-*.f64N/A

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right) \cdot \left(s \cdot x\right)}} \]
      12. lower-*.f64N/A

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right)} \cdot \left(s \cdot x\right)} \]
      13. *-commutativeN/A

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(x \cdot {c}^{2}\right)} \cdot s\right) \cdot \left(s \cdot x\right)} \]
      14. lower-*.f64N/A

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(x \cdot {c}^{2}\right)} \cdot s\right) \cdot \left(s \cdot x\right)} \]
      15. lift-pow.f64N/A

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{{c}^{2}}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
      16. unpow2N/A

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
      17. lower-*.f64N/A

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
      18. *-commutativeN/A

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \color{blue}{\left(x \cdot s\right)}} \]
      19. lower-*.f6485.3

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \color{blue}{\left(x \cdot s\right)}} \]
    4. Applied rewrites85.3%

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)}} \]
    5. Taylor expanded in x around 0

      \[\leadsto \frac{\color{blue}{1 + -2 \cdot {x}^{2}}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
    6. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{-2 \cdot {x}^{2} + 1}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-2, {x}^{2}, 1\right)}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
      3. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(-2, \color{blue}{x \cdot x}, 1\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
      4. lower-*.f6424.6

        \[\leadsto \frac{\mathsf{fma}\left(-2, \color{blue}{x \cdot x}, 1\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
    7. Applied rewrites24.6%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-2, x \cdot x, 1\right)}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\color{blue}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right)} \cdot \left(x \cdot s\right)} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(\color{blue}{\left(x \cdot \left(c \cdot c\right)\right)} \cdot s\right) \cdot \left(x \cdot s\right)} \]
      3. associate-*l*N/A

        \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\color{blue}{\left(x \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)} \cdot \left(x \cdot s\right)} \]
      4. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\color{blue}{\left(\left(\left(c \cdot c\right) \cdot s\right) \cdot x\right)} \cdot \left(x \cdot s\right)} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\color{blue}{\left(\left(\left(c \cdot c\right) \cdot s\right) \cdot x\right)} \cdot \left(x \cdot s\right)} \]
      6. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(\color{blue}{\left(s \cdot \left(c \cdot c\right)\right)} \cdot x\right) \cdot \left(x \cdot s\right)} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(\left(s \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot x\right) \cdot \left(x \cdot s\right)} \]
      8. associate-*r*N/A

        \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(\color{blue}{\left(\left(s \cdot c\right) \cdot c\right)} \cdot x\right) \cdot \left(x \cdot s\right)} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(\left(\color{blue}{\left(s \cdot c\right)} \cdot c\right) \cdot x\right) \cdot \left(x \cdot s\right)} \]
      10. lower-*.f6424.7

        \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(\color{blue}{\left(\left(s \cdot c\right) \cdot c\right)} \cdot x\right) \cdot \left(x \cdot s\right)} \]
    9. Applied rewrites24.7%

      \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\color{blue}{\left(\left(\left(s \cdot c\right) \cdot c\right) \cdot x\right)} \cdot \left(x \cdot s\right)} \]

    if -4.99999999999999989e-121 < (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x)))

    1. Initial program 67.3%

      \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\cos \color{blue}{\left(2 \cdot x\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\cos \color{blue}{\left(x \cdot 2\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
      3. lower-*.f6467.3

        \[\leadsto \frac{\cos \color{blue}{\left(x \cdot 2\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right) \cdot {c}^{2}}} \]
      6. lift-*.f64N/A

        \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \cdot {c}^{2}} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \cdot {c}^{2}} \]
      8. lift-*.f64N/A

        \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(x \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}\right) \cdot {c}^{2}} \]
      9. associate-*r*N/A

        \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot x\right) \cdot {s}^{2}\right)} \cdot {c}^{2}} \]
      10. associate-*l*N/A

        \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot x\right) \cdot \left({s}^{2} \cdot {c}^{2}\right)}} \]
      11. pow2N/A

        \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{x}^{2}} \cdot \left({s}^{2} \cdot {c}^{2}\right)} \]
      12. *-commutativeN/A

        \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}} \]
      13. lift-pow.f64N/A

        \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \left(\color{blue}{{c}^{2}} \cdot {s}^{2}\right)} \]
      14. lift-pow.f64N/A

        \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \left({c}^{2} \cdot \color{blue}{{s}^{2}}\right)} \]
      15. pow-prod-downN/A

        \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \color{blue}{{\left(c \cdot s\right)}^{2}}} \]
      16. pow-prod-downN/A

        \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
      17. lower-pow.f64N/A

        \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
      18. lower-*.f64N/A

        \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}}^{2}} \]
      19. lower-*.f6498.4

        \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{\left(x \cdot \color{blue}{\left(c \cdot s\right)}\right)}^{2}} \]
    4. Applied rewrites98.4%

      \[\leadsto \color{blue}{\frac{\cos \left(x \cdot 2\right)}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
    5. Taylor expanded in x around 0

      \[\leadsto \frac{\color{blue}{1}}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}} \]
    6. Step-by-step derivation
      1. Applied rewrites85.9%

        \[\leadsto \frac{\color{blue}{1}}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}} \]
    7. Recombined 2 regimes into one program.
    8. Final simplification81.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot x\right) \cdot x\right) \cdot {c}^{2}} \leq -5 \cdot 10^{-121}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(s \cdot x\right) \cdot \left(\left(\left(s \cdot c\right) \cdot c\right) \cdot x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{{\left(\left(s \cdot c\right) \cdot x\right)}^{2}}\\ \end{array} \]
    9. Add Preprocessing

    Alternative 3: 82.4% accurate, 0.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot x\right) \cdot x\right) \cdot {c}^{2}} \leq -5 \cdot 10^{-121}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(s \cdot x\right) \cdot \left(\left(\left(s \cdot c\right) \cdot c\right) \cdot x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(c \cdot x\right) \cdot s} \cdot \frac{\frac{1}{s}}{c \cdot x}\\ \end{array} \end{array} \]
    (FPCore (x c s)
     :precision binary64
     (if (<= (/ (cos (* 2.0 x)) (* (* (* (pow s 2.0) x) x) (pow c 2.0))) -5e-121)
       (/ (fma -2.0 (* x x) 1.0) (* (* s x) (* (* (* s c) c) x)))
       (* (/ 1.0 (* (* c x) s)) (/ (/ 1.0 s) (* c x)))))
    double code(double x, double c, double s) {
    	double tmp;
    	if ((cos((2.0 * x)) / (((pow(s, 2.0) * x) * x) * pow(c, 2.0))) <= -5e-121) {
    		tmp = fma(-2.0, (x * x), 1.0) / ((s * x) * (((s * c) * c) * x));
    	} else {
    		tmp = (1.0 / ((c * x) * s)) * ((1.0 / s) / (c * x));
    	}
    	return tmp;
    }
    
    function code(x, c, s)
    	tmp = 0.0
    	if (Float64(cos(Float64(2.0 * x)) / Float64(Float64(Float64((s ^ 2.0) * x) * x) * (c ^ 2.0))) <= -5e-121)
    		tmp = Float64(fma(-2.0, Float64(x * x), 1.0) / Float64(Float64(s * x) * Float64(Float64(Float64(s * c) * c) * x)));
    	else
    		tmp = Float64(Float64(1.0 / Float64(Float64(c * x) * s)) * Float64(Float64(1.0 / s) / Float64(c * x)));
    	end
    	return tmp
    end
    
    code[x_, c_, s_] := If[LessEqual[N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[(N[(N[Power[s, 2.0], $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-121], N[(N[(-2.0 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[(s * x), $MachinePrecision] * N[(N[(N[(s * c), $MachinePrecision] * c), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[(c * x), $MachinePrecision] * s), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / s), $MachinePrecision] / N[(c * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot x\right) \cdot x\right) \cdot {c}^{2}} \leq -5 \cdot 10^{-121}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(s \cdot x\right) \cdot \left(\left(\left(s \cdot c\right) \cdot c\right) \cdot x\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{1}{\left(c \cdot x\right) \cdot s} \cdot \frac{\frac{1}{s}}{c \cdot x}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) < -4.99999999999999989e-121

      1. Initial program 52.5%

        \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
        2. lift-*.f64N/A

          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
        3. *-commutativeN/A

          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(x \cdot \left(x \cdot {s}^{2}\right)\right)}} \]
        4. associate-*r*N/A

          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot x\right) \cdot \left(x \cdot {s}^{2}\right)}} \]
        5. lift-*.f64N/A

          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}} \]
        6. *-commutativeN/A

          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left({s}^{2} \cdot x\right)}} \]
        7. lift-pow.f64N/A

          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \left(\color{blue}{{s}^{2}} \cdot x\right)} \]
        8. unpow2N/A

          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \left(\color{blue}{\left(s \cdot s\right)} \cdot x\right)} \]
        9. associate-*l*N/A

          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left(s \cdot \left(s \cdot x\right)\right)}} \]
        10. associate-*r*N/A

          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right) \cdot \left(s \cdot x\right)}} \]
        11. lower-*.f64N/A

          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right) \cdot \left(s \cdot x\right)}} \]
        12. lower-*.f64N/A

          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right)} \cdot \left(s \cdot x\right)} \]
        13. *-commutativeN/A

          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(x \cdot {c}^{2}\right)} \cdot s\right) \cdot \left(s \cdot x\right)} \]
        14. lower-*.f64N/A

          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(x \cdot {c}^{2}\right)} \cdot s\right) \cdot \left(s \cdot x\right)} \]
        15. lift-pow.f64N/A

          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{{c}^{2}}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
        16. unpow2N/A

          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
        17. lower-*.f64N/A

          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
        18. *-commutativeN/A

          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \color{blue}{\left(x \cdot s\right)}} \]
        19. lower-*.f6485.3

          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \color{blue}{\left(x \cdot s\right)}} \]
      4. Applied rewrites85.3%

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)}} \]
      5. Taylor expanded in x around 0

        \[\leadsto \frac{\color{blue}{1 + -2 \cdot {x}^{2}}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
      6. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \frac{\color{blue}{-2 \cdot {x}^{2} + 1}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
        2. lower-fma.f64N/A

          \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-2, {x}^{2}, 1\right)}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
        3. unpow2N/A

          \[\leadsto \frac{\mathsf{fma}\left(-2, \color{blue}{x \cdot x}, 1\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
        4. lower-*.f6424.6

          \[\leadsto \frac{\mathsf{fma}\left(-2, \color{blue}{x \cdot x}, 1\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
      7. Applied rewrites24.6%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-2, x \cdot x, 1\right)}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
      8. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\color{blue}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right)} \cdot \left(x \cdot s\right)} \]
        2. lift-*.f64N/A

          \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(\color{blue}{\left(x \cdot \left(c \cdot c\right)\right)} \cdot s\right) \cdot \left(x \cdot s\right)} \]
        3. associate-*l*N/A

          \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\color{blue}{\left(x \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)} \cdot \left(x \cdot s\right)} \]
        4. *-commutativeN/A

          \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\color{blue}{\left(\left(\left(c \cdot c\right) \cdot s\right) \cdot x\right)} \cdot \left(x \cdot s\right)} \]
        5. lower-*.f64N/A

          \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\color{blue}{\left(\left(\left(c \cdot c\right) \cdot s\right) \cdot x\right)} \cdot \left(x \cdot s\right)} \]
        6. *-commutativeN/A

          \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(\color{blue}{\left(s \cdot \left(c \cdot c\right)\right)} \cdot x\right) \cdot \left(x \cdot s\right)} \]
        7. lift-*.f64N/A

          \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(\left(s \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot x\right) \cdot \left(x \cdot s\right)} \]
        8. associate-*r*N/A

          \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(\color{blue}{\left(\left(s \cdot c\right) \cdot c\right)} \cdot x\right) \cdot \left(x \cdot s\right)} \]
        9. lift-*.f64N/A

          \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(\left(\color{blue}{\left(s \cdot c\right)} \cdot c\right) \cdot x\right) \cdot \left(x \cdot s\right)} \]
        10. lower-*.f6424.7

          \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(\color{blue}{\left(\left(s \cdot c\right) \cdot c\right)} \cdot x\right) \cdot \left(x \cdot s\right)} \]
      9. Applied rewrites24.7%

        \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\color{blue}{\left(\left(\left(s \cdot c\right) \cdot c\right) \cdot x\right)} \cdot \left(x \cdot s\right)} \]

      if -4.99999999999999989e-121 < (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x)))

      1. Initial program 67.3%

        \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \frac{\cos \color{blue}{\left(2 \cdot x\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
        2. *-commutativeN/A

          \[\leadsto \frac{\cos \color{blue}{\left(x \cdot 2\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
        3. lower-*.f6467.3

          \[\leadsto \frac{\cos \color{blue}{\left(x \cdot 2\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
        4. lift-*.f64N/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
        5. *-commutativeN/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right) \cdot {c}^{2}}} \]
        6. lift-*.f64N/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \cdot {c}^{2}} \]
        7. *-commutativeN/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \cdot {c}^{2}} \]
        8. lift-*.f64N/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(x \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}\right) \cdot {c}^{2}} \]
        9. associate-*r*N/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot x\right) \cdot {s}^{2}\right)} \cdot {c}^{2}} \]
        10. associate-*l*N/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot x\right) \cdot \left({s}^{2} \cdot {c}^{2}\right)}} \]
        11. pow2N/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{x}^{2}} \cdot \left({s}^{2} \cdot {c}^{2}\right)} \]
        12. *-commutativeN/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}} \]
        13. lift-pow.f64N/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \left(\color{blue}{{c}^{2}} \cdot {s}^{2}\right)} \]
        14. lift-pow.f64N/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \left({c}^{2} \cdot \color{blue}{{s}^{2}}\right)} \]
        15. pow-prod-downN/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \color{blue}{{\left(c \cdot s\right)}^{2}}} \]
        16. pow-prod-downN/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
        17. lower-pow.f64N/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
        18. lower-*.f64N/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}}^{2}} \]
        19. lower-*.f6498.4

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{\left(x \cdot \color{blue}{\left(c \cdot s\right)}\right)}^{2}} \]
      4. Applied rewrites98.4%

        \[\leadsto \color{blue}{\frac{\cos \left(x \cdot 2\right)}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
      5. Step-by-step derivation
        1. lift-pow.f64N/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
        2. unpow2N/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)}} \]
        3. lower-*.f6498.4

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)}} \]
        4. lift-*.f64N/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right)} \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
        5. lift-*.f64N/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(x \cdot \color{blue}{\left(c \cdot s\right)}\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
        6. associate-*r*N/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot c\right) \cdot s\right)} \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
        7. *-commutativeN/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\color{blue}{\left(c \cdot x\right)} \cdot s\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
        8. lower-*.f64N/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right)} \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
        9. lower-*.f6496.5

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\color{blue}{\left(c \cdot x\right)} \cdot s\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
        10. lift-*.f64N/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}} \]
        11. lift-*.f64N/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(x \cdot \color{blue}{\left(c \cdot s\right)}\right)} \]
        12. associate-*r*N/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \color{blue}{\left(\left(x \cdot c\right) \cdot s\right)}} \]
        13. *-commutativeN/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\color{blue}{\left(c \cdot x\right)} \cdot s\right)} \]
        14. lower-*.f64N/A

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \color{blue}{\left(\left(c \cdot x\right) \cdot s\right)}} \]
        15. lower-*.f6497.7

          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\color{blue}{\left(c \cdot x\right)} \cdot s\right)} \]
      6. Applied rewrites97.7%

        \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)}} \]
      7. Taylor expanded in x around 0

        \[\leadsto \frac{\color{blue}{1}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
      8. Step-by-step derivation
        1. Applied rewrites85.5%

          \[\leadsto \frac{\color{blue}{1}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
        2. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{1}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)}} \]
          2. lift-*.f64N/A

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

            \[\leadsto \color{blue}{\frac{\frac{1}{\left(c \cdot x\right) \cdot s}}{\left(c \cdot x\right) \cdot s}} \]
          4. div-invN/A

            \[\leadsto \color{blue}{\frac{1}{\left(c \cdot x\right) \cdot s} \cdot \frac{1}{\left(c \cdot x\right) \cdot s}} \]
          5. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{1}{\left(c \cdot x\right) \cdot s} \cdot \frac{1}{\left(c \cdot x\right) \cdot s}} \]
          6. lift-*.f64N/A

            \[\leadsto \frac{1}{\color{blue}{\left(c \cdot x\right) \cdot s}} \cdot \frac{1}{\left(c \cdot x\right) \cdot s} \]
          7. *-commutativeN/A

            \[\leadsto \frac{1}{\color{blue}{s \cdot \left(c \cdot x\right)}} \cdot \frac{1}{\left(c \cdot x\right) \cdot s} \]
          8. associate-/r*N/A

            \[\leadsto \color{blue}{\frac{\frac{1}{s}}{c \cdot x}} \cdot \frac{1}{\left(c \cdot x\right) \cdot s} \]
          9. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{1}{s}}{c \cdot x}} \cdot \frac{1}{\left(c \cdot x\right) \cdot s} \]
          10. lower-/.f64N/A

            \[\leadsto \frac{\color{blue}{\frac{1}{s}}}{c \cdot x} \cdot \frac{1}{\left(c \cdot x\right) \cdot s} \]
          11. lower-/.f64N/A

            \[\leadsto \frac{\frac{1}{s}}{c \cdot x} \cdot \color{blue}{\frac{1}{\left(c \cdot x\right) \cdot s}} \]
          12. lift-*.f64N/A

            \[\leadsto \frac{\frac{1}{s}}{c \cdot x} \cdot \frac{1}{\color{blue}{\left(c \cdot x\right) \cdot s}} \]
          13. *-commutativeN/A

            \[\leadsto \frac{\frac{1}{s}}{c \cdot x} \cdot \frac{1}{\color{blue}{s \cdot \left(c \cdot x\right)}} \]
          14. lower-*.f64N/A

            \[\leadsto \frac{\frac{1}{s}}{c \cdot x} \cdot \frac{1}{\color{blue}{s \cdot \left(c \cdot x\right)}} \]
        3. Applied rewrites85.6%

          \[\leadsto \color{blue}{\frac{\frac{1}{s}}{c \cdot x} \cdot \frac{1}{s \cdot \left(c \cdot x\right)}} \]
      9. Recombined 2 regimes into one program.
      10. Final simplification80.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot x\right) \cdot x\right) \cdot {c}^{2}} \leq -5 \cdot 10^{-121}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(s \cdot x\right) \cdot \left(\left(\left(s \cdot c\right) \cdot c\right) \cdot x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(c \cdot x\right) \cdot s} \cdot \frac{\frac{1}{s}}{c \cdot x}\\ \end{array} \]
      11. Add Preprocessing

      Alternative 4: 82.4% accurate, 0.9× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(c \cdot x\right) \cdot s\\ \mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot x\right) \cdot x\right) \cdot {c}^{2}} \leq -5 \cdot 10^{-121}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(s \cdot x\right) \cdot \left(\left(\left(s \cdot c\right) \cdot c\right) \cdot x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{t\_0}}{t\_0}\\ \end{array} \end{array} \]
      (FPCore (x c s)
       :precision binary64
       (let* ((t_0 (* (* c x) s)))
         (if (<= (/ (cos (* 2.0 x)) (* (* (* (pow s 2.0) x) x) (pow c 2.0))) -5e-121)
           (/ (fma -2.0 (* x x) 1.0) (* (* s x) (* (* (* s c) c) x)))
           (/ (/ 1.0 t_0) t_0))))
      double code(double x, double c, double s) {
      	double t_0 = (c * x) * s;
      	double tmp;
      	if ((cos((2.0 * x)) / (((pow(s, 2.0) * x) * x) * pow(c, 2.0))) <= -5e-121) {
      		tmp = fma(-2.0, (x * x), 1.0) / ((s * x) * (((s * c) * c) * x));
      	} else {
      		tmp = (1.0 / t_0) / t_0;
      	}
      	return tmp;
      }
      
      function code(x, c, s)
      	t_0 = Float64(Float64(c * x) * s)
      	tmp = 0.0
      	if (Float64(cos(Float64(2.0 * x)) / Float64(Float64(Float64((s ^ 2.0) * x) * x) * (c ^ 2.0))) <= -5e-121)
      		tmp = Float64(fma(-2.0, Float64(x * x), 1.0) / Float64(Float64(s * x) * Float64(Float64(Float64(s * c) * c) * x)));
      	else
      		tmp = Float64(Float64(1.0 / t_0) / t_0);
      	end
      	return tmp
      end
      
      code[x_, c_, s_] := Block[{t$95$0 = N[(N[(c * x), $MachinePrecision] * s), $MachinePrecision]}, If[LessEqual[N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[(N[(N[Power[s, 2.0], $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-121], N[(N[(-2.0 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[(s * x), $MachinePrecision] * N[(N[(N[(s * c), $MachinePrecision] * c), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \left(c \cdot x\right) \cdot s\\
      \mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot x\right) \cdot x\right) \cdot {c}^{2}} \leq -5 \cdot 10^{-121}:\\
      \;\;\;\;\frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(s \cdot x\right) \cdot \left(\left(\left(s \cdot c\right) \cdot c\right) \cdot x\right)}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\frac{1}{t\_0}}{t\_0}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) < -4.99999999999999989e-121

        1. Initial program 52.5%

          \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
          3. *-commutativeN/A

            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(x \cdot \left(x \cdot {s}^{2}\right)\right)}} \]
          4. associate-*r*N/A

            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot x\right) \cdot \left(x \cdot {s}^{2}\right)}} \]
          5. lift-*.f64N/A

            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}} \]
          6. *-commutativeN/A

            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left({s}^{2} \cdot x\right)}} \]
          7. lift-pow.f64N/A

            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \left(\color{blue}{{s}^{2}} \cdot x\right)} \]
          8. unpow2N/A

            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \left(\color{blue}{\left(s \cdot s\right)} \cdot x\right)} \]
          9. associate-*l*N/A

            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left(s \cdot \left(s \cdot x\right)\right)}} \]
          10. associate-*r*N/A

            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right) \cdot \left(s \cdot x\right)}} \]
          11. lower-*.f64N/A

            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right) \cdot \left(s \cdot x\right)}} \]
          12. lower-*.f64N/A

            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right)} \cdot \left(s \cdot x\right)} \]
          13. *-commutativeN/A

            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(x \cdot {c}^{2}\right)} \cdot s\right) \cdot \left(s \cdot x\right)} \]
          14. lower-*.f64N/A

            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(x \cdot {c}^{2}\right)} \cdot s\right) \cdot \left(s \cdot x\right)} \]
          15. lift-pow.f64N/A

            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{{c}^{2}}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
          16. unpow2N/A

            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
          17. lower-*.f64N/A

            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
          18. *-commutativeN/A

            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \color{blue}{\left(x \cdot s\right)}} \]
          19. lower-*.f6485.3

            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \color{blue}{\left(x \cdot s\right)}} \]
        4. Applied rewrites85.3%

          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)}} \]
        5. Taylor expanded in x around 0

          \[\leadsto \frac{\color{blue}{1 + -2 \cdot {x}^{2}}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
        6. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \frac{\color{blue}{-2 \cdot {x}^{2} + 1}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
          2. lower-fma.f64N/A

            \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-2, {x}^{2}, 1\right)}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
          3. unpow2N/A

            \[\leadsto \frac{\mathsf{fma}\left(-2, \color{blue}{x \cdot x}, 1\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
          4. lower-*.f6424.6

            \[\leadsto \frac{\mathsf{fma}\left(-2, \color{blue}{x \cdot x}, 1\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
        7. Applied rewrites24.6%

          \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-2, x \cdot x, 1\right)}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
        8. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\color{blue}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right)} \cdot \left(x \cdot s\right)} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(\color{blue}{\left(x \cdot \left(c \cdot c\right)\right)} \cdot s\right) \cdot \left(x \cdot s\right)} \]
          3. associate-*l*N/A

            \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\color{blue}{\left(x \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)} \cdot \left(x \cdot s\right)} \]
          4. *-commutativeN/A

            \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\color{blue}{\left(\left(\left(c \cdot c\right) \cdot s\right) \cdot x\right)} \cdot \left(x \cdot s\right)} \]
          5. lower-*.f64N/A

            \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\color{blue}{\left(\left(\left(c \cdot c\right) \cdot s\right) \cdot x\right)} \cdot \left(x \cdot s\right)} \]
          6. *-commutativeN/A

            \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(\color{blue}{\left(s \cdot \left(c \cdot c\right)\right)} \cdot x\right) \cdot \left(x \cdot s\right)} \]
          7. lift-*.f64N/A

            \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(\left(s \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot x\right) \cdot \left(x \cdot s\right)} \]
          8. associate-*r*N/A

            \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(\color{blue}{\left(\left(s \cdot c\right) \cdot c\right)} \cdot x\right) \cdot \left(x \cdot s\right)} \]
          9. lift-*.f64N/A

            \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(\left(\color{blue}{\left(s \cdot c\right)} \cdot c\right) \cdot x\right) \cdot \left(x \cdot s\right)} \]
          10. lower-*.f6424.7

            \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(\color{blue}{\left(\left(s \cdot c\right) \cdot c\right)} \cdot x\right) \cdot \left(x \cdot s\right)} \]
        9. Applied rewrites24.7%

          \[\leadsto \frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\color{blue}{\left(\left(\left(s \cdot c\right) \cdot c\right) \cdot x\right)} \cdot \left(x \cdot s\right)} \]

        if -4.99999999999999989e-121 < (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x)))

        1. Initial program 67.3%

          \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
        2. Add Preprocessing
        3. Taylor expanded in x around 0

          \[\leadsto \color{blue}{\frac{1}{{c}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)}} \]
        4. Step-by-step derivation
          1. associate-*r*N/A

            \[\leadsto \frac{1}{\color{blue}{\left({c}^{2} \cdot {s}^{2}\right) \cdot {x}^{2}}} \]
          2. associate-/l/N/A

            \[\leadsto \color{blue}{\frac{\frac{1}{{x}^{2}}}{{c}^{2} \cdot {s}^{2}}} \]
          3. unpow2N/A

            \[\leadsto \frac{\frac{1}{{x}^{2}}}{\color{blue}{\left(c \cdot c\right)} \cdot {s}^{2}} \]
          4. associate-*l*N/A

            \[\leadsto \frac{\frac{1}{{x}^{2}}}{\color{blue}{c \cdot \left(c \cdot {s}^{2}\right)}} \]
          5. associate-/r*N/A

            \[\leadsto \color{blue}{\frac{\frac{\frac{1}{{x}^{2}}}{c}}{c \cdot {s}^{2}}} \]
          6. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{\frac{1}{{x}^{2}}}{c}}{c \cdot {s}^{2}}} \]
          7. lower-/.f64N/A

            \[\leadsto \frac{\color{blue}{\frac{\frac{1}{{x}^{2}}}{c}}}{c \cdot {s}^{2}} \]
          8. unpow2N/A

            \[\leadsto \frac{\frac{\frac{1}{\color{blue}{x \cdot x}}}{c}}{c \cdot {s}^{2}} \]
          9. associate-/r*N/A

            \[\leadsto \frac{\frac{\color{blue}{\frac{\frac{1}{x}}{x}}}{c}}{c \cdot {s}^{2}} \]
          10. lower-/.f64N/A

            \[\leadsto \frac{\frac{\color{blue}{\frac{\frac{1}{x}}{x}}}{c}}{c \cdot {s}^{2}} \]
          11. lower-/.f64N/A

            \[\leadsto \frac{\frac{\frac{\color{blue}{\frac{1}{x}}}{x}}{c}}{c \cdot {s}^{2}} \]
          12. unpow2N/A

            \[\leadsto \frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{c \cdot \color{blue}{\left(s \cdot s\right)}} \]
          13. associate-*r*N/A

            \[\leadsto \frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{\color{blue}{\left(c \cdot s\right) \cdot s}} \]
          14. *-commutativeN/A

            \[\leadsto \frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{\color{blue}{\left(s \cdot c\right)} \cdot s} \]
          15. lower-*.f64N/A

            \[\leadsto \frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{\color{blue}{\left(s \cdot c\right) \cdot s}} \]
          16. lower-*.f6473.9

            \[\leadsto \frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{\color{blue}{\left(s \cdot c\right)} \cdot s} \]
        5. Applied rewrites73.9%

          \[\leadsto \color{blue}{\frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{\left(s \cdot c\right) \cdot s}} \]
        6. Step-by-step derivation
          1. Applied rewrites78.5%

            \[\leadsto \frac{\frac{-1}{x} \cdot \frac{-1}{\left(s \cdot c\right) \cdot s}}{\color{blue}{c \cdot x}} \]
          2. Step-by-step derivation
            1. Applied rewrites85.5%

              \[\leadsto \frac{\frac{1}{s \cdot \left(c \cdot x\right)}}{\color{blue}{s \cdot \left(c \cdot x\right)}} \]
          3. Recombined 2 regimes into one program.
          4. Final simplification80.8%

            \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot x\right) \cdot x\right) \cdot {c}^{2}} \leq -5 \cdot 10^{-121}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(s \cdot x\right) \cdot \left(\left(\left(s \cdot c\right) \cdot c\right) \cdot x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\left(c \cdot x\right) \cdot s}}{\left(c \cdot x\right) \cdot s}\\ \end{array} \]
          5. Add Preprocessing

          Alternative 5: 82.4% accurate, 0.9× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(c \cdot x\right) \cdot s\\ \mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot x\right) \cdot x\right) \cdot {c}^{2}} \leq -5 \cdot 10^{-121}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(\left(\left(c \cdot c\right) \cdot x\right) \cdot s\right) \cdot \left(s \cdot x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{t\_0}}{t\_0}\\ \end{array} \end{array} \]
          (FPCore (x c s)
           :precision binary64
           (let* ((t_0 (* (* c x) s)))
             (if (<= (/ (cos (* 2.0 x)) (* (* (* (pow s 2.0) x) x) (pow c 2.0))) -5e-121)
               (/ (fma -2.0 (* x x) 1.0) (* (* (* (* c c) x) s) (* s x)))
               (/ (/ 1.0 t_0) t_0))))
          double code(double x, double c, double s) {
          	double t_0 = (c * x) * s;
          	double tmp;
          	if ((cos((2.0 * x)) / (((pow(s, 2.0) * x) * x) * pow(c, 2.0))) <= -5e-121) {
          		tmp = fma(-2.0, (x * x), 1.0) / ((((c * c) * x) * s) * (s * x));
          	} else {
          		tmp = (1.0 / t_0) / t_0;
          	}
          	return tmp;
          }
          
          function code(x, c, s)
          	t_0 = Float64(Float64(c * x) * s)
          	tmp = 0.0
          	if (Float64(cos(Float64(2.0 * x)) / Float64(Float64(Float64((s ^ 2.0) * x) * x) * (c ^ 2.0))) <= -5e-121)
          		tmp = Float64(fma(-2.0, Float64(x * x), 1.0) / Float64(Float64(Float64(Float64(c * c) * x) * s) * Float64(s * x)));
          	else
          		tmp = Float64(Float64(1.0 / t_0) / t_0);
          	end
          	return tmp
          end
          
          code[x_, c_, s_] := Block[{t$95$0 = N[(N[(c * x), $MachinePrecision] * s), $MachinePrecision]}, If[LessEqual[N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[(N[(N[Power[s, 2.0], $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-121], N[(N[(-2.0 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[(N[(N[(c * c), $MachinePrecision] * x), $MachinePrecision] * s), $MachinePrecision] * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \left(c \cdot x\right) \cdot s\\
          \mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot x\right) \cdot x\right) \cdot {c}^{2}} \leq -5 \cdot 10^{-121}:\\
          \;\;\;\;\frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(\left(\left(c \cdot c\right) \cdot x\right) \cdot s\right) \cdot \left(s \cdot x\right)}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{\frac{1}{t\_0}}{t\_0}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) < -4.99999999999999989e-121

            1. Initial program 52.5%

              \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. lift-*.f64N/A

                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
              2. lift-*.f64N/A

                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
              3. *-commutativeN/A

                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(x \cdot \left(x \cdot {s}^{2}\right)\right)}} \]
              4. associate-*r*N/A

                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot x\right) \cdot \left(x \cdot {s}^{2}\right)}} \]
              5. lift-*.f64N/A

                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}} \]
              6. *-commutativeN/A

                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left({s}^{2} \cdot x\right)}} \]
              7. lift-pow.f64N/A

                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \left(\color{blue}{{s}^{2}} \cdot x\right)} \]
              8. unpow2N/A

                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \left(\color{blue}{\left(s \cdot s\right)} \cdot x\right)} \]
              9. associate-*l*N/A

                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left(s \cdot \left(s \cdot x\right)\right)}} \]
              10. associate-*r*N/A

                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right) \cdot \left(s \cdot x\right)}} \]
              11. lower-*.f64N/A

                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right) \cdot \left(s \cdot x\right)}} \]
              12. lower-*.f64N/A

                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right)} \cdot \left(s \cdot x\right)} \]
              13. *-commutativeN/A

                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(x \cdot {c}^{2}\right)} \cdot s\right) \cdot \left(s \cdot x\right)} \]
              14. lower-*.f64N/A

                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(x \cdot {c}^{2}\right)} \cdot s\right) \cdot \left(s \cdot x\right)} \]
              15. lift-pow.f64N/A

                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{{c}^{2}}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
              16. unpow2N/A

                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
              17. lower-*.f64N/A

                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
              18. *-commutativeN/A

                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \color{blue}{\left(x \cdot s\right)}} \]
              19. lower-*.f6485.3

                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \color{blue}{\left(x \cdot s\right)}} \]
            4. Applied rewrites85.3%

              \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)}} \]
            5. Taylor expanded in x around 0

              \[\leadsto \frac{\color{blue}{1 + -2 \cdot {x}^{2}}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
            6. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \frac{\color{blue}{-2 \cdot {x}^{2} + 1}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
              2. lower-fma.f64N/A

                \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-2, {x}^{2}, 1\right)}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
              3. unpow2N/A

                \[\leadsto \frac{\mathsf{fma}\left(-2, \color{blue}{x \cdot x}, 1\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
              4. lower-*.f6424.6

                \[\leadsto \frac{\mathsf{fma}\left(-2, \color{blue}{x \cdot x}, 1\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
            7. Applied rewrites24.6%

              \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-2, x \cdot x, 1\right)}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]

            if -4.99999999999999989e-121 < (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x)))

            1. Initial program 67.3%

              \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
            2. Add Preprocessing
            3. Taylor expanded in x around 0

              \[\leadsto \color{blue}{\frac{1}{{c}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)}} \]
            4. Step-by-step derivation
              1. associate-*r*N/A

                \[\leadsto \frac{1}{\color{blue}{\left({c}^{2} \cdot {s}^{2}\right) \cdot {x}^{2}}} \]
              2. associate-/l/N/A

                \[\leadsto \color{blue}{\frac{\frac{1}{{x}^{2}}}{{c}^{2} \cdot {s}^{2}}} \]
              3. unpow2N/A

                \[\leadsto \frac{\frac{1}{{x}^{2}}}{\color{blue}{\left(c \cdot c\right)} \cdot {s}^{2}} \]
              4. associate-*l*N/A

                \[\leadsto \frac{\frac{1}{{x}^{2}}}{\color{blue}{c \cdot \left(c \cdot {s}^{2}\right)}} \]
              5. associate-/r*N/A

                \[\leadsto \color{blue}{\frac{\frac{\frac{1}{{x}^{2}}}{c}}{c \cdot {s}^{2}}} \]
              6. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{\frac{\frac{1}{{x}^{2}}}{c}}{c \cdot {s}^{2}}} \]
              7. lower-/.f64N/A

                \[\leadsto \frac{\color{blue}{\frac{\frac{1}{{x}^{2}}}{c}}}{c \cdot {s}^{2}} \]
              8. unpow2N/A

                \[\leadsto \frac{\frac{\frac{1}{\color{blue}{x \cdot x}}}{c}}{c \cdot {s}^{2}} \]
              9. associate-/r*N/A

                \[\leadsto \frac{\frac{\color{blue}{\frac{\frac{1}{x}}{x}}}{c}}{c \cdot {s}^{2}} \]
              10. lower-/.f64N/A

                \[\leadsto \frac{\frac{\color{blue}{\frac{\frac{1}{x}}{x}}}{c}}{c \cdot {s}^{2}} \]
              11. lower-/.f64N/A

                \[\leadsto \frac{\frac{\frac{\color{blue}{\frac{1}{x}}}{x}}{c}}{c \cdot {s}^{2}} \]
              12. unpow2N/A

                \[\leadsto \frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{c \cdot \color{blue}{\left(s \cdot s\right)}} \]
              13. associate-*r*N/A

                \[\leadsto \frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{\color{blue}{\left(c \cdot s\right) \cdot s}} \]
              14. *-commutativeN/A

                \[\leadsto \frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{\color{blue}{\left(s \cdot c\right)} \cdot s} \]
              15. lower-*.f64N/A

                \[\leadsto \frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{\color{blue}{\left(s \cdot c\right) \cdot s}} \]
              16. lower-*.f6473.9

                \[\leadsto \frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{\color{blue}{\left(s \cdot c\right)} \cdot s} \]
            5. Applied rewrites73.9%

              \[\leadsto \color{blue}{\frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{\left(s \cdot c\right) \cdot s}} \]
            6. Step-by-step derivation
              1. Applied rewrites78.5%

                \[\leadsto \frac{\frac{-1}{x} \cdot \frac{-1}{\left(s \cdot c\right) \cdot s}}{\color{blue}{c \cdot x}} \]
              2. Step-by-step derivation
                1. Applied rewrites85.5%

                  \[\leadsto \frac{\frac{1}{s \cdot \left(c \cdot x\right)}}{\color{blue}{s \cdot \left(c \cdot x\right)}} \]
              3. Recombined 2 regimes into one program.
              4. Final simplification80.8%

                \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot x\right) \cdot x\right) \cdot {c}^{2}} \leq -5 \cdot 10^{-121}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{\left(\left(\left(c \cdot c\right) \cdot x\right) \cdot s\right) \cdot \left(s \cdot x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\left(c \cdot x\right) \cdot s}}{\left(c \cdot x\right) \cdot s}\\ \end{array} \]
              5. Add Preprocessing

              Alternative 6: 82.4% accurate, 0.9× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(c \cdot x\right) \cdot s\\ \mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot x\right) \cdot x\right) \cdot {c}^{2}} \leq -5 \cdot 10^{-121}:\\ \;\;\;\;\frac{-2 \cdot \left(x \cdot x\right)}{\left(\left(\left(c \cdot c\right) \cdot x\right) \cdot s\right) \cdot \left(s \cdot x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{t\_0}}{t\_0}\\ \end{array} \end{array} \]
              (FPCore (x c s)
               :precision binary64
               (let* ((t_0 (* (* c x) s)))
                 (if (<= (/ (cos (* 2.0 x)) (* (* (* (pow s 2.0) x) x) (pow c 2.0))) -5e-121)
                   (/ (* -2.0 (* x x)) (* (* (* (* c c) x) s) (* s x)))
                   (/ (/ 1.0 t_0) t_0))))
              double code(double x, double c, double s) {
              	double t_0 = (c * x) * s;
              	double tmp;
              	if ((cos((2.0 * x)) / (((pow(s, 2.0) * x) * x) * pow(c, 2.0))) <= -5e-121) {
              		tmp = (-2.0 * (x * x)) / ((((c * c) * x) * s) * (s * x));
              	} else {
              		tmp = (1.0 / t_0) / t_0;
              	}
              	return tmp;
              }
              
              real(8) function code(x, c, s)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: c
                  real(8), intent (in) :: s
                  real(8) :: t_0
                  real(8) :: tmp
                  t_0 = (c * x) * s
                  if ((cos((2.0d0 * x)) / ((((s ** 2.0d0) * x) * x) * (c ** 2.0d0))) <= (-5d-121)) then
                      tmp = ((-2.0d0) * (x * x)) / ((((c * c) * x) * s) * (s * x))
                  else
                      tmp = (1.0d0 / t_0) / t_0
                  end if
                  code = tmp
              end function
              
              public static double code(double x, double c, double s) {
              	double t_0 = (c * x) * s;
              	double tmp;
              	if ((Math.cos((2.0 * x)) / (((Math.pow(s, 2.0) * x) * x) * Math.pow(c, 2.0))) <= -5e-121) {
              		tmp = (-2.0 * (x * x)) / ((((c * c) * x) * s) * (s * x));
              	} else {
              		tmp = (1.0 / t_0) / t_0;
              	}
              	return tmp;
              }
              
              def code(x, c, s):
              	t_0 = (c * x) * s
              	tmp = 0
              	if (math.cos((2.0 * x)) / (((math.pow(s, 2.0) * x) * x) * math.pow(c, 2.0))) <= -5e-121:
              		tmp = (-2.0 * (x * x)) / ((((c * c) * x) * s) * (s * x))
              	else:
              		tmp = (1.0 / t_0) / t_0
              	return tmp
              
              function code(x, c, s)
              	t_0 = Float64(Float64(c * x) * s)
              	tmp = 0.0
              	if (Float64(cos(Float64(2.0 * x)) / Float64(Float64(Float64((s ^ 2.0) * x) * x) * (c ^ 2.0))) <= -5e-121)
              		tmp = Float64(Float64(-2.0 * Float64(x * x)) / Float64(Float64(Float64(Float64(c * c) * x) * s) * Float64(s * x)));
              	else
              		tmp = Float64(Float64(1.0 / t_0) / t_0);
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, c, s)
              	t_0 = (c * x) * s;
              	tmp = 0.0;
              	if ((cos((2.0 * x)) / ((((s ^ 2.0) * x) * x) * (c ^ 2.0))) <= -5e-121)
              		tmp = (-2.0 * (x * x)) / ((((c * c) * x) * s) * (s * x));
              	else
              		tmp = (1.0 / t_0) / t_0;
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, c_, s_] := Block[{t$95$0 = N[(N[(c * x), $MachinePrecision] * s), $MachinePrecision]}, If[LessEqual[N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[(N[(N[Power[s, 2.0], $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-121], N[(N[(-2.0 * N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(c * c), $MachinePrecision] * x), $MachinePrecision] * s), $MachinePrecision] * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \left(c \cdot x\right) \cdot s\\
              \mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot x\right) \cdot x\right) \cdot {c}^{2}} \leq -5 \cdot 10^{-121}:\\
              \;\;\;\;\frac{-2 \cdot \left(x \cdot x\right)}{\left(\left(\left(c \cdot c\right) \cdot x\right) \cdot s\right) \cdot \left(s \cdot x\right)}\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{\frac{1}{t\_0}}{t\_0}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) < -4.99999999999999989e-121

                1. Initial program 52.5%

                  \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                2. Add Preprocessing
                3. Step-by-step derivation
                  1. lift-*.f64N/A

                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                  2. lift-*.f64N/A

                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                  3. *-commutativeN/A

                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(x \cdot \left(x \cdot {s}^{2}\right)\right)}} \]
                  4. associate-*r*N/A

                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot x\right) \cdot \left(x \cdot {s}^{2}\right)}} \]
                  5. lift-*.f64N/A

                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}} \]
                  6. *-commutativeN/A

                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left({s}^{2} \cdot x\right)}} \]
                  7. lift-pow.f64N/A

                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \left(\color{blue}{{s}^{2}} \cdot x\right)} \]
                  8. unpow2N/A

                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \left(\color{blue}{\left(s \cdot s\right)} \cdot x\right)} \]
                  9. associate-*l*N/A

                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left(s \cdot \left(s \cdot x\right)\right)}} \]
                  10. associate-*r*N/A

                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right) \cdot \left(s \cdot x\right)}} \]
                  11. lower-*.f64N/A

                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right) \cdot \left(s \cdot x\right)}} \]
                  12. lower-*.f64N/A

                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right)} \cdot \left(s \cdot x\right)} \]
                  13. *-commutativeN/A

                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(x \cdot {c}^{2}\right)} \cdot s\right) \cdot \left(s \cdot x\right)} \]
                  14. lower-*.f64N/A

                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(x \cdot {c}^{2}\right)} \cdot s\right) \cdot \left(s \cdot x\right)} \]
                  15. lift-pow.f64N/A

                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{{c}^{2}}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
                  16. unpow2N/A

                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
                  17. lower-*.f64N/A

                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
                  18. *-commutativeN/A

                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \color{blue}{\left(x \cdot s\right)}} \]
                  19. lower-*.f6485.3

                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \color{blue}{\left(x \cdot s\right)}} \]
                4. Applied rewrites85.3%

                  \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)}} \]
                5. Taylor expanded in x around 0

                  \[\leadsto \frac{\color{blue}{1 + -2 \cdot {x}^{2}}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
                6. Step-by-step derivation
                  1. +-commutativeN/A

                    \[\leadsto \frac{\color{blue}{-2 \cdot {x}^{2} + 1}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
                  2. lower-fma.f64N/A

                    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-2, {x}^{2}, 1\right)}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
                  3. unpow2N/A

                    \[\leadsto \frac{\mathsf{fma}\left(-2, \color{blue}{x \cdot x}, 1\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
                  4. lower-*.f6424.6

                    \[\leadsto \frac{\mathsf{fma}\left(-2, \color{blue}{x \cdot x}, 1\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
                7. Applied rewrites24.6%

                  \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-2, x \cdot x, 1\right)}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
                8. Taylor expanded in x around inf

                  \[\leadsto \frac{-2 \cdot \color{blue}{{x}^{2}}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
                9. Step-by-step derivation
                  1. Applied rewrites24.6%

                    \[\leadsto \frac{\left(x \cdot x\right) \cdot \color{blue}{-2}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]

                  if -4.99999999999999989e-121 < (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x)))

                  1. Initial program 67.3%

                    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                  2. Add Preprocessing
                  3. Taylor expanded in x around 0

                    \[\leadsto \color{blue}{\frac{1}{{c}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)}} \]
                  4. Step-by-step derivation
                    1. associate-*r*N/A

                      \[\leadsto \frac{1}{\color{blue}{\left({c}^{2} \cdot {s}^{2}\right) \cdot {x}^{2}}} \]
                    2. associate-/l/N/A

                      \[\leadsto \color{blue}{\frac{\frac{1}{{x}^{2}}}{{c}^{2} \cdot {s}^{2}}} \]
                    3. unpow2N/A

                      \[\leadsto \frac{\frac{1}{{x}^{2}}}{\color{blue}{\left(c \cdot c\right)} \cdot {s}^{2}} \]
                    4. associate-*l*N/A

                      \[\leadsto \frac{\frac{1}{{x}^{2}}}{\color{blue}{c \cdot \left(c \cdot {s}^{2}\right)}} \]
                    5. associate-/r*N/A

                      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{{x}^{2}}}{c}}{c \cdot {s}^{2}}} \]
                    6. lower-/.f64N/A

                      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{{x}^{2}}}{c}}{c \cdot {s}^{2}}} \]
                    7. lower-/.f64N/A

                      \[\leadsto \frac{\color{blue}{\frac{\frac{1}{{x}^{2}}}{c}}}{c \cdot {s}^{2}} \]
                    8. unpow2N/A

                      \[\leadsto \frac{\frac{\frac{1}{\color{blue}{x \cdot x}}}{c}}{c \cdot {s}^{2}} \]
                    9. associate-/r*N/A

                      \[\leadsto \frac{\frac{\color{blue}{\frac{\frac{1}{x}}{x}}}{c}}{c \cdot {s}^{2}} \]
                    10. lower-/.f64N/A

                      \[\leadsto \frac{\frac{\color{blue}{\frac{\frac{1}{x}}{x}}}{c}}{c \cdot {s}^{2}} \]
                    11. lower-/.f64N/A

                      \[\leadsto \frac{\frac{\frac{\color{blue}{\frac{1}{x}}}{x}}{c}}{c \cdot {s}^{2}} \]
                    12. unpow2N/A

                      \[\leadsto \frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{c \cdot \color{blue}{\left(s \cdot s\right)}} \]
                    13. associate-*r*N/A

                      \[\leadsto \frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{\color{blue}{\left(c \cdot s\right) \cdot s}} \]
                    14. *-commutativeN/A

                      \[\leadsto \frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{\color{blue}{\left(s \cdot c\right)} \cdot s} \]
                    15. lower-*.f64N/A

                      \[\leadsto \frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{\color{blue}{\left(s \cdot c\right) \cdot s}} \]
                    16. lower-*.f6473.9

                      \[\leadsto \frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{\color{blue}{\left(s \cdot c\right)} \cdot s} \]
                  5. Applied rewrites73.9%

                    \[\leadsto \color{blue}{\frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{\left(s \cdot c\right) \cdot s}} \]
                  6. Step-by-step derivation
                    1. Applied rewrites78.5%

                      \[\leadsto \frac{\frac{-1}{x} \cdot \frac{-1}{\left(s \cdot c\right) \cdot s}}{\color{blue}{c \cdot x}} \]
                    2. Step-by-step derivation
                      1. Applied rewrites85.5%

                        \[\leadsto \frac{\frac{1}{s \cdot \left(c \cdot x\right)}}{\color{blue}{s \cdot \left(c \cdot x\right)}} \]
                    3. Recombined 2 regimes into one program.
                    4. Final simplification80.8%

                      \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot x\right) \cdot x\right) \cdot {c}^{2}} \leq -5 \cdot 10^{-121}:\\ \;\;\;\;\frac{-2 \cdot \left(x \cdot x\right)}{\left(\left(\left(c \cdot c\right) \cdot x\right) \cdot s\right) \cdot \left(s \cdot x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\left(c \cdot x\right) \cdot s}}{\left(c \cdot x\right) \cdot s}\\ \end{array} \]
                    5. Add Preprocessing

                    Alternative 7: 68.8% accurate, 0.9× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot x\right) \cdot x\right) \cdot {c}^{2}} \leq \infty:\\ \;\;\;\;\frac{1}{\left(\left(\left(\left(c \cdot c\right) \cdot x\right) \cdot x\right) \cdot s\right) \cdot s}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(\left(\left(\left(x \cdot x\right) \cdot c\right) \cdot c\right) \cdot s\right) \cdot s}\\ \end{array} \end{array} \]
                    (FPCore (x c s)
                     :precision binary64
                     (if (<= (/ (cos (* 2.0 x)) (* (* (* (pow s 2.0) x) x) (pow c 2.0))) INFINITY)
                       (/ 1.0 (* (* (* (* (* c c) x) x) s) s))
                       (/ 1.0 (* (* (* (* (* x x) c) c) s) s))))
                    double code(double x, double c, double s) {
                    	double tmp;
                    	if ((cos((2.0 * x)) / (((pow(s, 2.0) * x) * x) * pow(c, 2.0))) <= ((double) INFINITY)) {
                    		tmp = 1.0 / (((((c * c) * x) * x) * s) * s);
                    	} else {
                    		tmp = 1.0 / (((((x * x) * c) * c) * s) * s);
                    	}
                    	return tmp;
                    }
                    
                    public static double code(double x, double c, double s) {
                    	double tmp;
                    	if ((Math.cos((2.0 * x)) / (((Math.pow(s, 2.0) * x) * x) * Math.pow(c, 2.0))) <= Double.POSITIVE_INFINITY) {
                    		tmp = 1.0 / (((((c * c) * x) * x) * s) * s);
                    	} else {
                    		tmp = 1.0 / (((((x * x) * c) * c) * s) * s);
                    	}
                    	return tmp;
                    }
                    
                    def code(x, c, s):
                    	tmp = 0
                    	if (math.cos((2.0 * x)) / (((math.pow(s, 2.0) * x) * x) * math.pow(c, 2.0))) <= math.inf:
                    		tmp = 1.0 / (((((c * c) * x) * x) * s) * s)
                    	else:
                    		tmp = 1.0 / (((((x * x) * c) * c) * s) * s)
                    	return tmp
                    
                    function code(x, c, s)
                    	tmp = 0.0
                    	if (Float64(cos(Float64(2.0 * x)) / Float64(Float64(Float64((s ^ 2.0) * x) * x) * (c ^ 2.0))) <= Inf)
                    		tmp = Float64(1.0 / Float64(Float64(Float64(Float64(Float64(c * c) * x) * x) * s) * s));
                    	else
                    		tmp = Float64(1.0 / Float64(Float64(Float64(Float64(Float64(x * x) * c) * c) * s) * s));
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(x, c, s)
                    	tmp = 0.0;
                    	if ((cos((2.0 * x)) / ((((s ^ 2.0) * x) * x) * (c ^ 2.0))) <= Inf)
                    		tmp = 1.0 / (((((c * c) * x) * x) * s) * s);
                    	else
                    		tmp = 1.0 / (((((x * x) * c) * c) * s) * s);
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    code[x_, c_, s_] := If[LessEqual[N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[(N[(N[Power[s, 2.0], $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(1.0 / N[(N[(N[(N[(N[(c * c), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * s), $MachinePrecision] * s), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[(N[(N[(x * x), $MachinePrecision] * c), $MachinePrecision] * c), $MachinePrecision] * s), $MachinePrecision] * s), $MachinePrecision]), $MachinePrecision]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot x\right) \cdot x\right) \cdot {c}^{2}} \leq \infty:\\
                    \;\;\;\;\frac{1}{\left(\left(\left(\left(c \cdot c\right) \cdot x\right) \cdot x\right) \cdot s\right) \cdot s}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\frac{1}{\left(\left(\left(\left(x \cdot x\right) \cdot c\right) \cdot c\right) \cdot s\right) \cdot s}\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) < +inf.0

                      1. Initial program 81.0%

                        \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                      2. Add Preprocessing
                      3. Step-by-step derivation
                        1. lift-*.f64N/A

                          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                        2. lift-*.f64N/A

                          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                        3. associate-*r*N/A

                          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot x}} \]
                        4. lower-*.f64N/A

                          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot x}} \]
                        5. lift-*.f64N/A

                          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}\right) \cdot x} \]
                        6. *-commutativeN/A

                          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot \color{blue}{\left({s}^{2} \cdot x\right)}\right) \cdot x} \]
                        7. associate-*r*N/A

                          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot {s}^{2}\right) \cdot x\right)} \cdot x} \]
                        8. lower-*.f64N/A

                          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot {s}^{2}\right) \cdot x\right)} \cdot x} \]
                        9. *-commutativeN/A

                          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left({s}^{2} \cdot {c}^{2}\right)} \cdot x\right) \cdot x} \]
                        10. lift-pow.f64N/A

                          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(\color{blue}{{s}^{2}} \cdot {c}^{2}\right) \cdot x\right) \cdot x} \]
                        11. lift-pow.f64N/A

                          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot \color{blue}{{c}^{2}}\right) \cdot x\right) \cdot x} \]
                        12. pow-prod-downN/A

                          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{{\left(s \cdot c\right)}^{2}} \cdot x\right) \cdot x} \]
                        13. lower-pow.f64N/A

                          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{{\left(s \cdot c\right)}^{2}} \cdot x\right) \cdot x} \]
                        14. lower-*.f6485.7

                          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({\color{blue}{\left(s \cdot c\right)}}^{2} \cdot x\right) \cdot x} \]
                      4. Applied rewrites85.7%

                        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({\left(s \cdot c\right)}^{2} \cdot x\right) \cdot x}} \]
                      5. Taylor expanded in x around 0

                        \[\leadsto \frac{\color{blue}{1}}{\left({\left(s \cdot c\right)}^{2} \cdot x\right) \cdot x} \]
                      6. Step-by-step derivation
                        1. Applied rewrites74.2%

                          \[\leadsto \frac{\color{blue}{1}}{\left({\left(s \cdot c\right)}^{2} \cdot x\right) \cdot x} \]
                        2. Taylor expanded in x around 0

                          \[\leadsto \frac{1}{\color{blue}{{c}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)}} \]
                        3. Step-by-step derivation
                          1. *-commutativeN/A

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

                            \[\leadsto \frac{1}{\color{blue}{\left({c}^{2} \cdot {x}^{2}\right) \cdot {s}^{2}}} \]
                          3. unpow2N/A

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

                            \[\leadsto \frac{1}{\color{blue}{\left(\left({c}^{2} \cdot {x}^{2}\right) \cdot s\right) \cdot s}} \]
                          5. *-commutativeN/A

                            \[\leadsto \frac{1}{\color{blue}{\left(s \cdot \left({c}^{2} \cdot {x}^{2}\right)\right)} \cdot s} \]
                          6. lower-*.f64N/A

                            \[\leadsto \frac{1}{\color{blue}{\left(s \cdot \left({c}^{2} \cdot {x}^{2}\right)\right) \cdot s}} \]
                          7. *-commutativeN/A

                            \[\leadsto \frac{1}{\color{blue}{\left(\left({c}^{2} \cdot {x}^{2}\right) \cdot s\right)} \cdot s} \]
                          8. lower-*.f64N/A

                            \[\leadsto \frac{1}{\color{blue}{\left(\left({c}^{2} \cdot {x}^{2}\right) \cdot s\right)} \cdot s} \]
                          9. unpow2N/A

                            \[\leadsto \frac{1}{\left(\left({c}^{2} \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot s\right) \cdot s} \]
                          10. associate-*r*N/A

                            \[\leadsto \frac{1}{\left(\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot x\right)} \cdot s\right) \cdot s} \]
                          11. lower-*.f64N/A

                            \[\leadsto \frac{1}{\left(\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot x\right)} \cdot s\right) \cdot s} \]
                          12. lower-*.f64N/A

                            \[\leadsto \frac{1}{\left(\left(\color{blue}{\left({c}^{2} \cdot x\right)} \cdot x\right) \cdot s\right) \cdot s} \]
                          13. unpow2N/A

                            \[\leadsto \frac{1}{\left(\left(\left(\color{blue}{\left(c \cdot c\right)} \cdot x\right) \cdot x\right) \cdot s\right) \cdot s} \]
                          14. lower-*.f6473.9

                            \[\leadsto \frac{1}{\left(\left(\left(\color{blue}{\left(c \cdot c\right)} \cdot x\right) \cdot x\right) \cdot s\right) \cdot s} \]
                        4. Applied rewrites73.9%

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

                        if +inf.0 < (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x)))

                        1. Initial program 0.0%

                          \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                        2. Add Preprocessing
                        3. Step-by-step derivation
                          1. lift-*.f64N/A

                            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                          2. lift-*.f64N/A

                            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                          3. associate-*r*N/A

                            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot x}} \]
                          4. lower-*.f64N/A

                            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot x}} \]
                          5. lift-*.f64N/A

                            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}\right) \cdot x} \]
                          6. *-commutativeN/A

                            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot \color{blue}{\left({s}^{2} \cdot x\right)}\right) \cdot x} \]
                          7. associate-*r*N/A

                            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot {s}^{2}\right) \cdot x\right)} \cdot x} \]
                          8. lower-*.f64N/A

                            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot {s}^{2}\right) \cdot x\right)} \cdot x} \]
                          9. *-commutativeN/A

                            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left({s}^{2} \cdot {c}^{2}\right)} \cdot x\right) \cdot x} \]
                          10. lift-pow.f64N/A

                            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(\color{blue}{{s}^{2}} \cdot {c}^{2}\right) \cdot x\right) \cdot x} \]
                          11. lift-pow.f64N/A

                            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot \color{blue}{{c}^{2}}\right) \cdot x\right) \cdot x} \]
                          12. pow-prod-downN/A

                            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{{\left(s \cdot c\right)}^{2}} \cdot x\right) \cdot x} \]
                          13. lower-pow.f64N/A

                            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{{\left(s \cdot c\right)}^{2}} \cdot x\right) \cdot x} \]
                          14. lower-*.f6479.2

                            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({\color{blue}{\left(s \cdot c\right)}}^{2} \cdot x\right) \cdot x} \]
                        4. Applied rewrites79.2%

                          \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({\left(s \cdot c\right)}^{2} \cdot x\right) \cdot x}} \]
                        5. Taylor expanded in x around 0

                          \[\leadsto \frac{\color{blue}{1}}{\left({\left(s \cdot c\right)}^{2} \cdot x\right) \cdot x} \]
                        6. Step-by-step derivation
                          1. Applied rewrites64.8%

                            \[\leadsto \frac{\color{blue}{1}}{\left({\left(s \cdot c\right)}^{2} \cdot x\right) \cdot x} \]
                          2. Taylor expanded in x around 0

                            \[\leadsto \frac{1}{\color{blue}{{c}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)}} \]
                          3. Step-by-step derivation
                            1. *-commutativeN/A

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

                              \[\leadsto \frac{1}{\color{blue}{\left({c}^{2} \cdot {x}^{2}\right) \cdot {s}^{2}}} \]
                            3. unpow2N/A

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

                              \[\leadsto \frac{1}{\color{blue}{\left(\left({c}^{2} \cdot {x}^{2}\right) \cdot s\right) \cdot s}} \]
                            5. *-commutativeN/A

                              \[\leadsto \frac{1}{\color{blue}{\left(s \cdot \left({c}^{2} \cdot {x}^{2}\right)\right)} \cdot s} \]
                            6. lower-*.f64N/A

                              \[\leadsto \frac{1}{\color{blue}{\left(s \cdot \left({c}^{2} \cdot {x}^{2}\right)\right) \cdot s}} \]
                            7. *-commutativeN/A

                              \[\leadsto \frac{1}{\color{blue}{\left(\left({c}^{2} \cdot {x}^{2}\right) \cdot s\right)} \cdot s} \]
                            8. lower-*.f64N/A

                              \[\leadsto \frac{1}{\color{blue}{\left(\left({c}^{2} \cdot {x}^{2}\right) \cdot s\right)} \cdot s} \]
                            9. unpow2N/A

                              \[\leadsto \frac{1}{\left(\left({c}^{2} \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot s\right) \cdot s} \]
                            10. associate-*r*N/A

                              \[\leadsto \frac{1}{\left(\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot x\right)} \cdot s\right) \cdot s} \]
                            11. lower-*.f64N/A

                              \[\leadsto \frac{1}{\left(\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot x\right)} \cdot s\right) \cdot s} \]
                            12. lower-*.f64N/A

                              \[\leadsto \frac{1}{\left(\left(\color{blue}{\left({c}^{2} \cdot x\right)} \cdot x\right) \cdot s\right) \cdot s} \]
                            13. unpow2N/A

                              \[\leadsto \frac{1}{\left(\left(\left(\color{blue}{\left(c \cdot c\right)} \cdot x\right) \cdot x\right) \cdot s\right) \cdot s} \]
                            14. lower-*.f6421.5

                              \[\leadsto \frac{1}{\left(\left(\left(\color{blue}{\left(c \cdot c\right)} \cdot x\right) \cdot x\right) \cdot s\right) \cdot s} \]
                          4. Applied rewrites21.5%

                            \[\leadsto \frac{1}{\color{blue}{\left(\left(\left(\left(c \cdot c\right) \cdot x\right) \cdot x\right) \cdot s\right) \cdot s}} \]
                          5. Step-by-step derivation
                            1. Applied rewrites56.0%

                              \[\leadsto \frac{1}{\left(\left(c \cdot \left(c \cdot \left(x \cdot x\right)\right)\right) \cdot s\right) \cdot s} \]
                          6. Recombined 2 regimes into one program.
                          7. Final simplification70.6%

                            \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot x\right) \cdot x\right) \cdot {c}^{2}} \leq \infty:\\ \;\;\;\;\frac{1}{\left(\left(\left(\left(c \cdot c\right) \cdot x\right) \cdot x\right) \cdot s\right) \cdot s}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(\left(\left(\left(x \cdot x\right) \cdot c\right) \cdot c\right) \cdot s\right) \cdot s}\\ \end{array} \]
                          8. Add Preprocessing

                          Alternative 8: 83.6% accurate, 2.2× speedup?

                          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(x + x\right)\\ \mathbf{if}\;x \leq 1.75 \cdot 10^{-131}:\\ \;\;\;\;\frac{1}{\left({\left(s \cdot x\right)}^{2} \cdot c\right) \cdot c}\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{+153}:\\ \;\;\;\;\frac{t\_0}{\left(\left(x \cdot x\right) \cdot \left(s \cdot c\right)\right) \cdot \left(s \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_0}{\left(\left(s \cdot x\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)\right) \cdot c}\\ \end{array} \end{array} \]
                          (FPCore (x c s)
                           :precision binary64
                           (let* ((t_0 (cos (+ x x))))
                             (if (<= x 1.75e-131)
                               (/ 1.0 (* (* (pow (* s x) 2.0) c) c))
                               (if (<= x 3.3e+153)
                                 (/ t_0 (* (* (* x x) (* s c)) (* s c)))
                                 (/ t_0 (* (* (* s x) (* (* c x) s)) c))))))
                          double code(double x, double c, double s) {
                          	double t_0 = cos((x + x));
                          	double tmp;
                          	if (x <= 1.75e-131) {
                          		tmp = 1.0 / ((pow((s * x), 2.0) * c) * c);
                          	} else if (x <= 3.3e+153) {
                          		tmp = t_0 / (((x * x) * (s * c)) * (s * c));
                          	} else {
                          		tmp = t_0 / (((s * x) * ((c * x) * s)) * c);
                          	}
                          	return tmp;
                          }
                          
                          real(8) function code(x, c, s)
                              real(8), intent (in) :: x
                              real(8), intent (in) :: c
                              real(8), intent (in) :: s
                              real(8) :: t_0
                              real(8) :: tmp
                              t_0 = cos((x + x))
                              if (x <= 1.75d-131) then
                                  tmp = 1.0d0 / ((((s * x) ** 2.0d0) * c) * c)
                              else if (x <= 3.3d+153) then
                                  tmp = t_0 / (((x * x) * (s * c)) * (s * c))
                              else
                                  tmp = t_0 / (((s * x) * ((c * x) * s)) * c)
                              end if
                              code = tmp
                          end function
                          
                          public static double code(double x, double c, double s) {
                          	double t_0 = Math.cos((x + x));
                          	double tmp;
                          	if (x <= 1.75e-131) {
                          		tmp = 1.0 / ((Math.pow((s * x), 2.0) * c) * c);
                          	} else if (x <= 3.3e+153) {
                          		tmp = t_0 / (((x * x) * (s * c)) * (s * c));
                          	} else {
                          		tmp = t_0 / (((s * x) * ((c * x) * s)) * c);
                          	}
                          	return tmp;
                          }
                          
                          def code(x, c, s):
                          	t_0 = math.cos((x + x))
                          	tmp = 0
                          	if x <= 1.75e-131:
                          		tmp = 1.0 / ((math.pow((s * x), 2.0) * c) * c)
                          	elif x <= 3.3e+153:
                          		tmp = t_0 / (((x * x) * (s * c)) * (s * c))
                          	else:
                          		tmp = t_0 / (((s * x) * ((c * x) * s)) * c)
                          	return tmp
                          
                          function code(x, c, s)
                          	t_0 = cos(Float64(x + x))
                          	tmp = 0.0
                          	if (x <= 1.75e-131)
                          		tmp = Float64(1.0 / Float64(Float64((Float64(s * x) ^ 2.0) * c) * c));
                          	elseif (x <= 3.3e+153)
                          		tmp = Float64(t_0 / Float64(Float64(Float64(x * x) * Float64(s * c)) * Float64(s * c)));
                          	else
                          		tmp = Float64(t_0 / Float64(Float64(Float64(s * x) * Float64(Float64(c * x) * s)) * c));
                          	end
                          	return tmp
                          end
                          
                          function tmp_2 = code(x, c, s)
                          	t_0 = cos((x + x));
                          	tmp = 0.0;
                          	if (x <= 1.75e-131)
                          		tmp = 1.0 / ((((s * x) ^ 2.0) * c) * c);
                          	elseif (x <= 3.3e+153)
                          		tmp = t_0 / (((x * x) * (s * c)) * (s * c));
                          	else
                          		tmp = t_0 / (((s * x) * ((c * x) * s)) * c);
                          	end
                          	tmp_2 = tmp;
                          end
                          
                          code[x_, c_, s_] := Block[{t$95$0 = N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 1.75e-131], N[(1.0 / N[(N[(N[Power[N[(s * x), $MachinePrecision], 2.0], $MachinePrecision] * c), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.3e+153], N[(t$95$0 / N[(N[(N[(x * x), $MachinePrecision] * N[(s * c), $MachinePrecision]), $MachinePrecision] * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(N[(N[(s * x), $MachinePrecision] * N[(N[(c * x), $MachinePrecision] * s), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]]]]
                          
                          \begin{array}{l}
                          
                          \\
                          \begin{array}{l}
                          t_0 := \cos \left(x + x\right)\\
                          \mathbf{if}\;x \leq 1.75 \cdot 10^{-131}:\\
                          \;\;\;\;\frac{1}{\left({\left(s \cdot x\right)}^{2} \cdot c\right) \cdot c}\\
                          
                          \mathbf{elif}\;x \leq 3.3 \cdot 10^{+153}:\\
                          \;\;\;\;\frac{t\_0}{\left(\left(x \cdot x\right) \cdot \left(s \cdot c\right)\right) \cdot \left(s \cdot c\right)}\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\frac{t\_0}{\left(\left(s \cdot x\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)\right) \cdot c}\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 3 regimes
                          2. if x < 1.7500000000000001e-131

                            1. Initial program 62.5%

                              \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                            2. Add Preprocessing
                            3. Step-by-step derivation
                              1. lift-*.f64N/A

                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                              2. lift-*.f64N/A

                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                              3. associate-*r*N/A

                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot x}} \]
                              4. lower-*.f64N/A

                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot x}} \]
                              5. lift-*.f64N/A

                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}\right) \cdot x} \]
                              6. *-commutativeN/A

                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot \color{blue}{\left({s}^{2} \cdot x\right)}\right) \cdot x} \]
                              7. associate-*r*N/A

                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot {s}^{2}\right) \cdot x\right)} \cdot x} \]
                              8. lower-*.f64N/A

                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot {s}^{2}\right) \cdot x\right)} \cdot x} \]
                              9. *-commutativeN/A

                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left({s}^{2} \cdot {c}^{2}\right)} \cdot x\right) \cdot x} \]
                              10. lift-pow.f64N/A

                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(\color{blue}{{s}^{2}} \cdot {c}^{2}\right) \cdot x\right) \cdot x} \]
                              11. lift-pow.f64N/A

                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot \color{blue}{{c}^{2}}\right) \cdot x\right) \cdot x} \]
                              12. pow-prod-downN/A

                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{{\left(s \cdot c\right)}^{2}} \cdot x\right) \cdot x} \]
                              13. lower-pow.f64N/A

                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{{\left(s \cdot c\right)}^{2}} \cdot x\right) \cdot x} \]
                              14. lower-*.f6484.4

                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({\color{blue}{\left(s \cdot c\right)}}^{2} \cdot x\right) \cdot x} \]
                            4. Applied rewrites84.4%

                              \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({\left(s \cdot c\right)}^{2} \cdot x\right) \cdot x}} \]
                            5. Taylor expanded in x around 0

                              \[\leadsto \frac{\color{blue}{1}}{\left({\left(s \cdot c\right)}^{2} \cdot x\right) \cdot x} \]
                            6. Step-by-step derivation
                              1. Applied rewrites73.6%

                                \[\leadsto \frac{\color{blue}{1}}{\left({\left(s \cdot c\right)}^{2} \cdot x\right) \cdot x} \]
                              2. Step-by-step derivation
                                1. lift-*.f64N/A

                                  \[\leadsto \frac{1}{\color{blue}{\left({\left(s \cdot c\right)}^{2} \cdot x\right) \cdot x}} \]
                                2. lift-*.f64N/A

                                  \[\leadsto \frac{1}{\color{blue}{\left({\left(s \cdot c\right)}^{2} \cdot x\right)} \cdot x} \]
                                3. associate-*l*N/A

                                  \[\leadsto \frac{1}{\color{blue}{{\left(s \cdot c\right)}^{2} \cdot \left(x \cdot x\right)}} \]
                                4. lift-pow.f64N/A

                                  \[\leadsto \frac{1}{\color{blue}{{\left(s \cdot c\right)}^{2}} \cdot \left(x \cdot x\right)} \]
                                5. pow2N/A

                                  \[\leadsto \frac{1}{{\left(s \cdot c\right)}^{2} \cdot \color{blue}{{x}^{2}}} \]
                                6. pow-prod-downN/A

                                  \[\leadsto \frac{1}{\color{blue}{{\left(\left(s \cdot c\right) \cdot x\right)}^{2}}} \]
                                7. lift-*.f64N/A

                                  \[\leadsto \frac{1}{{\left(\color{blue}{\left(s \cdot c\right)} \cdot x\right)}^{2}} \]
                                8. associate-*r*N/A

                                  \[\leadsto \frac{1}{{\color{blue}{\left(s \cdot \left(c \cdot x\right)\right)}}^{2}} \]
                                9. lift-*.f64N/A

                                  \[\leadsto \frac{1}{{\left(s \cdot \color{blue}{\left(c \cdot x\right)}\right)}^{2}} \]
                                10. *-commutativeN/A

                                  \[\leadsto \frac{1}{{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right)}}^{2}} \]
                                11. lift-*.f64N/A

                                  \[\leadsto \frac{1}{{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right)}}^{2}} \]
                                12. pow2N/A

                                  \[\leadsto \frac{1}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)}} \]
                                13. lift-*.f64N/A

                                  \[\leadsto \frac{1}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right)} \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                14. associate-*l*N/A

                                  \[\leadsto \frac{1}{\color{blue}{\left(c \cdot x\right) \cdot \left(s \cdot \left(\left(c \cdot x\right) \cdot s\right)\right)}} \]
                                15. lift-*.f64N/A

                                  \[\leadsto \frac{1}{\color{blue}{\left(c \cdot x\right)} \cdot \left(s \cdot \left(\left(c \cdot x\right) \cdot s\right)\right)} \]
                                16. associate-*l*N/A

                                  \[\leadsto \frac{1}{\color{blue}{c \cdot \left(x \cdot \left(s \cdot \left(\left(c \cdot x\right) \cdot s\right)\right)\right)}} \]
                                17. *-commutativeN/A

                                  \[\leadsto \frac{1}{\color{blue}{\left(x \cdot \left(s \cdot \left(\left(c \cdot x\right) \cdot s\right)\right)\right) \cdot c}} \]
                                18. lower-*.f64N/A

                                  \[\leadsto \frac{1}{\color{blue}{\left(x \cdot \left(s \cdot \left(\left(c \cdot x\right) \cdot s\right)\right)\right) \cdot c}} \]
                              3. Applied rewrites76.2%

                                \[\leadsto \frac{1}{\color{blue}{\left({\left(s \cdot x\right)}^{2} \cdot c\right) \cdot c}} \]

                              if 1.7500000000000001e-131 < x < 3.29999999999999994e153

                              1. Initial program 72.1%

                                \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                              2. Add Preprocessing
                              3. Step-by-step derivation
                                1. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \color{blue}{\left(2 \cdot x\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                2. *-commutativeN/A

                                  \[\leadsto \frac{\cos \color{blue}{\left(x \cdot 2\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                3. lower-*.f6472.1

                                  \[\leadsto \frac{\cos \color{blue}{\left(x \cdot 2\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                4. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                                5. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right) \cdot {c}^{2}}} \]
                                6. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \cdot {c}^{2}} \]
                                7. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \cdot {c}^{2}} \]
                                8. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(x \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}\right) \cdot {c}^{2}} \]
                                9. associate-*r*N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot x\right) \cdot {s}^{2}\right)} \cdot {c}^{2}} \]
                                10. associate-*l*N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot x\right) \cdot \left({s}^{2} \cdot {c}^{2}\right)}} \]
                                11. pow2N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{x}^{2}} \cdot \left({s}^{2} \cdot {c}^{2}\right)} \]
                                12. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}} \]
                                13. lift-pow.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \left(\color{blue}{{c}^{2}} \cdot {s}^{2}\right)} \]
                                14. lift-pow.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \left({c}^{2} \cdot \color{blue}{{s}^{2}}\right)} \]
                                15. pow-prod-downN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \color{blue}{{\left(c \cdot s\right)}^{2}}} \]
                                16. pow-prod-downN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
                                17. lower-pow.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
                                18. lower-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}}^{2}} \]
                                19. lower-*.f6499.5

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{\left(x \cdot \color{blue}{\left(c \cdot s\right)}\right)}^{2}} \]
                              4. Applied rewrites99.5%

                                \[\leadsto \color{blue}{\frac{\cos \left(x \cdot 2\right)}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
                              5. Step-by-step derivation
                                1. lift-pow.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
                                2. unpow2N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)}} \]
                                3. lower-*.f6499.5

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)}} \]
                                4. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right)} \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                5. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(x \cdot \color{blue}{\left(c \cdot s\right)}\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                6. associate-*r*N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot c\right) \cdot s\right)} \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                7. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\color{blue}{\left(c \cdot x\right)} \cdot s\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                8. lower-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right)} \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                9. lower-*.f6497.0

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\color{blue}{\left(c \cdot x\right)} \cdot s\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                10. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}} \]
                                11. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(x \cdot \color{blue}{\left(c \cdot s\right)}\right)} \]
                                12. associate-*r*N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \color{blue}{\left(\left(x \cdot c\right) \cdot s\right)}} \]
                                13. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\color{blue}{\left(c \cdot x\right)} \cdot s\right)} \]
                                14. lower-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \color{blue}{\left(\left(c \cdot x\right) \cdot s\right)}} \]
                                15. lower-*.f6496.9

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\color{blue}{\left(c \cdot x\right)} \cdot s\right)} \]
                              6. Applied rewrites96.9%

                                \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)}} \]
                              7. Step-by-step derivation
                                1. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \color{blue}{\left(x \cdot 2\right)}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                2. *-commutativeN/A

                                  \[\leadsto \frac{\cos \color{blue}{\left(2 \cdot x\right)}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                3. count-2N/A

                                  \[\leadsto \frac{\cos \color{blue}{\left(x + x\right)}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                4. lower-+.f6496.9

                                  \[\leadsto \frac{\cos \color{blue}{\left(x + x\right)}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                              8. Applied rewrites96.9%

                                \[\leadsto \frac{\cos \color{blue}{\left(x + x\right)}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                              9. Step-by-step derivation
                                1. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)}} \]
                                2. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right)} \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                3. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\color{blue}{\left(s \cdot \left(c \cdot x\right)\right)} \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                4. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\left(s \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(\left(c \cdot x\right) \cdot s\right)}} \]
                                5. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\left(s \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot \left(c \cdot x\right)\right)}} \]
                                6. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\left(s \cdot \color{blue}{\left(c \cdot x\right)}\right) \cdot \left(s \cdot \left(c \cdot x\right)\right)} \]
                                7. associate-*r*N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\color{blue}{\left(\left(s \cdot c\right) \cdot x\right)} \cdot \left(s \cdot \left(c \cdot x\right)\right)} \]
                                8. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\left(\color{blue}{\left(s \cdot c\right)} \cdot x\right) \cdot \left(s \cdot \left(c \cdot x\right)\right)} \]
                                9. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\left(\left(s \cdot c\right) \cdot x\right) \cdot \left(s \cdot \color{blue}{\left(c \cdot x\right)}\right)} \]
                                10. associate-*r*N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\left(\left(s \cdot c\right) \cdot x\right) \cdot \color{blue}{\left(\left(s \cdot c\right) \cdot x\right)}} \]
                                11. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\left(\left(s \cdot c\right) \cdot x\right) \cdot \left(\color{blue}{\left(s \cdot c\right)} \cdot x\right)} \]
                                12. unswap-sqrN/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\color{blue}{\left(\left(s \cdot c\right) \cdot \left(s \cdot c\right)\right) \cdot \left(x \cdot x\right)}} \]
                                13. associate-*l*N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\color{blue}{\left(s \cdot c\right) \cdot \left(\left(s \cdot c\right) \cdot \left(x \cdot x\right)\right)}} \]
                                14. lower-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\color{blue}{\left(s \cdot c\right) \cdot \left(\left(s \cdot c\right) \cdot \left(x \cdot x\right)\right)}} \]
                                15. lower-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\left(s \cdot c\right) \cdot \color{blue}{\left(\left(s \cdot c\right) \cdot \left(x \cdot x\right)\right)}} \]
                                16. lower-*.f6499.7

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\left(s \cdot c\right) \cdot \left(\left(s \cdot c\right) \cdot \color{blue}{\left(x \cdot x\right)}\right)} \]
                              10. Applied rewrites99.7%

                                \[\leadsto \frac{\cos \left(x + x\right)}{\color{blue}{\left(s \cdot c\right) \cdot \left(\left(s \cdot c\right) \cdot \left(x \cdot x\right)\right)}} \]

                              if 3.29999999999999994e153 < x

                              1. Initial program 69.6%

                                \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                              2. Add Preprocessing
                              3. Step-by-step derivation
                                1. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \color{blue}{\left(2 \cdot x\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                2. *-commutativeN/A

                                  \[\leadsto \frac{\cos \color{blue}{\left(x \cdot 2\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                3. lower-*.f6469.6

                                  \[\leadsto \frac{\cos \color{blue}{\left(x \cdot 2\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                4. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                                5. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right) \cdot {c}^{2}}} \]
                                6. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \cdot {c}^{2}} \]
                                7. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \cdot {c}^{2}} \]
                                8. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(x \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}\right) \cdot {c}^{2}} \]
                                9. associate-*r*N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot x\right) \cdot {s}^{2}\right)} \cdot {c}^{2}} \]
                                10. associate-*l*N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot x\right) \cdot \left({s}^{2} \cdot {c}^{2}\right)}} \]
                                11. pow2N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{x}^{2}} \cdot \left({s}^{2} \cdot {c}^{2}\right)} \]
                                12. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}} \]
                                13. lift-pow.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \left(\color{blue}{{c}^{2}} \cdot {s}^{2}\right)} \]
                                14. lift-pow.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \left({c}^{2} \cdot \color{blue}{{s}^{2}}\right)} \]
                                15. pow-prod-downN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \color{blue}{{\left(c \cdot s\right)}^{2}}} \]
                                16. pow-prod-downN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
                                17. lower-pow.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
                                18. lower-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}}^{2}} \]
                                19. lower-*.f6495.0

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{\left(x \cdot \color{blue}{\left(c \cdot s\right)}\right)}^{2}} \]
                              4. Applied rewrites95.0%

                                \[\leadsto \color{blue}{\frac{\cos \left(x \cdot 2\right)}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
                              5. Step-by-step derivation
                                1. lift-pow.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
                                2. unpow2N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)}} \]
                                3. lower-*.f6495.0

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)}} \]
                                4. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right)} \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                5. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(x \cdot \color{blue}{\left(c \cdot s\right)}\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                6. associate-*r*N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot c\right) \cdot s\right)} \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                7. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\color{blue}{\left(c \cdot x\right)} \cdot s\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                8. lower-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right)} \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                9. lower-*.f6495.0

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\color{blue}{\left(c \cdot x\right)} \cdot s\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                10. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}} \]
                                11. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(x \cdot \color{blue}{\left(c \cdot s\right)}\right)} \]
                                12. associate-*r*N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \color{blue}{\left(\left(x \cdot c\right) \cdot s\right)}} \]
                                13. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\color{blue}{\left(c \cdot x\right)} \cdot s\right)} \]
                                14. lower-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \color{blue}{\left(\left(c \cdot x\right) \cdot s\right)}} \]
                                15. lower-*.f6499.6

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\color{blue}{\left(c \cdot x\right)} \cdot s\right)} \]
                              6. Applied rewrites99.6%

                                \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)}} \]
                              7. Step-by-step derivation
                                1. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \color{blue}{\left(x \cdot 2\right)}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                2. *-commutativeN/A

                                  \[\leadsto \frac{\cos \color{blue}{\left(2 \cdot x\right)}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                3. count-2N/A

                                  \[\leadsto \frac{\cos \color{blue}{\left(x + x\right)}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                4. lower-+.f6499.6

                                  \[\leadsto \frac{\cos \color{blue}{\left(x + x\right)}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                              8. Applied rewrites99.6%

                                \[\leadsto \frac{\cos \color{blue}{\left(x + x\right)}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                              9. Step-by-step derivation
                                1. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)}} \]
                                2. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right)} \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                3. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\left(\color{blue}{\left(c \cdot x\right)} \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                4. associate-*l*N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\color{blue}{\left(c \cdot \left(x \cdot s\right)\right)} \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                5. associate-*l*N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\color{blue}{c \cdot \left(\left(x \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)\right)}} \]
                                6. lower-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\color{blue}{c \cdot \left(\left(x \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)\right)}} \]
                                7. lower-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{c \cdot \color{blue}{\left(\left(x \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)\right)}} \]
                                8. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{c \cdot \left(\color{blue}{\left(s \cdot x\right)} \cdot \left(\left(c \cdot x\right) \cdot s\right)\right)} \]
                                9. lower-*.f6494.8

                                  \[\leadsto \frac{\cos \left(x + x\right)}{c \cdot \left(\color{blue}{\left(s \cdot x\right)} \cdot \left(\left(c \cdot x\right) \cdot s\right)\right)} \]
                                10. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{c \cdot \left(\left(s \cdot x\right) \cdot \color{blue}{\left(\left(c \cdot x\right) \cdot s\right)}\right)} \]
                                11. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{c \cdot \left(\left(s \cdot x\right) \cdot \color{blue}{\left(s \cdot \left(c \cdot x\right)\right)}\right)} \]
                                12. lower-*.f6494.8

                                  \[\leadsto \frac{\cos \left(x + x\right)}{c \cdot \left(\left(s \cdot x\right) \cdot \color{blue}{\left(s \cdot \left(c \cdot x\right)\right)}\right)} \]
                              10. Applied rewrites94.8%

                                \[\leadsto \frac{\cos \left(x + x\right)}{\color{blue}{c \cdot \left(\left(s \cdot x\right) \cdot \left(s \cdot \left(c \cdot x\right)\right)\right)}} \]
                            7. Recombined 3 regimes into one program.
                            8. Final simplification85.4%

                              \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.75 \cdot 10^{-131}:\\ \;\;\;\;\frac{1}{\left({\left(s \cdot x\right)}^{2} \cdot c\right) \cdot c}\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{+153}:\\ \;\;\;\;\frac{\cos \left(x + x\right)}{\left(\left(x \cdot x\right) \cdot \left(s \cdot c\right)\right) \cdot \left(s \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(x + x\right)}{\left(\left(s \cdot x\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)\right) \cdot c}\\ \end{array} \]
                            9. Add Preprocessing

                            Alternative 9: 78.6% accurate, 2.3× speedup?

                            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 28:\\ \;\;\;\;\frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{{\left(\left(s \cdot c\right) \cdot x\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(x + x\right)}{\left(\left(s \cdot x\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)\right) \cdot c}\\ \end{array} \end{array} \]
                            (FPCore (x c s)
                             :precision binary64
                             (if (<= x 28.0)
                               (/ (fma -2.0 (* x x) 1.0) (pow (* (* s c) x) 2.0))
                               (/ (cos (+ x x)) (* (* (* s x) (* (* c x) s)) c))))
                            double code(double x, double c, double s) {
                            	double tmp;
                            	if (x <= 28.0) {
                            		tmp = fma(-2.0, (x * x), 1.0) / pow(((s * c) * x), 2.0);
                            	} else {
                            		tmp = cos((x + x)) / (((s * x) * ((c * x) * s)) * c);
                            	}
                            	return tmp;
                            }
                            
                            function code(x, c, s)
                            	tmp = 0.0
                            	if (x <= 28.0)
                            		tmp = Float64(fma(-2.0, Float64(x * x), 1.0) / (Float64(Float64(s * c) * x) ^ 2.0));
                            	else
                            		tmp = Float64(cos(Float64(x + x)) / Float64(Float64(Float64(s * x) * Float64(Float64(c * x) * s)) * c));
                            	end
                            	return tmp
                            end
                            
                            code[x_, c_, s_] := If[LessEqual[x, 28.0], N[(N[(-2.0 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] / N[Power[N[(N[(s * c), $MachinePrecision] * x), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision] / N[(N[(N[(s * x), $MachinePrecision] * N[(N[(c * x), $MachinePrecision] * s), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]]
                            
                            \begin{array}{l}
                            
                            \\
                            \begin{array}{l}
                            \mathbf{if}\;x \leq 28:\\
                            \;\;\;\;\frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{{\left(\left(s \cdot c\right) \cdot x\right)}^{2}}\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;\frac{\cos \left(x + x\right)}{\left(\left(s \cdot x\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)\right) \cdot c}\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 2 regimes
                            2. if x < 28

                              1. Initial program 63.8%

                                \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                              2. Add Preprocessing
                              3. Step-by-step derivation
                                1. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \color{blue}{\left(2 \cdot x\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                2. *-commutativeN/A

                                  \[\leadsto \frac{\cos \color{blue}{\left(x \cdot 2\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                3. lower-*.f6463.8

                                  \[\leadsto \frac{\cos \color{blue}{\left(x \cdot 2\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                4. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                                5. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right) \cdot {c}^{2}}} \]
                                6. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \cdot {c}^{2}} \]
                                7. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \cdot {c}^{2}} \]
                                8. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(x \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}\right) \cdot {c}^{2}} \]
                                9. associate-*r*N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot x\right) \cdot {s}^{2}\right)} \cdot {c}^{2}} \]
                                10. associate-*l*N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot x\right) \cdot \left({s}^{2} \cdot {c}^{2}\right)}} \]
                                11. pow2N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{x}^{2}} \cdot \left({s}^{2} \cdot {c}^{2}\right)} \]
                                12. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}} \]
                                13. lift-pow.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \left(\color{blue}{{c}^{2}} \cdot {s}^{2}\right)} \]
                                14. lift-pow.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \left({c}^{2} \cdot \color{blue}{{s}^{2}}\right)} \]
                                15. pow-prod-downN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \color{blue}{{\left(c \cdot s\right)}^{2}}} \]
                                16. pow-prod-downN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
                                17. lower-pow.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
                                18. lower-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}}^{2}} \]
                                19. lower-*.f6498.5

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{\left(x \cdot \color{blue}{\left(c \cdot s\right)}\right)}^{2}} \]
                              4. Applied rewrites98.5%

                                \[\leadsto \color{blue}{\frac{\cos \left(x \cdot 2\right)}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
                              5. Taylor expanded in x around 0

                                \[\leadsto \frac{\color{blue}{1 + -2 \cdot {x}^{2}}}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}} \]
                              6. Step-by-step derivation
                                1. +-commutativeN/A

                                  \[\leadsto \frac{\color{blue}{-2 \cdot {x}^{2} + 1}}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}} \]
                                2. lower-fma.f64N/A

                                  \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-2, {x}^{2}, 1\right)}}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}} \]
                                3. unpow2N/A

                                  \[\leadsto \frac{\mathsf{fma}\left(-2, \color{blue}{x \cdot x}, 1\right)}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}} \]
                                4. lower-*.f6471.3

                                  \[\leadsto \frac{\mathsf{fma}\left(-2, \color{blue}{x \cdot x}, 1\right)}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}} \]
                              7. Applied rewrites71.3%

                                \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-2, x \cdot x, 1\right)}}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}} \]

                              if 28 < x

                              1. Initial program 72.1%

                                \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                              2. Add Preprocessing
                              3. Step-by-step derivation
                                1. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \color{blue}{\left(2 \cdot x\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                2. *-commutativeN/A

                                  \[\leadsto \frac{\cos \color{blue}{\left(x \cdot 2\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                3. lower-*.f6472.1

                                  \[\leadsto \frac{\cos \color{blue}{\left(x \cdot 2\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                4. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                                5. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right) \cdot {c}^{2}}} \]
                                6. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \cdot {c}^{2}} \]
                                7. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \cdot {c}^{2}} \]
                                8. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(x \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}\right) \cdot {c}^{2}} \]
                                9. associate-*r*N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot x\right) \cdot {s}^{2}\right)} \cdot {c}^{2}} \]
                                10. associate-*l*N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot x\right) \cdot \left({s}^{2} \cdot {c}^{2}\right)}} \]
                                11. pow2N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{x}^{2}} \cdot \left({s}^{2} \cdot {c}^{2}\right)} \]
                                12. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}} \]
                                13. lift-pow.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \left(\color{blue}{{c}^{2}} \cdot {s}^{2}\right)} \]
                                14. lift-pow.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \left({c}^{2} \cdot \color{blue}{{s}^{2}}\right)} \]
                                15. pow-prod-downN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \color{blue}{{\left(c \cdot s\right)}^{2}}} \]
                                16. pow-prod-downN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
                                17. lower-pow.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
                                18. lower-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}}^{2}} \]
                                19. lower-*.f6497.1

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{\left(x \cdot \color{blue}{\left(c \cdot s\right)}\right)}^{2}} \]
                              4. Applied rewrites97.1%

                                \[\leadsto \color{blue}{\frac{\cos \left(x \cdot 2\right)}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
                              5. Step-by-step derivation
                                1. lift-pow.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
                                2. unpow2N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)}} \]
                                3. lower-*.f6497.1

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)}} \]
                                4. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right)} \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                5. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(x \cdot \color{blue}{\left(c \cdot s\right)}\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                6. associate-*r*N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot c\right) \cdot s\right)} \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                7. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\color{blue}{\left(c \cdot x\right)} \cdot s\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                8. lower-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right)} \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                9. lower-*.f6495.9

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\color{blue}{\left(c \cdot x\right)} \cdot s\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                10. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}} \]
                                11. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(x \cdot \color{blue}{\left(c \cdot s\right)}\right)} \]
                                12. associate-*r*N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \color{blue}{\left(\left(x \cdot c\right) \cdot s\right)}} \]
                                13. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\color{blue}{\left(c \cdot x\right)} \cdot s\right)} \]
                                14. lower-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \color{blue}{\left(\left(c \cdot x\right) \cdot s\right)}} \]
                                15. lower-*.f6498.3

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\color{blue}{\left(c \cdot x\right)} \cdot s\right)} \]
                              6. Applied rewrites98.3%

                                \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)}} \]
                              7. Step-by-step derivation
                                1. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \color{blue}{\left(x \cdot 2\right)}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                2. *-commutativeN/A

                                  \[\leadsto \frac{\cos \color{blue}{\left(2 \cdot x\right)}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                3. count-2N/A

                                  \[\leadsto \frac{\cos \color{blue}{\left(x + x\right)}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                4. lower-+.f6498.3

                                  \[\leadsto \frac{\cos \color{blue}{\left(x + x\right)}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                              8. Applied rewrites98.3%

                                \[\leadsto \frac{\cos \color{blue}{\left(x + x\right)}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                              9. Step-by-step derivation
                                1. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)}} \]
                                2. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right)} \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                3. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\left(\color{blue}{\left(c \cdot x\right)} \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                4. associate-*l*N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\color{blue}{\left(c \cdot \left(x \cdot s\right)\right)} \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                5. associate-*l*N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\color{blue}{c \cdot \left(\left(x \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)\right)}} \]
                                6. lower-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{\color{blue}{c \cdot \left(\left(x \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)\right)}} \]
                                7. lower-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{c \cdot \color{blue}{\left(\left(x \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)\right)}} \]
                                8. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{c \cdot \left(\color{blue}{\left(s \cdot x\right)} \cdot \left(\left(c \cdot x\right) \cdot s\right)\right)} \]
                                9. lower-*.f6492.3

                                  \[\leadsto \frac{\cos \left(x + x\right)}{c \cdot \left(\color{blue}{\left(s \cdot x\right)} \cdot \left(\left(c \cdot x\right) \cdot s\right)\right)} \]
                                10. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{c \cdot \left(\left(s \cdot x\right) \cdot \color{blue}{\left(\left(c \cdot x\right) \cdot s\right)}\right)} \]
                                11. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(x + x\right)}{c \cdot \left(\left(s \cdot x\right) \cdot \color{blue}{\left(s \cdot \left(c \cdot x\right)\right)}\right)} \]
                                12. lower-*.f6492.3

                                  \[\leadsto \frac{\cos \left(x + x\right)}{c \cdot \left(\left(s \cdot x\right) \cdot \color{blue}{\left(s \cdot \left(c \cdot x\right)\right)}\right)} \]
                              10. Applied rewrites92.3%

                                \[\leadsto \frac{\cos \left(x + x\right)}{\color{blue}{c \cdot \left(\left(s \cdot x\right) \cdot \left(s \cdot \left(c \cdot x\right)\right)\right)}} \]
                            3. Recombined 2 regimes into one program.
                            4. Final simplification77.3%

                              \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 28:\\ \;\;\;\;\frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{{\left(\left(s \cdot c\right) \cdot x\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(x + x\right)}{\left(\left(s \cdot x\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)\right) \cdot c}\\ \end{array} \]
                            5. Add Preprocessing

                            Alternative 10: 72.0% accurate, 2.3× speedup?

                            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;{c}^{2} \leq 4 \cdot 10^{-322}:\\ \;\;\;\;\frac{1}{\left(\left(\left(s \cdot c\right) \cdot \left(s \cdot c\right)\right) \cdot x\right) \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(\left(c \cdot c\right) \cdot \left(s \cdot x\right)\right) \cdot \left(s \cdot x\right)}\\ \end{array} \end{array} \]
                            (FPCore (x c s)
                             :precision binary64
                             (if (<= (pow c 2.0) 4e-322)
                               (/ 1.0 (* (* (* (* s c) (* s c)) x) x))
                               (/ 1.0 (* (* (* c c) (* s x)) (* s x)))))
                            double code(double x, double c, double s) {
                            	double tmp;
                            	if (pow(c, 2.0) <= 4e-322) {
                            		tmp = 1.0 / ((((s * c) * (s * c)) * x) * x);
                            	} else {
                            		tmp = 1.0 / (((c * c) * (s * x)) * (s * x));
                            	}
                            	return tmp;
                            }
                            
                            real(8) function code(x, c, s)
                                real(8), intent (in) :: x
                                real(8), intent (in) :: c
                                real(8), intent (in) :: s
                                real(8) :: tmp
                                if ((c ** 2.0d0) <= 4d-322) then
                                    tmp = 1.0d0 / ((((s * c) * (s * c)) * x) * x)
                                else
                                    tmp = 1.0d0 / (((c * c) * (s * x)) * (s * x))
                                end if
                                code = tmp
                            end function
                            
                            public static double code(double x, double c, double s) {
                            	double tmp;
                            	if (Math.pow(c, 2.0) <= 4e-322) {
                            		tmp = 1.0 / ((((s * c) * (s * c)) * x) * x);
                            	} else {
                            		tmp = 1.0 / (((c * c) * (s * x)) * (s * x));
                            	}
                            	return tmp;
                            }
                            
                            def code(x, c, s):
                            	tmp = 0
                            	if math.pow(c, 2.0) <= 4e-322:
                            		tmp = 1.0 / ((((s * c) * (s * c)) * x) * x)
                            	else:
                            		tmp = 1.0 / (((c * c) * (s * x)) * (s * x))
                            	return tmp
                            
                            function code(x, c, s)
                            	tmp = 0.0
                            	if ((c ^ 2.0) <= 4e-322)
                            		tmp = Float64(1.0 / Float64(Float64(Float64(Float64(s * c) * Float64(s * c)) * x) * x));
                            	else
                            		tmp = Float64(1.0 / Float64(Float64(Float64(c * c) * Float64(s * x)) * Float64(s * x)));
                            	end
                            	return tmp
                            end
                            
                            function tmp_2 = code(x, c, s)
                            	tmp = 0.0;
                            	if ((c ^ 2.0) <= 4e-322)
                            		tmp = 1.0 / ((((s * c) * (s * c)) * x) * x);
                            	else
                            		tmp = 1.0 / (((c * c) * (s * x)) * (s * x));
                            	end
                            	tmp_2 = tmp;
                            end
                            
                            code[x_, c_, s_] := If[LessEqual[N[Power[c, 2.0], $MachinePrecision], 4e-322], N[(1.0 / N[(N[(N[(N[(s * c), $MachinePrecision] * N[(s * c), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[(c * c), $MachinePrecision] * N[(s * x), $MachinePrecision]), $MachinePrecision] * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                            
                            \begin{array}{l}
                            
                            \\
                            \begin{array}{l}
                            \mathbf{if}\;{c}^{2} \leq 4 \cdot 10^{-322}:\\
                            \;\;\;\;\frac{1}{\left(\left(\left(s \cdot c\right) \cdot \left(s \cdot c\right)\right) \cdot x\right) \cdot x}\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;\frac{1}{\left(\left(c \cdot c\right) \cdot \left(s \cdot x\right)\right) \cdot \left(s \cdot x\right)}\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 2 regimes
                            2. if (pow.f64 c #s(literal 2 binary64)) < 4.00193e-322

                              1. Initial program 55.0%

                                \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                              2. Add Preprocessing
                              3. Step-by-step derivation
                                1. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                                2. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                                3. associate-*r*N/A

                                  \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot x}} \]
                                4. lower-*.f64N/A

                                  \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot x}} \]
                                5. lift-*.f64N/A

                                  \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}\right) \cdot x} \]
                                6. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot \color{blue}{\left({s}^{2} \cdot x\right)}\right) \cdot x} \]
                                7. associate-*r*N/A

                                  \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot {s}^{2}\right) \cdot x\right)} \cdot x} \]
                                8. lower-*.f64N/A

                                  \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot {s}^{2}\right) \cdot x\right)} \cdot x} \]
                                9. *-commutativeN/A

                                  \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left({s}^{2} \cdot {c}^{2}\right)} \cdot x\right) \cdot x} \]
                                10. lift-pow.f64N/A

                                  \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(\color{blue}{{s}^{2}} \cdot {c}^{2}\right) \cdot x\right) \cdot x} \]
                                11. lift-pow.f64N/A

                                  \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot \color{blue}{{c}^{2}}\right) \cdot x\right) \cdot x} \]
                                12. pow-prod-downN/A

                                  \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{{\left(s \cdot c\right)}^{2}} \cdot x\right) \cdot x} \]
                                13. lower-pow.f64N/A

                                  \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{{\left(s \cdot c\right)}^{2}} \cdot x\right) \cdot x} \]
                                14. lower-*.f6485.5

                                  \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({\color{blue}{\left(s \cdot c\right)}}^{2} \cdot x\right) \cdot x} \]
                              4. Applied rewrites85.5%

                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({\left(s \cdot c\right)}^{2} \cdot x\right) \cdot x}} \]
                              5. Taylor expanded in x around 0

                                \[\leadsto \frac{\color{blue}{1}}{\left({\left(s \cdot c\right)}^{2} \cdot x\right) \cdot x} \]
                              6. Step-by-step derivation
                                1. Applied rewrites77.7%

                                  \[\leadsto \frac{\color{blue}{1}}{\left({\left(s \cdot c\right)}^{2} \cdot x\right) \cdot x} \]
                                2. Step-by-step derivation
                                  1. lift-pow.f64N/A

                                    \[\leadsto \frac{1}{\left(\color{blue}{{\left(s \cdot c\right)}^{2}} \cdot x\right) \cdot x} \]
                                  2. unpow2N/A

                                    \[\leadsto \frac{1}{\left(\color{blue}{\left(\left(s \cdot c\right) \cdot \left(s \cdot c\right)\right)} \cdot x\right) \cdot x} \]
                                  3. lower-*.f6477.7

                                    \[\leadsto \frac{1}{\left(\color{blue}{\left(\left(s \cdot c\right) \cdot \left(s \cdot c\right)\right)} \cdot x\right) \cdot x} \]
                                3. Applied rewrites77.7%

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

                                if 4.00193e-322 < (pow.f64 c #s(literal 2 binary64))

                                1. Initial program 69.5%

                                  \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                2. Add Preprocessing
                                3. Step-by-step derivation
                                  1. lift-*.f64N/A

                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                                  2. lift-*.f64N/A

                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                                  3. *-commutativeN/A

                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(x \cdot \left(x \cdot {s}^{2}\right)\right)}} \]
                                  4. associate-*r*N/A

                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot x\right) \cdot \left(x \cdot {s}^{2}\right)}} \]
                                  5. lift-*.f64N/A

                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}} \]
                                  6. *-commutativeN/A

                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left({s}^{2} \cdot x\right)}} \]
                                  7. lift-pow.f64N/A

                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \left(\color{blue}{{s}^{2}} \cdot x\right)} \]
                                  8. unpow2N/A

                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \left(\color{blue}{\left(s \cdot s\right)} \cdot x\right)} \]
                                  9. associate-*l*N/A

                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left(s \cdot \left(s \cdot x\right)\right)}} \]
                                  10. associate-*r*N/A

                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right) \cdot \left(s \cdot x\right)}} \]
                                  11. lower-*.f64N/A

                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right) \cdot \left(s \cdot x\right)}} \]
                                  12. lower-*.f64N/A

                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right)} \cdot \left(s \cdot x\right)} \]
                                  13. *-commutativeN/A

                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(x \cdot {c}^{2}\right)} \cdot s\right) \cdot \left(s \cdot x\right)} \]
                                  14. lower-*.f64N/A

                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(x \cdot {c}^{2}\right)} \cdot s\right) \cdot \left(s \cdot x\right)} \]
                                  15. lift-pow.f64N/A

                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{{c}^{2}}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
                                  16. unpow2N/A

                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
                                  17. lower-*.f64N/A

                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
                                  18. *-commutativeN/A

                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \color{blue}{\left(x \cdot s\right)}} \]
                                  19. lower-*.f6483.5

                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \color{blue}{\left(x \cdot s\right)}} \]
                                4. Applied rewrites83.5%

                                  \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)}} \]
                                5. Taylor expanded in x around 0

                                  \[\leadsto \frac{\color{blue}{1}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
                                6. Step-by-step derivation
                                  1. Applied rewrites67.5%

                                    \[\leadsto \frac{\color{blue}{1}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
                                  2. Step-by-step derivation
                                    1. lift-*.f64N/A

                                      \[\leadsto \frac{1}{\color{blue}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right)} \cdot \left(x \cdot s\right)} \]
                                    2. *-commutativeN/A

                                      \[\leadsto \frac{1}{\color{blue}{\left(s \cdot \left(x \cdot \left(c \cdot c\right)\right)\right)} \cdot \left(x \cdot s\right)} \]
                                    3. lift-*.f64N/A

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

                                      \[\leadsto \frac{1}{\color{blue}{\left(\left(s \cdot x\right) \cdot \left(c \cdot c\right)\right)} \cdot \left(x \cdot s\right)} \]
                                    5. *-commutativeN/A

                                      \[\leadsto \frac{1}{\left(\color{blue}{\left(x \cdot s\right)} \cdot \left(c \cdot c\right)\right) \cdot \left(x \cdot s\right)} \]
                                    6. lift-*.f64N/A

                                      \[\leadsto \frac{1}{\left(\color{blue}{\left(x \cdot s\right)} \cdot \left(c \cdot c\right)\right) \cdot \left(x \cdot s\right)} \]
                                    7. lower-*.f6468.9

                                      \[\leadsto \frac{1}{\color{blue}{\left(\left(x \cdot s\right) \cdot \left(c \cdot c\right)\right)} \cdot \left(x \cdot s\right)} \]
                                    8. lift-*.f64N/A

                                      \[\leadsto \frac{1}{\left(\color{blue}{\left(x \cdot s\right)} \cdot \left(c \cdot c\right)\right) \cdot \left(x \cdot s\right)} \]
                                    9. *-commutativeN/A

                                      \[\leadsto \frac{1}{\left(\color{blue}{\left(s \cdot x\right)} \cdot \left(c \cdot c\right)\right) \cdot \left(x \cdot s\right)} \]
                                    10. lower-*.f6468.9

                                      \[\leadsto \frac{1}{\left(\color{blue}{\left(s \cdot x\right)} \cdot \left(c \cdot c\right)\right) \cdot \left(x \cdot s\right)} \]
                                  3. Applied rewrites68.9%

                                    \[\leadsto \frac{1}{\color{blue}{\left(\left(s \cdot x\right) \cdot \left(c \cdot c\right)\right)} \cdot \left(x \cdot s\right)} \]
                                7. Recombined 2 regimes into one program.
                                8. Final simplification70.9%

                                  \[\leadsto \begin{array}{l} \mathbf{if}\;{c}^{2} \leq 4 \cdot 10^{-322}:\\ \;\;\;\;\frac{1}{\left(\left(\left(s \cdot c\right) \cdot \left(s \cdot c\right)\right) \cdot x\right) \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(\left(c \cdot c\right) \cdot \left(s \cdot x\right)\right) \cdot \left(s \cdot x\right)}\\ \end{array} \]
                                9. Add Preprocessing

                                Alternative 11: 97.2% accurate, 2.4× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(c \cdot x\right) \cdot s\\ \frac{\cos \left(x + x\right)}{t\_0 \cdot t\_0} \end{array} \end{array} \]
                                (FPCore (x c s)
                                 :precision binary64
                                 (let* ((t_0 (* (* c x) s))) (/ (cos (+ x x)) (* t_0 t_0))))
                                double code(double x, double c, double s) {
                                	double t_0 = (c * x) * s;
                                	return cos((x + x)) / (t_0 * t_0);
                                }
                                
                                real(8) function code(x, c, s)
                                    real(8), intent (in) :: x
                                    real(8), intent (in) :: c
                                    real(8), intent (in) :: s
                                    real(8) :: t_0
                                    t_0 = (c * x) * s
                                    code = cos((x + x)) / (t_0 * t_0)
                                end function
                                
                                public static double code(double x, double c, double s) {
                                	double t_0 = (c * x) * s;
                                	return Math.cos((x + x)) / (t_0 * t_0);
                                }
                                
                                def code(x, c, s):
                                	t_0 = (c * x) * s
                                	return math.cos((x + x)) / (t_0 * t_0)
                                
                                function code(x, c, s)
                                	t_0 = Float64(Float64(c * x) * s)
                                	return Float64(cos(Float64(x + x)) / Float64(t_0 * t_0))
                                end
                                
                                function tmp = code(x, c, s)
                                	t_0 = (c * x) * s;
                                	tmp = cos((x + x)) / (t_0 * t_0);
                                end
                                
                                code[x_, c_, s_] := Block[{t$95$0 = N[(N[(c * x), $MachinePrecision] * s), $MachinePrecision]}, N[(N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
                                
                                \begin{array}{l}
                                
                                \\
                                \begin{array}{l}
                                t_0 := \left(c \cdot x\right) \cdot s\\
                                \frac{\cos \left(x + x\right)}{t\_0 \cdot t\_0}
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Initial program 66.2%

                                  \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                2. Add Preprocessing
                                3. Step-by-step derivation
                                  1. lift-*.f64N/A

                                    \[\leadsto \frac{\cos \color{blue}{\left(2 \cdot x\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                  2. *-commutativeN/A

                                    \[\leadsto \frac{\cos \color{blue}{\left(x \cdot 2\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                  3. lower-*.f6466.2

                                    \[\leadsto \frac{\cos \color{blue}{\left(x \cdot 2\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                  4. lift-*.f64N/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                                  5. *-commutativeN/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right) \cdot {c}^{2}}} \]
                                  6. lift-*.f64N/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \cdot {c}^{2}} \]
                                  7. *-commutativeN/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \cdot {c}^{2}} \]
                                  8. lift-*.f64N/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(x \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}\right) \cdot {c}^{2}} \]
                                  9. associate-*r*N/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot x\right) \cdot {s}^{2}\right)} \cdot {c}^{2}} \]
                                  10. associate-*l*N/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot x\right) \cdot \left({s}^{2} \cdot {c}^{2}\right)}} \]
                                  11. pow2N/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{x}^{2}} \cdot \left({s}^{2} \cdot {c}^{2}\right)} \]
                                  12. *-commutativeN/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}} \]
                                  13. lift-pow.f64N/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \left(\color{blue}{{c}^{2}} \cdot {s}^{2}\right)} \]
                                  14. lift-pow.f64N/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \left({c}^{2} \cdot \color{blue}{{s}^{2}}\right)} \]
                                  15. pow-prod-downN/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \color{blue}{{\left(c \cdot s\right)}^{2}}} \]
                                  16. pow-prod-downN/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
                                  17. lower-pow.f64N/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
                                  18. lower-*.f64N/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}}^{2}} \]
                                  19. lower-*.f6498.1

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{\left(x \cdot \color{blue}{\left(c \cdot s\right)}\right)}^{2}} \]
                                4. Applied rewrites98.1%

                                  \[\leadsto \color{blue}{\frac{\cos \left(x \cdot 2\right)}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
                                5. Step-by-step derivation
                                  1. lift-pow.f64N/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
                                  2. unpow2N/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)}} \]
                                  3. lower-*.f6498.1

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)}} \]
                                  4. lift-*.f64N/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right)} \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                  5. lift-*.f64N/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(x \cdot \color{blue}{\left(c \cdot s\right)}\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                  6. associate-*r*N/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot c\right) \cdot s\right)} \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                  7. *-commutativeN/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\color{blue}{\left(c \cdot x\right)} \cdot s\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                  8. lower-*.f64N/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right)} \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                  9. lower-*.f6496.4

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\color{blue}{\left(c \cdot x\right)} \cdot s\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                  10. lift-*.f64N/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}} \]
                                  11. lift-*.f64N/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(x \cdot \color{blue}{\left(c \cdot s\right)}\right)} \]
                                  12. associate-*r*N/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \color{blue}{\left(\left(x \cdot c\right) \cdot s\right)}} \]
                                  13. *-commutativeN/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\color{blue}{\left(c \cdot x\right)} \cdot s\right)} \]
                                  14. lower-*.f64N/A

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \color{blue}{\left(\left(c \cdot x\right) \cdot s\right)}} \]
                                  15. lower-*.f6497.8

                                    \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\color{blue}{\left(c \cdot x\right)} \cdot s\right)} \]
                                6. Applied rewrites97.8%

                                  \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)}} \]
                                7. Step-by-step derivation
                                  1. lift-*.f64N/A

                                    \[\leadsto \frac{\cos \color{blue}{\left(x \cdot 2\right)}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                  2. *-commutativeN/A

                                    \[\leadsto \frac{\cos \color{blue}{\left(2 \cdot x\right)}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                  3. count-2N/A

                                    \[\leadsto \frac{\cos \color{blue}{\left(x + x\right)}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                  4. lower-+.f6497.8

                                    \[\leadsto \frac{\cos \color{blue}{\left(x + x\right)}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                8. Applied rewrites97.8%

                                  \[\leadsto \frac{\cos \color{blue}{\left(x + x\right)}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                9. Add Preprocessing

                                Alternative 12: 71.9% accurate, 7.8× speedup?

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

                                  1. Initial program 63.2%

                                    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                  2. Add Preprocessing
                                  3. Step-by-step derivation
                                    1. lift-*.f64N/A

                                      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                                    2. lift-*.f64N/A

                                      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                                    3. associate-*r*N/A

                                      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot x}} \]
                                    4. lower-*.f64N/A

                                      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot x}} \]
                                    5. lift-*.f64N/A

                                      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}\right) \cdot x} \]
                                    6. *-commutativeN/A

                                      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot \color{blue}{\left({s}^{2} \cdot x\right)}\right) \cdot x} \]
                                    7. associate-*r*N/A

                                      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot {s}^{2}\right) \cdot x\right)} \cdot x} \]
                                    8. lower-*.f64N/A

                                      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot {s}^{2}\right) \cdot x\right)} \cdot x} \]
                                    9. *-commutativeN/A

                                      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left({s}^{2} \cdot {c}^{2}\right)} \cdot x\right) \cdot x} \]
                                    10. lift-pow.f64N/A

                                      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(\color{blue}{{s}^{2}} \cdot {c}^{2}\right) \cdot x\right) \cdot x} \]
                                    11. lift-pow.f64N/A

                                      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot \color{blue}{{c}^{2}}\right) \cdot x\right) \cdot x} \]
                                    12. pow-prod-downN/A

                                      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{{\left(s \cdot c\right)}^{2}} \cdot x\right) \cdot x} \]
                                    13. lower-pow.f64N/A

                                      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{{\left(s \cdot c\right)}^{2}} \cdot x\right) \cdot x} \]
                                    14. lower-*.f6485.4

                                      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({\color{blue}{\left(s \cdot c\right)}}^{2} \cdot x\right) \cdot x} \]
                                  4. Applied rewrites85.4%

                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({\left(s \cdot c\right)}^{2} \cdot x\right) \cdot x}} \]
                                  5. Taylor expanded in x around 0

                                    \[\leadsto \frac{\color{blue}{1}}{\left({\left(s \cdot c\right)}^{2} \cdot x\right) \cdot x} \]
                                  6. Step-by-step derivation
                                    1. Applied rewrites72.1%

                                      \[\leadsto \frac{\color{blue}{1}}{\left({\left(s \cdot c\right)}^{2} \cdot x\right) \cdot x} \]
                                    2. Step-by-step derivation
                                      1. lift-*.f64N/A

                                        \[\leadsto \frac{1}{\color{blue}{\left({\left(s \cdot c\right)}^{2} \cdot x\right)} \cdot x} \]
                                      2. *-commutativeN/A

                                        \[\leadsto \frac{1}{\color{blue}{\left(x \cdot {\left(s \cdot c\right)}^{2}\right)} \cdot x} \]
                                      3. lift-pow.f64N/A

                                        \[\leadsto \frac{1}{\left(x \cdot \color{blue}{{\left(s \cdot c\right)}^{2}}\right) \cdot x} \]
                                      4. unpow2N/A

                                        \[\leadsto \frac{1}{\left(x \cdot \color{blue}{\left(\left(s \cdot c\right) \cdot \left(s \cdot c\right)\right)}\right) \cdot x} \]
                                      5. lift-*.f64N/A

                                        \[\leadsto \frac{1}{\left(x \cdot \left(\color{blue}{\left(s \cdot c\right)} \cdot \left(s \cdot c\right)\right)\right) \cdot x} \]
                                      6. associate-*l*N/A

                                        \[\leadsto \frac{1}{\left(x \cdot \color{blue}{\left(s \cdot \left(c \cdot \left(s \cdot c\right)\right)\right)}\right) \cdot x} \]
                                      7. lift-*.f64N/A

                                        \[\leadsto \frac{1}{\left(x \cdot \left(s \cdot \left(c \cdot \color{blue}{\left(s \cdot c\right)}\right)\right)\right) \cdot x} \]
                                      8. *-commutativeN/A

                                        \[\leadsto \frac{1}{\left(x \cdot \left(s \cdot \left(c \cdot \color{blue}{\left(c \cdot s\right)}\right)\right)\right) \cdot x} \]
                                      9. associate-*l*N/A

                                        \[\leadsto \frac{1}{\left(x \cdot \left(s \cdot \color{blue}{\left(\left(c \cdot c\right) \cdot s\right)}\right)\right) \cdot x} \]
                                      10. lift-*.f64N/A

                                        \[\leadsto \frac{1}{\left(x \cdot \left(s \cdot \left(\color{blue}{\left(c \cdot c\right)} \cdot s\right)\right)\right) \cdot x} \]
                                      11. associate-*r*N/A

                                        \[\leadsto \frac{1}{\color{blue}{\left(\left(x \cdot s\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)} \cdot x} \]
                                      12. lift-*.f64N/A

                                        \[\leadsto \frac{1}{\left(\color{blue}{\left(x \cdot s\right)} \cdot \left(\left(c \cdot c\right) \cdot s\right)\right) \cdot x} \]
                                      13. *-commutativeN/A

                                        \[\leadsto \frac{1}{\color{blue}{\left(\left(\left(c \cdot c\right) \cdot s\right) \cdot \left(x \cdot s\right)\right)} \cdot x} \]
                                      14. lower-*.f64N/A

                                        \[\leadsto \frac{1}{\color{blue}{\left(\left(\left(c \cdot c\right) \cdot s\right) \cdot \left(x \cdot s\right)\right)} \cdot x} \]
                                      15. *-commutativeN/A

                                        \[\leadsto \frac{1}{\left(\color{blue}{\left(s \cdot \left(c \cdot c\right)\right)} \cdot \left(x \cdot s\right)\right) \cdot x} \]
                                      16. lift-*.f64N/A

                                        \[\leadsto \frac{1}{\left(\left(s \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot \left(x \cdot s\right)\right) \cdot x} \]
                                      17. associate-*r*N/A

                                        \[\leadsto \frac{1}{\left(\color{blue}{\left(\left(s \cdot c\right) \cdot c\right)} \cdot \left(x \cdot s\right)\right) \cdot x} \]
                                      18. lift-*.f64N/A

                                        \[\leadsto \frac{1}{\left(\left(\color{blue}{\left(s \cdot c\right)} \cdot c\right) \cdot \left(x \cdot s\right)\right) \cdot x} \]
                                      19. lower-*.f6474.0

                                        \[\leadsto \frac{1}{\left(\color{blue}{\left(\left(s \cdot c\right) \cdot c\right)} \cdot \left(x \cdot s\right)\right) \cdot x} \]
                                      20. lift-*.f64N/A

                                        \[\leadsto \frac{1}{\left(\left(\left(s \cdot c\right) \cdot c\right) \cdot \color{blue}{\left(x \cdot s\right)}\right) \cdot x} \]
                                      21. *-commutativeN/A

                                        \[\leadsto \frac{1}{\left(\left(\left(s \cdot c\right) \cdot c\right) \cdot \color{blue}{\left(s \cdot x\right)}\right) \cdot x} \]
                                      22. lower-*.f6474.0

                                        \[\leadsto \frac{1}{\left(\left(\left(s \cdot c\right) \cdot c\right) \cdot \color{blue}{\left(s \cdot x\right)}\right) \cdot x} \]
                                    3. Applied rewrites74.0%

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

                                    if 1.05e-160 < c

                                    1. Initial program 71.0%

                                      \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                    2. Add Preprocessing
                                    3. Step-by-step derivation
                                      1. lift-*.f64N/A

                                        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                                      2. lift-*.f64N/A

                                        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                                      3. *-commutativeN/A

                                        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(x \cdot \left(x \cdot {s}^{2}\right)\right)}} \]
                                      4. associate-*r*N/A

                                        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot x\right) \cdot \left(x \cdot {s}^{2}\right)}} \]
                                      5. lift-*.f64N/A

                                        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}} \]
                                      6. *-commutativeN/A

                                        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left({s}^{2} \cdot x\right)}} \]
                                      7. lift-pow.f64N/A

                                        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \left(\color{blue}{{s}^{2}} \cdot x\right)} \]
                                      8. unpow2N/A

                                        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \left(\color{blue}{\left(s \cdot s\right)} \cdot x\right)} \]
                                      9. associate-*l*N/A

                                        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left(s \cdot \left(s \cdot x\right)\right)}} \]
                                      10. associate-*r*N/A

                                        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right) \cdot \left(s \cdot x\right)}} \]
                                      11. lower-*.f64N/A

                                        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right) \cdot \left(s \cdot x\right)}} \]
                                      12. lower-*.f64N/A

                                        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right)} \cdot \left(s \cdot x\right)} \]
                                      13. *-commutativeN/A

                                        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(x \cdot {c}^{2}\right)} \cdot s\right) \cdot \left(s \cdot x\right)} \]
                                      14. lower-*.f64N/A

                                        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(x \cdot {c}^{2}\right)} \cdot s\right) \cdot \left(s \cdot x\right)} \]
                                      15. lift-pow.f64N/A

                                        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{{c}^{2}}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
                                      16. unpow2N/A

                                        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
                                      17. lower-*.f64N/A

                                        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
                                      18. *-commutativeN/A

                                        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \color{blue}{\left(x \cdot s\right)}} \]
                                      19. lower-*.f6484.1

                                        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \color{blue}{\left(x \cdot s\right)}} \]
                                    4. Applied rewrites84.1%

                                      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)}} \]
                                    5. Taylor expanded in x around 0

                                      \[\leadsto \frac{\color{blue}{1}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
                                    6. Step-by-step derivation
                                      1. Applied rewrites68.4%

                                        \[\leadsto \frac{\color{blue}{1}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
                                      2. Step-by-step derivation
                                        1. lift-*.f64N/A

                                          \[\leadsto \frac{1}{\color{blue}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right)} \cdot \left(x \cdot s\right)} \]
                                        2. *-commutativeN/A

                                          \[\leadsto \frac{1}{\color{blue}{\left(s \cdot \left(x \cdot \left(c \cdot c\right)\right)\right)} \cdot \left(x \cdot s\right)} \]
                                        3. lift-*.f64N/A

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

                                          \[\leadsto \frac{1}{\color{blue}{\left(\left(s \cdot x\right) \cdot \left(c \cdot c\right)\right)} \cdot \left(x \cdot s\right)} \]
                                        5. *-commutativeN/A

                                          \[\leadsto \frac{1}{\left(\color{blue}{\left(x \cdot s\right)} \cdot \left(c \cdot c\right)\right) \cdot \left(x \cdot s\right)} \]
                                        6. lift-*.f64N/A

                                          \[\leadsto \frac{1}{\left(\color{blue}{\left(x \cdot s\right)} \cdot \left(c \cdot c\right)\right) \cdot \left(x \cdot s\right)} \]
                                        7. lower-*.f6469.4

                                          \[\leadsto \frac{1}{\color{blue}{\left(\left(x \cdot s\right) \cdot \left(c \cdot c\right)\right)} \cdot \left(x \cdot s\right)} \]
                                        8. lift-*.f64N/A

                                          \[\leadsto \frac{1}{\left(\color{blue}{\left(x \cdot s\right)} \cdot \left(c \cdot c\right)\right) \cdot \left(x \cdot s\right)} \]
                                        9. *-commutativeN/A

                                          \[\leadsto \frac{1}{\left(\color{blue}{\left(s \cdot x\right)} \cdot \left(c \cdot c\right)\right) \cdot \left(x \cdot s\right)} \]
                                        10. lower-*.f6469.4

                                          \[\leadsto \frac{1}{\left(\color{blue}{\left(s \cdot x\right)} \cdot \left(c \cdot c\right)\right) \cdot \left(x \cdot s\right)} \]
                                      3. Applied rewrites69.4%

                                        \[\leadsto \frac{1}{\color{blue}{\left(\left(s \cdot x\right) \cdot \left(c \cdot c\right)\right)} \cdot \left(x \cdot s\right)} \]
                                    7. Recombined 2 regimes into one program.
                                    8. Final simplification72.2%

                                      \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq 1.05 \cdot 10^{-160}:\\ \;\;\;\;\frac{1}{\left(\left(s \cdot x\right) \cdot \left(\left(s \cdot c\right) \cdot c\right)\right) \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(\left(c \cdot c\right) \cdot \left(s \cdot x\right)\right) \cdot \left(s \cdot x\right)}\\ \end{array} \]
                                    9. Add Preprocessing

                                    Alternative 13: 78.9% accurate, 7.8× speedup?

                                    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(c \cdot x\right) \cdot s\\ \frac{\frac{1}{t\_0}}{t\_0} \end{array} \end{array} \]
                                    (FPCore (x c s)
                                     :precision binary64
                                     (let* ((t_0 (* (* c x) s))) (/ (/ 1.0 t_0) t_0)))
                                    double code(double x, double c, double s) {
                                    	double t_0 = (c * x) * s;
                                    	return (1.0 / t_0) / t_0;
                                    }
                                    
                                    real(8) function code(x, c, s)
                                        real(8), intent (in) :: x
                                        real(8), intent (in) :: c
                                        real(8), intent (in) :: s
                                        real(8) :: t_0
                                        t_0 = (c * x) * s
                                        code = (1.0d0 / t_0) / t_0
                                    end function
                                    
                                    public static double code(double x, double c, double s) {
                                    	double t_0 = (c * x) * s;
                                    	return (1.0 / t_0) / t_0;
                                    }
                                    
                                    def code(x, c, s):
                                    	t_0 = (c * x) * s
                                    	return (1.0 / t_0) / t_0
                                    
                                    function code(x, c, s)
                                    	t_0 = Float64(Float64(c * x) * s)
                                    	return Float64(Float64(1.0 / t_0) / t_0)
                                    end
                                    
                                    function tmp = code(x, c, s)
                                    	t_0 = (c * x) * s;
                                    	tmp = (1.0 / t_0) / t_0;
                                    end
                                    
                                    code[x_, c_, s_] := Block[{t$95$0 = N[(N[(c * x), $MachinePrecision] * s), $MachinePrecision]}, N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
                                    
                                    \begin{array}{l}
                                    
                                    \\
                                    \begin{array}{l}
                                    t_0 := \left(c \cdot x\right) \cdot s\\
                                    \frac{\frac{1}{t\_0}}{t\_0}
                                    \end{array}
                                    \end{array}
                                    
                                    Derivation
                                    1. Initial program 66.2%

                                      \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                    2. Add Preprocessing
                                    3. Taylor expanded in x around 0

                                      \[\leadsto \color{blue}{\frac{1}{{c}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)}} \]
                                    4. Step-by-step derivation
                                      1. associate-*r*N/A

                                        \[\leadsto \frac{1}{\color{blue}{\left({c}^{2} \cdot {s}^{2}\right) \cdot {x}^{2}}} \]
                                      2. associate-/l/N/A

                                        \[\leadsto \color{blue}{\frac{\frac{1}{{x}^{2}}}{{c}^{2} \cdot {s}^{2}}} \]
                                      3. unpow2N/A

                                        \[\leadsto \frac{\frac{1}{{x}^{2}}}{\color{blue}{\left(c \cdot c\right)} \cdot {s}^{2}} \]
                                      4. associate-*l*N/A

                                        \[\leadsto \frac{\frac{1}{{x}^{2}}}{\color{blue}{c \cdot \left(c \cdot {s}^{2}\right)}} \]
                                      5. associate-/r*N/A

                                        \[\leadsto \color{blue}{\frac{\frac{\frac{1}{{x}^{2}}}{c}}{c \cdot {s}^{2}}} \]
                                      6. lower-/.f64N/A

                                        \[\leadsto \color{blue}{\frac{\frac{\frac{1}{{x}^{2}}}{c}}{c \cdot {s}^{2}}} \]
                                      7. lower-/.f64N/A

                                        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{{x}^{2}}}{c}}}{c \cdot {s}^{2}} \]
                                      8. unpow2N/A

                                        \[\leadsto \frac{\frac{\frac{1}{\color{blue}{x \cdot x}}}{c}}{c \cdot {s}^{2}} \]
                                      9. associate-/r*N/A

                                        \[\leadsto \frac{\frac{\color{blue}{\frac{\frac{1}{x}}{x}}}{c}}{c \cdot {s}^{2}} \]
                                      10. lower-/.f64N/A

                                        \[\leadsto \frac{\frac{\color{blue}{\frac{\frac{1}{x}}{x}}}{c}}{c \cdot {s}^{2}} \]
                                      11. lower-/.f64N/A

                                        \[\leadsto \frac{\frac{\frac{\color{blue}{\frac{1}{x}}}{x}}{c}}{c \cdot {s}^{2}} \]
                                      12. unpow2N/A

                                        \[\leadsto \frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{c \cdot \color{blue}{\left(s \cdot s\right)}} \]
                                      13. associate-*r*N/A

                                        \[\leadsto \frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{\color{blue}{\left(c \cdot s\right) \cdot s}} \]
                                      14. *-commutativeN/A

                                        \[\leadsto \frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{\color{blue}{\left(s \cdot c\right)} \cdot s} \]
                                      15. lower-*.f64N/A

                                        \[\leadsto \frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{\color{blue}{\left(s \cdot c\right) \cdot s}} \]
                                      16. lower-*.f6468.2

                                        \[\leadsto \frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{\color{blue}{\left(s \cdot c\right)} \cdot s} \]
                                    5. Applied rewrites68.2%

                                      \[\leadsto \color{blue}{\frac{\frac{\frac{\frac{1}{x}}{x}}{c}}{\left(s \cdot c\right) \cdot s}} \]
                                    6. Step-by-step derivation
                                      1. Applied rewrites72.4%

                                        \[\leadsto \frac{\frac{-1}{x} \cdot \frac{-1}{\left(s \cdot c\right) \cdot s}}{\color{blue}{c \cdot x}} \]
                                      2. Step-by-step derivation
                                        1. Applied rewrites78.9%

                                          \[\leadsto \frac{\frac{1}{s \cdot \left(c \cdot x\right)}}{\color{blue}{s \cdot \left(c \cdot x\right)}} \]
                                        2. Final simplification78.9%

                                          \[\leadsto \frac{\frac{1}{\left(c \cdot x\right) \cdot s}}{\left(c \cdot x\right) \cdot s} \]
                                        3. Add Preprocessing

                                        Alternative 14: 78.8% accurate, 9.0× speedup?

                                        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(c \cdot x\right) \cdot s\\ \frac{1}{t\_0 \cdot t\_0} \end{array} \end{array} \]
                                        (FPCore (x c s)
                                         :precision binary64
                                         (let* ((t_0 (* (* c x) s))) (/ 1.0 (* t_0 t_0))))
                                        double code(double x, double c, double s) {
                                        	double t_0 = (c * x) * s;
                                        	return 1.0 / (t_0 * t_0);
                                        }
                                        
                                        real(8) function code(x, c, s)
                                            real(8), intent (in) :: x
                                            real(8), intent (in) :: c
                                            real(8), intent (in) :: s
                                            real(8) :: t_0
                                            t_0 = (c * x) * s
                                            code = 1.0d0 / (t_0 * t_0)
                                        end function
                                        
                                        public static double code(double x, double c, double s) {
                                        	double t_0 = (c * x) * s;
                                        	return 1.0 / (t_0 * t_0);
                                        }
                                        
                                        def code(x, c, s):
                                        	t_0 = (c * x) * s
                                        	return 1.0 / (t_0 * t_0)
                                        
                                        function code(x, c, s)
                                        	t_0 = Float64(Float64(c * x) * s)
                                        	return Float64(1.0 / Float64(t_0 * t_0))
                                        end
                                        
                                        function tmp = code(x, c, s)
                                        	t_0 = (c * x) * s;
                                        	tmp = 1.0 / (t_0 * t_0);
                                        end
                                        
                                        code[x_, c_, s_] := Block[{t$95$0 = N[(N[(c * x), $MachinePrecision] * s), $MachinePrecision]}, N[(1.0 / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        \begin{array}{l}
                                        t_0 := \left(c \cdot x\right) \cdot s\\
                                        \frac{1}{t\_0 \cdot t\_0}
                                        \end{array}
                                        \end{array}
                                        
                                        Derivation
                                        1. Initial program 66.2%

                                          \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                        2. Add Preprocessing
                                        3. Step-by-step derivation
                                          1. lift-*.f64N/A

                                            \[\leadsto \frac{\cos \color{blue}{\left(2 \cdot x\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                          2. *-commutativeN/A

                                            \[\leadsto \frac{\cos \color{blue}{\left(x \cdot 2\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                          3. lower-*.f6466.2

                                            \[\leadsto \frac{\cos \color{blue}{\left(x \cdot 2\right)}}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                          4. lift-*.f64N/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                                          5. *-commutativeN/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right) \cdot {c}^{2}}} \]
                                          6. lift-*.f64N/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \cdot {c}^{2}} \]
                                          7. *-commutativeN/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \cdot {c}^{2}} \]
                                          8. lift-*.f64N/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(x \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}\right) \cdot {c}^{2}} \]
                                          9. associate-*r*N/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot x\right) \cdot {s}^{2}\right)} \cdot {c}^{2}} \]
                                          10. associate-*l*N/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot x\right) \cdot \left({s}^{2} \cdot {c}^{2}\right)}} \]
                                          11. pow2N/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{x}^{2}} \cdot \left({s}^{2} \cdot {c}^{2}\right)} \]
                                          12. *-commutativeN/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}} \]
                                          13. lift-pow.f64N/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \left(\color{blue}{{c}^{2}} \cdot {s}^{2}\right)} \]
                                          14. lift-pow.f64N/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \left({c}^{2} \cdot \color{blue}{{s}^{2}}\right)} \]
                                          15. pow-prod-downN/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{x}^{2} \cdot \color{blue}{{\left(c \cdot s\right)}^{2}}} \]
                                          16. pow-prod-downN/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
                                          17. lower-pow.f64N/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
                                          18. lower-*.f64N/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}}^{2}} \]
                                          19. lower-*.f6498.1

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{{\left(x \cdot \color{blue}{\left(c \cdot s\right)}\right)}^{2}} \]
                                        4. Applied rewrites98.1%

                                          \[\leadsto \color{blue}{\frac{\cos \left(x \cdot 2\right)}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
                                        5. Step-by-step derivation
                                          1. lift-pow.f64N/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}} \]
                                          2. unpow2N/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)}} \]
                                          3. lower-*.f6498.1

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)}} \]
                                          4. lift-*.f64N/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(x \cdot \left(c \cdot s\right)\right)} \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                          5. lift-*.f64N/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(x \cdot \color{blue}{\left(c \cdot s\right)}\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                          6. associate-*r*N/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(x \cdot c\right) \cdot s\right)} \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                          7. *-commutativeN/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\color{blue}{\left(c \cdot x\right)} \cdot s\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                          8. lower-*.f64N/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right)} \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                          9. lower-*.f6496.4

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\color{blue}{\left(c \cdot x\right)} \cdot s\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)} \]
                                          10. lift-*.f64N/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}} \]
                                          11. lift-*.f64N/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(x \cdot \color{blue}{\left(c \cdot s\right)}\right)} \]
                                          12. associate-*r*N/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \color{blue}{\left(\left(x \cdot c\right) \cdot s\right)}} \]
                                          13. *-commutativeN/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\color{blue}{\left(c \cdot x\right)} \cdot s\right)} \]
                                          14. lower-*.f64N/A

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \color{blue}{\left(\left(c \cdot x\right) \cdot s\right)}} \]
                                          15. lower-*.f6497.8

                                            \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\color{blue}{\left(c \cdot x\right)} \cdot s\right)} \]
                                        6. Applied rewrites97.8%

                                          \[\leadsto \frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)}} \]
                                        7. Taylor expanded in x around 0

                                          \[\leadsto \frac{\color{blue}{1}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                        8. Step-by-step derivation
                                          1. Applied rewrites78.9%

                                            \[\leadsto \frac{\color{blue}{1}}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)} \]
                                          2. Add Preprocessing

                                          Alternative 15: 75.1% accurate, 9.0× speedup?

                                          \[\begin{array}{l} \\ \frac{1}{\left(\left(s \cdot c\right) \cdot \left(c \cdot x\right)\right) \cdot \left(s \cdot x\right)} \end{array} \]
                                          (FPCore (x c s) :precision binary64 (/ 1.0 (* (* (* s c) (* c x)) (* s x))))
                                          double code(double x, double c, double s) {
                                          	return 1.0 / (((s * c) * (c * x)) * (s * x));
                                          }
                                          
                                          real(8) function code(x, c, s)
                                              real(8), intent (in) :: x
                                              real(8), intent (in) :: c
                                              real(8), intent (in) :: s
                                              code = 1.0d0 / (((s * c) * (c * x)) * (s * x))
                                          end function
                                          
                                          public static double code(double x, double c, double s) {
                                          	return 1.0 / (((s * c) * (c * x)) * (s * x));
                                          }
                                          
                                          def code(x, c, s):
                                          	return 1.0 / (((s * c) * (c * x)) * (s * x))
                                          
                                          function code(x, c, s)
                                          	return Float64(1.0 / Float64(Float64(Float64(s * c) * Float64(c * x)) * Float64(s * x)))
                                          end
                                          
                                          function tmp = code(x, c, s)
                                          	tmp = 1.0 / (((s * c) * (c * x)) * (s * x));
                                          end
                                          
                                          code[x_, c_, s_] := N[(1.0 / N[(N[(N[(s * c), $MachinePrecision] * N[(c * x), $MachinePrecision]), $MachinePrecision] * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          \frac{1}{\left(\left(s \cdot c\right) \cdot \left(c \cdot x\right)\right) \cdot \left(s \cdot x\right)}
                                          \end{array}
                                          
                                          Derivation
                                          1. Initial program 66.2%

                                            \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                          2. Add Preprocessing
                                          3. Step-by-step derivation
                                            1. lift-*.f64N/A

                                              \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                                            2. lift-*.f64N/A

                                              \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                                            3. *-commutativeN/A

                                              \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(x \cdot \left(x \cdot {s}^{2}\right)\right)}} \]
                                            4. associate-*r*N/A

                                              \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot x\right) \cdot \left(x \cdot {s}^{2}\right)}} \]
                                            5. lift-*.f64N/A

                                              \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}} \]
                                            6. *-commutativeN/A

                                              \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left({s}^{2} \cdot x\right)}} \]
                                            7. lift-pow.f64N/A

                                              \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \left(\color{blue}{{s}^{2}} \cdot x\right)} \]
                                            8. unpow2N/A

                                              \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \left(\color{blue}{\left(s \cdot s\right)} \cdot x\right)} \]
                                            9. associate-*l*N/A

                                              \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot x\right) \cdot \color{blue}{\left(s \cdot \left(s \cdot x\right)\right)}} \]
                                            10. associate-*r*N/A

                                              \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right) \cdot \left(s \cdot x\right)}} \]
                                            11. lower-*.f64N/A

                                              \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right) \cdot \left(s \cdot x\right)}} \]
                                            12. lower-*.f64N/A

                                              \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot s\right)} \cdot \left(s \cdot x\right)} \]
                                            13. *-commutativeN/A

                                              \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(x \cdot {c}^{2}\right)} \cdot s\right) \cdot \left(s \cdot x\right)} \]
                                            14. lower-*.f64N/A

                                              \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(x \cdot {c}^{2}\right)} \cdot s\right) \cdot \left(s \cdot x\right)} \]
                                            15. lift-pow.f64N/A

                                              \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{{c}^{2}}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
                                            16. unpow2N/A

                                              \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
                                            17. lower-*.f64N/A

                                              \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot s\right) \cdot \left(s \cdot x\right)} \]
                                            18. *-commutativeN/A

                                              \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \color{blue}{\left(x \cdot s\right)}} \]
                                            19. lower-*.f6479.4

                                              \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \color{blue}{\left(x \cdot s\right)}} \]
                                          4. Applied rewrites79.4%

                                            \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)}} \]
                                          5. Taylor expanded in x around 0

                                            \[\leadsto \frac{\color{blue}{1}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
                                          6. Step-by-step derivation
                                            1. Applied rewrites66.2%

                                              \[\leadsto \frac{\color{blue}{1}}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
                                            2. Step-by-step derivation
                                              1. lift-*.f64N/A

                                                \[\leadsto \frac{1}{\color{blue}{\left(\left(x \cdot \left(c \cdot c\right)\right) \cdot s\right)} \cdot \left(x \cdot s\right)} \]
                                              2. lift-*.f64N/A

                                                \[\leadsto \frac{1}{\left(\color{blue}{\left(x \cdot \left(c \cdot c\right)\right)} \cdot s\right) \cdot \left(x \cdot s\right)} \]
                                              3. lift-*.f64N/A

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

                                                \[\leadsto \frac{1}{\left(\color{blue}{\left(\left(x \cdot c\right) \cdot c\right)} \cdot s\right) \cdot \left(x \cdot s\right)} \]
                                              5. *-commutativeN/A

                                                \[\leadsto \frac{1}{\left(\left(\color{blue}{\left(c \cdot x\right)} \cdot c\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
                                              6. lift-*.f64N/A

                                                \[\leadsto \frac{1}{\left(\left(\color{blue}{\left(c \cdot x\right)} \cdot c\right) \cdot s\right) \cdot \left(x \cdot s\right)} \]
                                              7. associate-*l*N/A

                                                \[\leadsto \frac{1}{\color{blue}{\left(\left(c \cdot x\right) \cdot \left(c \cdot s\right)\right)} \cdot \left(x \cdot s\right)} \]
                                              8. *-commutativeN/A

                                                \[\leadsto \frac{1}{\left(\left(c \cdot x\right) \cdot \color{blue}{\left(s \cdot c\right)}\right) \cdot \left(x \cdot s\right)} \]
                                              9. lift-*.f64N/A

                                                \[\leadsto \frac{1}{\left(\left(c \cdot x\right) \cdot \color{blue}{\left(s \cdot c\right)}\right) \cdot \left(x \cdot s\right)} \]
                                              10. *-commutativeN/A

                                                \[\leadsto \frac{1}{\color{blue}{\left(\left(s \cdot c\right) \cdot \left(c \cdot x\right)\right)} \cdot \left(x \cdot s\right)} \]
                                              11. lower-*.f6475.7

                                                \[\leadsto \frac{1}{\color{blue}{\left(\left(s \cdot c\right) \cdot \left(c \cdot x\right)\right)} \cdot \left(x \cdot s\right)} \]
                                            3. Applied rewrites75.7%

                                              \[\leadsto \frac{1}{\color{blue}{\left(\left(s \cdot c\right) \cdot \left(c \cdot x\right)\right)} \cdot \left(x \cdot s\right)} \]
                                            4. Final simplification75.7%

                                              \[\leadsto \frac{1}{\left(\left(s \cdot c\right) \cdot \left(c \cdot x\right)\right) \cdot \left(s \cdot x\right)} \]
                                            5. Add Preprocessing

                                            Alternative 16: 70.4% accurate, 9.0× speedup?

                                            \[\begin{array}{l} \\ \frac{1}{\left(\left(\left(\left(c \cdot x\right) \cdot c\right) \cdot x\right) \cdot s\right) \cdot s} \end{array} \]
                                            (FPCore (x c s) :precision binary64 (/ 1.0 (* (* (* (* (* c x) c) x) s) s)))
                                            double code(double x, double c, double s) {
                                            	return 1.0 / (((((c * x) * c) * x) * s) * s);
                                            }
                                            
                                            real(8) function code(x, c, s)
                                                real(8), intent (in) :: x
                                                real(8), intent (in) :: c
                                                real(8), intent (in) :: s
                                                code = 1.0d0 / (((((c * x) * c) * x) * s) * s)
                                            end function
                                            
                                            public static double code(double x, double c, double s) {
                                            	return 1.0 / (((((c * x) * c) * x) * s) * s);
                                            }
                                            
                                            def code(x, c, s):
                                            	return 1.0 / (((((c * x) * c) * x) * s) * s)
                                            
                                            function code(x, c, s)
                                            	return Float64(1.0 / Float64(Float64(Float64(Float64(Float64(c * x) * c) * x) * s) * s))
                                            end
                                            
                                            function tmp = code(x, c, s)
                                            	tmp = 1.0 / (((((c * x) * c) * x) * s) * s);
                                            end
                                            
                                            code[x_, c_, s_] := N[(1.0 / N[(N[(N[(N[(N[(c * x), $MachinePrecision] * c), $MachinePrecision] * x), $MachinePrecision] * s), $MachinePrecision] * s), $MachinePrecision]), $MachinePrecision]
                                            
                                            \begin{array}{l}
                                            
                                            \\
                                            \frac{1}{\left(\left(\left(\left(c \cdot x\right) \cdot c\right) \cdot x\right) \cdot s\right) \cdot s}
                                            \end{array}
                                            
                                            Derivation
                                            1. Initial program 66.2%

                                              \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                            2. Add Preprocessing
                                            3. Step-by-step derivation
                                              1. lift-*.f64N/A

                                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                                              2. lift-*.f64N/A

                                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                                              3. associate-*r*N/A

                                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot x}} \]
                                              4. lower-*.f64N/A

                                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot x}} \]
                                              5. lift-*.f64N/A

                                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}\right) \cdot x} \]
                                              6. *-commutativeN/A

                                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot \color{blue}{\left({s}^{2} \cdot x\right)}\right) \cdot x} \]
                                              7. associate-*r*N/A

                                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot {s}^{2}\right) \cdot x\right)} \cdot x} \]
                                              8. lower-*.f64N/A

                                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot {s}^{2}\right) \cdot x\right)} \cdot x} \]
                                              9. *-commutativeN/A

                                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left({s}^{2} \cdot {c}^{2}\right)} \cdot x\right) \cdot x} \]
                                              10. lift-pow.f64N/A

                                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(\color{blue}{{s}^{2}} \cdot {c}^{2}\right) \cdot x\right) \cdot x} \]
                                              11. lift-pow.f64N/A

                                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot \color{blue}{{c}^{2}}\right) \cdot x\right) \cdot x} \]
                                              12. pow-prod-downN/A

                                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{{\left(s \cdot c\right)}^{2}} \cdot x\right) \cdot x} \]
                                              13. lower-pow.f64N/A

                                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{{\left(s \cdot c\right)}^{2}} \cdot x\right) \cdot x} \]
                                              14. lower-*.f6484.5

                                                \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({\color{blue}{\left(s \cdot c\right)}}^{2} \cdot x\right) \cdot x} \]
                                            4. Applied rewrites84.5%

                                              \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({\left(s \cdot c\right)}^{2} \cdot x\right) \cdot x}} \]
                                            5. Taylor expanded in x around 0

                                              \[\leadsto \frac{\color{blue}{1}}{\left({\left(s \cdot c\right)}^{2} \cdot x\right) \cdot x} \]
                                            6. Step-by-step derivation
                                              1. Applied rewrites72.5%

                                                \[\leadsto \frac{\color{blue}{1}}{\left({\left(s \cdot c\right)}^{2} \cdot x\right) \cdot x} \]
                                              2. Taylor expanded in x around 0

                                                \[\leadsto \frac{1}{\color{blue}{{c}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)}} \]
                                              3. Step-by-step derivation
                                                1. *-commutativeN/A

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

                                                  \[\leadsto \frac{1}{\color{blue}{\left({c}^{2} \cdot {x}^{2}\right) \cdot {s}^{2}}} \]
                                                3. unpow2N/A

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

                                                  \[\leadsto \frac{1}{\color{blue}{\left(\left({c}^{2} \cdot {x}^{2}\right) \cdot s\right) \cdot s}} \]
                                                5. *-commutativeN/A

                                                  \[\leadsto \frac{1}{\color{blue}{\left(s \cdot \left({c}^{2} \cdot {x}^{2}\right)\right)} \cdot s} \]
                                                6. lower-*.f64N/A

                                                  \[\leadsto \frac{1}{\color{blue}{\left(s \cdot \left({c}^{2} \cdot {x}^{2}\right)\right) \cdot s}} \]
                                                7. *-commutativeN/A

                                                  \[\leadsto \frac{1}{\color{blue}{\left(\left({c}^{2} \cdot {x}^{2}\right) \cdot s\right)} \cdot s} \]
                                                8. lower-*.f64N/A

                                                  \[\leadsto \frac{1}{\color{blue}{\left(\left({c}^{2} \cdot {x}^{2}\right) \cdot s\right)} \cdot s} \]
                                                9. unpow2N/A

                                                  \[\leadsto \frac{1}{\left(\left({c}^{2} \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot s\right) \cdot s} \]
                                                10. associate-*r*N/A

                                                  \[\leadsto \frac{1}{\left(\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot x\right)} \cdot s\right) \cdot s} \]
                                                11. lower-*.f64N/A

                                                  \[\leadsto \frac{1}{\left(\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot x\right)} \cdot s\right) \cdot s} \]
                                                12. lower-*.f64N/A

                                                  \[\leadsto \frac{1}{\left(\left(\color{blue}{\left({c}^{2} \cdot x\right)} \cdot x\right) \cdot s\right) \cdot s} \]
                                                13. unpow2N/A

                                                  \[\leadsto \frac{1}{\left(\left(\left(\color{blue}{\left(c \cdot c\right)} \cdot x\right) \cdot x\right) \cdot s\right) \cdot s} \]
                                                14. lower-*.f6464.3

                                                  \[\leadsto \frac{1}{\left(\left(\left(\color{blue}{\left(c \cdot c\right)} \cdot x\right) \cdot x\right) \cdot s\right) \cdot s} \]
                                              4. Applied rewrites64.3%

                                                \[\leadsto \frac{1}{\color{blue}{\left(\left(\left(\left(c \cdot c\right) \cdot x\right) \cdot x\right) \cdot s\right) \cdot s}} \]
                                              5. Step-by-step derivation
                                                1. Applied rewrites73.3%

                                                  \[\leadsto \frac{1}{\left(\left(\left(\left(c \cdot x\right) \cdot c\right) \cdot x\right) \cdot s\right) \cdot s} \]
                                                2. Add Preprocessing

                                                Alternative 17: 65.4% accurate, 9.0× speedup?

                                                \[\begin{array}{l} \\ \frac{1}{\left(\left(\left(\left(x \cdot x\right) \cdot c\right) \cdot c\right) \cdot s\right) \cdot s} \end{array} \]
                                                (FPCore (x c s) :precision binary64 (/ 1.0 (* (* (* (* (* x x) c) c) s) s)))
                                                double code(double x, double c, double s) {
                                                	return 1.0 / (((((x * x) * c) * c) * s) * s);
                                                }
                                                
                                                real(8) function code(x, c, s)
                                                    real(8), intent (in) :: x
                                                    real(8), intent (in) :: c
                                                    real(8), intent (in) :: s
                                                    code = 1.0d0 / (((((x * x) * c) * c) * s) * s)
                                                end function
                                                
                                                public static double code(double x, double c, double s) {
                                                	return 1.0 / (((((x * x) * c) * c) * s) * s);
                                                }
                                                
                                                def code(x, c, s):
                                                	return 1.0 / (((((x * x) * c) * c) * s) * s)
                                                
                                                function code(x, c, s)
                                                	return Float64(1.0 / Float64(Float64(Float64(Float64(Float64(x * x) * c) * c) * s) * s))
                                                end
                                                
                                                function tmp = code(x, c, s)
                                                	tmp = 1.0 / (((((x * x) * c) * c) * s) * s);
                                                end
                                                
                                                code[x_, c_, s_] := N[(1.0 / N[(N[(N[(N[(N[(x * x), $MachinePrecision] * c), $MachinePrecision] * c), $MachinePrecision] * s), $MachinePrecision] * s), $MachinePrecision]), $MachinePrecision]
                                                
                                                \begin{array}{l}
                                                
                                                \\
                                                \frac{1}{\left(\left(\left(\left(x \cdot x\right) \cdot c\right) \cdot c\right) \cdot s\right) \cdot s}
                                                \end{array}
                                                
                                                Derivation
                                                1. Initial program 66.2%

                                                  \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
                                                2. Add Preprocessing
                                                3. Step-by-step derivation
                                                  1. lift-*.f64N/A

                                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                                                  2. lift-*.f64N/A

                                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
                                                  3. associate-*r*N/A

                                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot x}} \]
                                                  4. lower-*.f64N/A

                                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot x}} \]
                                                  5. lift-*.f64N/A

                                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot \color{blue}{\left(x \cdot {s}^{2}\right)}\right) \cdot x} \]
                                                  6. *-commutativeN/A

                                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({c}^{2} \cdot \color{blue}{\left({s}^{2} \cdot x\right)}\right) \cdot x} \]
                                                  7. associate-*r*N/A

                                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot {s}^{2}\right) \cdot x\right)} \cdot x} \]
                                                  8. lower-*.f64N/A

                                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left({c}^{2} \cdot {s}^{2}\right) \cdot x\right)} \cdot x} \]
                                                  9. *-commutativeN/A

                                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left({s}^{2} \cdot {c}^{2}\right)} \cdot x\right) \cdot x} \]
                                                  10. lift-pow.f64N/A

                                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(\color{blue}{{s}^{2}} \cdot {c}^{2}\right) \cdot x\right) \cdot x} \]
                                                  11. lift-pow.f64N/A

                                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot \color{blue}{{c}^{2}}\right) \cdot x\right) \cdot x} \]
                                                  12. pow-prod-downN/A

                                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{{\left(s \cdot c\right)}^{2}} \cdot x\right) \cdot x} \]
                                                  13. lower-pow.f64N/A

                                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{{\left(s \cdot c\right)}^{2}} \cdot x\right) \cdot x} \]
                                                  14. lower-*.f6484.5

                                                    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left({\color{blue}{\left(s \cdot c\right)}}^{2} \cdot x\right) \cdot x} \]
                                                4. Applied rewrites84.5%

                                                  \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({\left(s \cdot c\right)}^{2} \cdot x\right) \cdot x}} \]
                                                5. Taylor expanded in x around 0

                                                  \[\leadsto \frac{\color{blue}{1}}{\left({\left(s \cdot c\right)}^{2} \cdot x\right) \cdot x} \]
                                                6. Step-by-step derivation
                                                  1. Applied rewrites72.5%

                                                    \[\leadsto \frac{\color{blue}{1}}{\left({\left(s \cdot c\right)}^{2} \cdot x\right) \cdot x} \]
                                                  2. Taylor expanded in x around 0

                                                    \[\leadsto \frac{1}{\color{blue}{{c}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)}} \]
                                                  3. Step-by-step derivation
                                                    1. *-commutativeN/A

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

                                                      \[\leadsto \frac{1}{\color{blue}{\left({c}^{2} \cdot {x}^{2}\right) \cdot {s}^{2}}} \]
                                                    3. unpow2N/A

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

                                                      \[\leadsto \frac{1}{\color{blue}{\left(\left({c}^{2} \cdot {x}^{2}\right) \cdot s\right) \cdot s}} \]
                                                    5. *-commutativeN/A

                                                      \[\leadsto \frac{1}{\color{blue}{\left(s \cdot \left({c}^{2} \cdot {x}^{2}\right)\right)} \cdot s} \]
                                                    6. lower-*.f64N/A

                                                      \[\leadsto \frac{1}{\color{blue}{\left(s \cdot \left({c}^{2} \cdot {x}^{2}\right)\right) \cdot s}} \]
                                                    7. *-commutativeN/A

                                                      \[\leadsto \frac{1}{\color{blue}{\left(\left({c}^{2} \cdot {x}^{2}\right) \cdot s\right)} \cdot s} \]
                                                    8. lower-*.f64N/A

                                                      \[\leadsto \frac{1}{\color{blue}{\left(\left({c}^{2} \cdot {x}^{2}\right) \cdot s\right)} \cdot s} \]
                                                    9. unpow2N/A

                                                      \[\leadsto \frac{1}{\left(\left({c}^{2} \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot s\right) \cdot s} \]
                                                    10. associate-*r*N/A

                                                      \[\leadsto \frac{1}{\left(\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot x\right)} \cdot s\right) \cdot s} \]
                                                    11. lower-*.f64N/A

                                                      \[\leadsto \frac{1}{\left(\color{blue}{\left(\left({c}^{2} \cdot x\right) \cdot x\right)} \cdot s\right) \cdot s} \]
                                                    12. lower-*.f64N/A

                                                      \[\leadsto \frac{1}{\left(\left(\color{blue}{\left({c}^{2} \cdot x\right)} \cdot x\right) \cdot s\right) \cdot s} \]
                                                    13. unpow2N/A

                                                      \[\leadsto \frac{1}{\left(\left(\left(\color{blue}{\left(c \cdot c\right)} \cdot x\right) \cdot x\right) \cdot s\right) \cdot s} \]
                                                    14. lower-*.f6464.3

                                                      \[\leadsto \frac{1}{\left(\left(\left(\color{blue}{\left(c \cdot c\right)} \cdot x\right) \cdot x\right) \cdot s\right) \cdot s} \]
                                                  4. Applied rewrites64.3%

                                                    \[\leadsto \frac{1}{\color{blue}{\left(\left(\left(\left(c \cdot c\right) \cdot x\right) \cdot x\right) \cdot s\right) \cdot s}} \]
                                                  5. Step-by-step derivation
                                                    1. Applied rewrites69.0%

                                                      \[\leadsto \frac{1}{\left(\left(c \cdot \left(c \cdot \left(x \cdot x\right)\right)\right) \cdot s\right) \cdot s} \]
                                                    2. Final simplification69.0%

                                                      \[\leadsto \frac{1}{\left(\left(\left(\left(x \cdot x\right) \cdot c\right) \cdot c\right) \cdot s\right) \cdot s} \]
                                                    3. Add Preprocessing

                                                    Reproduce

                                                    ?
                                                    herbie shell --seed 2024249 
                                                    (FPCore (x c s)
                                                      :name "mixedcos"
                                                      :precision binary64
                                                      (/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))