mixedcos

Percentage Accurate: 67.4% → 97.3%
Time: 12.4s
Alternatives: 10
Speedup: 24.1×

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 10 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: 67.4% 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.3% accurate, 1.5× speedup?

\[\begin{array}{l} \\ {\left(s \cdot \left(x \cdot c\right)\right)}^{-2} \cdot \cos \left(x \cdot 2\right) \end{array} \]
(FPCore (x c s)
 :precision binary64
 (* (pow (* s (* x c)) -2.0) (cos (* x 2.0))))
double code(double x, double c, double s) {
	return pow((s * (x * c)), -2.0) * cos((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 = ((s * (x * c)) ** (-2.0d0)) * cos((x * 2.0d0))
end function
public static double code(double x, double c, double s) {
	return Math.pow((s * (x * c)), -2.0) * Math.cos((x * 2.0));
}
def code(x, c, s):
	return math.pow((s * (x * c)), -2.0) * math.cos((x * 2.0))
function code(x, c, s)
	return Float64((Float64(s * Float64(x * c)) ^ -2.0) * cos(Float64(x * 2.0)))
end
function tmp = code(x, c, s)
	tmp = ((s * (x * c)) ^ -2.0) * cos((x * 2.0));
end
code[x_, c_, s_] := N[(N[Power[N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] * N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Step-by-step derivation
    1. *-commutative64.4%

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

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

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

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(c \cdot c\right)} \cdot \left(x \cdot x\right)\right) \cdot {s}^{2}} \]
    5. unswap-sqr76.7%

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

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(c \cdot x\right) \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot s\right)}} \]
    7. swap-sqr97.5%

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)}} \]
    8. *-commutative97.5%

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

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot \left(c \cdot x\right)\right)}} \]
    10. *-commutative97.5%

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \color{blue}{\left(x \cdot c\right)}\right) \cdot \left(s \cdot \left(c \cdot x\right)\right)} \]
    11. *-commutative97.5%

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

    \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \left(x \cdot c\right)\right) \cdot \left(s \cdot \left(x \cdot c\right)\right)}} \]
  4. Step-by-step derivation
    1. div-inv97.6%

      \[\leadsto \color{blue}{\cos \left(2 \cdot x\right) \cdot \frac{1}{\left(s \cdot \left(x \cdot c\right)\right) \cdot \left(s \cdot \left(x \cdot c\right)\right)}} \]
    2. *-commutative97.6%

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

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

      \[\leadsto \cos \left(x \cdot 2\right) \cdot \color{blue}{{\left(s \cdot \left(x \cdot c\right)\right)}^{\left(-2\right)}} \]
    5. metadata-eval97.8%

      \[\leadsto \cos \left(x \cdot 2\right) \cdot {\left(s \cdot \left(x \cdot c\right)\right)}^{\color{blue}{-2}} \]
  5. Applied egg-rr97.8%

    \[\leadsto \color{blue}{\cos \left(x \cdot 2\right) \cdot {\left(s \cdot \left(x \cdot c\right)\right)}^{-2}} \]
  6. Final simplification97.8%

    \[\leadsto {\left(s \cdot \left(x \cdot c\right)\right)}^{-2} \cdot \cos \left(x \cdot 2\right) \]

Alternative 2: 86.3% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\cos \left(x \cdot 2\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \left(c \cdot \left(s \cdot c\right)\right)\right)}\\ \mathbf{if}\;x \leq -1.9 \cdot 10^{-18}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{-10}:\\ \;\;\;\;\frac{1}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}}\\ \mathbf{elif}\;x \leq 5.8 \cdot 10^{+174}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{{\left(s \cdot \left(x \cdot c\right)\right)}^{2}}\\ \end{array} \end{array} \]
(FPCore (x c s)
 :precision binary64
 (let* ((t_0 (/ (cos (* x 2.0)) (* s (* (* x x) (* c (* s c)))))))
   (if (<= x -1.9e-18)
     t_0
     (if (<= x 1.05e-10)
       (/ 1.0 (pow (* c (* x s)) 2.0))
       (if (<= x 5.8e+174) t_0 (/ 1.0 (pow (* s (* x c)) 2.0)))))))
double code(double x, double c, double s) {
	double t_0 = cos((x * 2.0)) / (s * ((x * x) * (c * (s * c))));
	double tmp;
	if (x <= -1.9e-18) {
		tmp = t_0;
	} else if (x <= 1.05e-10) {
		tmp = 1.0 / pow((c * (x * s)), 2.0);
	} else if (x <= 5.8e+174) {
		tmp = t_0;
	} else {
		tmp = 1.0 / pow((s * (x * c)), 2.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 = cos((x * 2.0d0)) / (s * ((x * x) * (c * (s * c))))
    if (x <= (-1.9d-18)) then
        tmp = t_0
    else if (x <= 1.05d-10) then
        tmp = 1.0d0 / ((c * (x * s)) ** 2.0d0)
    else if (x <= 5.8d+174) then
        tmp = t_0
    else
        tmp = 1.0d0 / ((s * (x * c)) ** 2.0d0)
    end if
    code = tmp
end function
public static double code(double x, double c, double s) {
	double t_0 = Math.cos((x * 2.0)) / (s * ((x * x) * (c * (s * c))));
	double tmp;
	if (x <= -1.9e-18) {
		tmp = t_0;
	} else if (x <= 1.05e-10) {
		tmp = 1.0 / Math.pow((c * (x * s)), 2.0);
	} else if (x <= 5.8e+174) {
		tmp = t_0;
	} else {
		tmp = 1.0 / Math.pow((s * (x * c)), 2.0);
	}
	return tmp;
}
def code(x, c, s):
	t_0 = math.cos((x * 2.0)) / (s * ((x * x) * (c * (s * c))))
	tmp = 0
	if x <= -1.9e-18:
		tmp = t_0
	elif x <= 1.05e-10:
		tmp = 1.0 / math.pow((c * (x * s)), 2.0)
	elif x <= 5.8e+174:
		tmp = t_0
	else:
		tmp = 1.0 / math.pow((s * (x * c)), 2.0)
	return tmp
function code(x, c, s)
	t_0 = Float64(cos(Float64(x * 2.0)) / Float64(s * Float64(Float64(x * x) * Float64(c * Float64(s * c)))))
	tmp = 0.0
	if (x <= -1.9e-18)
		tmp = t_0;
	elseif (x <= 1.05e-10)
		tmp = Float64(1.0 / (Float64(c * Float64(x * s)) ^ 2.0));
	elseif (x <= 5.8e+174)
		tmp = t_0;
	else
		tmp = Float64(1.0 / (Float64(s * Float64(x * c)) ^ 2.0));
	end
	return tmp
end
function tmp_2 = code(x, c, s)
	t_0 = cos((x * 2.0)) / (s * ((x * x) * (c * (s * c))));
	tmp = 0.0;
	if (x <= -1.9e-18)
		tmp = t_0;
	elseif (x <= 1.05e-10)
		tmp = 1.0 / ((c * (x * s)) ^ 2.0);
	elseif (x <= 5.8e+174)
		tmp = t_0;
	else
		tmp = 1.0 / ((s * (x * c)) ^ 2.0);
	end
	tmp_2 = tmp;
end
code[x_, c_, s_] := Block[{t$95$0 = N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(s * N[(N[(x * x), $MachinePrecision] * N[(c * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.9e-18], t$95$0, If[LessEqual[x, 1.05e-10], N[(1.0 / N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.8e+174], t$95$0, N[(1.0 / N[Power[N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\cos \left(x \cdot 2\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \left(c \cdot \left(s \cdot c\right)\right)\right)}\\
\mathbf{if}\;x \leq -1.9 \cdot 10^{-18}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq 1.05 \cdot 10^{-10}:\\
\;\;\;\;\frac{1}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}}\\

\mathbf{elif}\;x \leq 5.8 \cdot 10^{+174}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.8999999999999999e-18 or 1.05e-10 < x < 5.7999999999999999e174

    1. Initial program 65.5%

      \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
    2. Step-by-step derivation
      1. *-commutative65.5%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \left(\color{blue}{\left(c \cdot c\right)} \cdot s\right)\right)} \]
      3. associate-*l*78.5%

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

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

    if -1.8999999999999999e-18 < x < 1.05e-10

    1. Initial program 67.6%

      \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
    2. Step-by-step derivation
      1. *-commutative67.6%

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

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

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

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

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

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(c \cdot x\right) \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot s\right)}} \]
      7. swap-sqr97.2%

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

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

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot \left(c \cdot x\right)\right)}} \]
      10. *-commutative97.2%

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \color{blue}{\left(x \cdot c\right)}\right) \cdot \left(s \cdot \left(c \cdot x\right)\right)} \]
      11. *-commutative97.2%

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\left({c}^{2} \cdot \left(s \cdot s\right)\right) \cdot \left(x \cdot x\right)}} \]
      4. *-commutative64.8%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{s \cdot s}}{{c}^{2} \cdot {x}^{2}}} \]
      10. associate-/r*67.0%

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{s}}{s}}}{{c}^{2} \cdot {x}^{2}} \]
      11. unpow267.0%

        \[\leadsto \frac{\frac{\frac{1}{s}}{s}}{{c}^{2} \cdot \color{blue}{\left(x \cdot x\right)}} \]
      12. *-commutative67.0%

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

        \[\leadsto \frac{\frac{\frac{1}{s}}{s}}{\left(x \cdot x\right) \cdot \color{blue}{\left(c \cdot c\right)}} \]
      14. swap-sqr81.4%

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

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

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

        \[\leadsto \color{blue}{\frac{1}{s \cdot \left({\left(x \cdot c\right)}^{2} \cdot s\right)}} \]
      18. *-commutative89.2%

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

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

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

    if 5.7999999999999999e174 < x

    1. Initial program 51.7%

      \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
    2. Step-by-step derivation
      1. *-commutative51.7%

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

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

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

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

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

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(c \cdot x\right) \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot s\right)}} \]
      7. swap-sqr97.3%

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

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

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot \left(c \cdot x\right)\right)}} \]
      10. *-commutative97.3%

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \color{blue}{\left(x \cdot c\right)}\right) \cdot \left(s \cdot \left(c \cdot x\right)\right)} \]
      11. *-commutative97.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\left(c \cdot c\right) \cdot \left(\left(s \cdot s\right) \cdot \left(x \cdot x\right)\right)}} \]
    7. Step-by-step derivation
      1. *-commutative40.3%

        \[\leadsto \frac{1}{\color{blue}{\left(\left(s \cdot s\right) \cdot \left(x \cdot x\right)\right) \cdot \left(c \cdot c\right)}} \]
      2. unswap-sqr57.6%

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

        \[\leadsto \frac{1}{\left(\color{blue}{\left(x \cdot s\right)} \cdot \left(s \cdot x\right)\right) \cdot \left(c \cdot c\right)} \]
      4. *-commutative57.6%

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

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

        \[\leadsto \frac{1}{{\left(x \cdot s\right)}^{2} \cdot \color{blue}{{c}^{2}}} \]
      7. pow-prod-down67.4%

        \[\leadsto \frac{1}{\color{blue}{{\left(\left(x \cdot s\right) \cdot c\right)}^{2}}} \]
      8. *-commutative67.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.9 \cdot 10^{-18}:\\ \;\;\;\;\frac{\cos \left(x \cdot 2\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \left(c \cdot \left(s \cdot c\right)\right)\right)}\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{-10}:\\ \;\;\;\;\frac{1}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}}\\ \mathbf{elif}\;x \leq 5.8 \cdot 10^{+174}:\\ \;\;\;\;\frac{\cos \left(x \cdot 2\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \left(c \cdot \left(s \cdot c\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{{\left(s \cdot \left(x \cdot c\right)\right)}^{2}}\\ \end{array} \]

Alternative 3: 87.3% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(x \cdot 2\right)\\ t_1 := \frac{t_0}{s \cdot \left(\left(x \cdot x\right) \cdot \left(c \cdot \left(s \cdot c\right)\right)\right)}\\ \mathbf{if}\;x \leq -2.7 \cdot 10^{-12}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{-11}:\\ \;\;\;\;\frac{1}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}}\\ \mathbf{elif}\;x \leq 2 \cdot 10^{+150}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0}{x \cdot \left(\left(c \cdot c\right) \cdot \left(s \cdot \left(x \cdot s\right)\right)\right)}\\ \end{array} \end{array} \]
(FPCore (x c s)
 :precision binary64
 (let* ((t_0 (cos (* x 2.0))) (t_1 (/ t_0 (* s (* (* x x) (* c (* s c)))))))
   (if (<= x -2.7e-12)
     t_1
     (if (<= x 9.5e-11)
       (/ 1.0 (pow (* c (* x s)) 2.0))
       (if (<= x 2e+150) t_1 (/ t_0 (* x (* (* c c) (* s (* x s))))))))))
double code(double x, double c, double s) {
	double t_0 = cos((x * 2.0));
	double t_1 = t_0 / (s * ((x * x) * (c * (s * c))));
	double tmp;
	if (x <= -2.7e-12) {
		tmp = t_1;
	} else if (x <= 9.5e-11) {
		tmp = 1.0 / pow((c * (x * s)), 2.0);
	} else if (x <= 2e+150) {
		tmp = t_1;
	} else {
		tmp = t_0 / (x * ((c * c) * (s * (x * s))));
	}
	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) :: t_1
    real(8) :: tmp
    t_0 = cos((x * 2.0d0))
    t_1 = t_0 / (s * ((x * x) * (c * (s * c))))
    if (x <= (-2.7d-12)) then
        tmp = t_1
    else if (x <= 9.5d-11) then
        tmp = 1.0d0 / ((c * (x * s)) ** 2.0d0)
    else if (x <= 2d+150) then
        tmp = t_1
    else
        tmp = t_0 / (x * ((c * c) * (s * (x * s))))
    end if
    code = tmp
end function
public static double code(double x, double c, double s) {
	double t_0 = Math.cos((x * 2.0));
	double t_1 = t_0 / (s * ((x * x) * (c * (s * c))));
	double tmp;
	if (x <= -2.7e-12) {
		tmp = t_1;
	} else if (x <= 9.5e-11) {
		tmp = 1.0 / Math.pow((c * (x * s)), 2.0);
	} else if (x <= 2e+150) {
		tmp = t_1;
	} else {
		tmp = t_0 / (x * ((c * c) * (s * (x * s))));
	}
	return tmp;
}
def code(x, c, s):
	t_0 = math.cos((x * 2.0))
	t_1 = t_0 / (s * ((x * x) * (c * (s * c))))
	tmp = 0
	if x <= -2.7e-12:
		tmp = t_1
	elif x <= 9.5e-11:
		tmp = 1.0 / math.pow((c * (x * s)), 2.0)
	elif x <= 2e+150:
		tmp = t_1
	else:
		tmp = t_0 / (x * ((c * c) * (s * (x * s))))
	return tmp
function code(x, c, s)
	t_0 = cos(Float64(x * 2.0))
	t_1 = Float64(t_0 / Float64(s * Float64(Float64(x * x) * Float64(c * Float64(s * c)))))
	tmp = 0.0
	if (x <= -2.7e-12)
		tmp = t_1;
	elseif (x <= 9.5e-11)
		tmp = Float64(1.0 / (Float64(c * Float64(x * s)) ^ 2.0));
	elseif (x <= 2e+150)
		tmp = t_1;
	else
		tmp = Float64(t_0 / Float64(x * Float64(Float64(c * c) * Float64(s * Float64(x * s)))));
	end
	return tmp
end
function tmp_2 = code(x, c, s)
	t_0 = cos((x * 2.0));
	t_1 = t_0 / (s * ((x * x) * (c * (s * c))));
	tmp = 0.0;
	if (x <= -2.7e-12)
		tmp = t_1;
	elseif (x <= 9.5e-11)
		tmp = 1.0 / ((c * (x * s)) ^ 2.0);
	elseif (x <= 2e+150)
		tmp = t_1;
	else
		tmp = t_0 / (x * ((c * c) * (s * (x * s))));
	end
	tmp_2 = tmp;
end
code[x_, c_, s_] := Block[{t$95$0 = N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(s * N[(N[(x * x), $MachinePrecision] * N[(c * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.7e-12], t$95$1, If[LessEqual[x, 9.5e-11], N[(1.0 / N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2e+150], t$95$1, N[(t$95$0 / N[(x * N[(N[(c * c), $MachinePrecision] * N[(s * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \left(x \cdot 2\right)\\
t_1 := \frac{t_0}{s \cdot \left(\left(x \cdot x\right) \cdot \left(c \cdot \left(s \cdot c\right)\right)\right)}\\
\mathbf{if}\;x \leq -2.7 \cdot 10^{-12}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 9.5 \cdot 10^{-11}:\\
\;\;\;\;\frac{1}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}}\\

\mathbf{elif}\;x \leq 2 \cdot 10^{+150}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.6999999999999998e-12 or 9.49999999999999951e-11 < x < 1.99999999999999996e150

    1. Initial program 65.1%

      \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
    2. Step-by-step derivation
      1. *-commutative65.1%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \left(\color{blue}{\left(c \cdot c\right)} \cdot s\right)\right)} \]
      3. associate-*l*79.2%

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

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

    if -2.6999999999999998e-12 < x < 9.49999999999999951e-11

    1. Initial program 67.6%

      \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
    2. Step-by-step derivation
      1. *-commutative67.6%

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

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

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

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

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

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(c \cdot x\right) \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot s\right)}} \]
      7. swap-sqr97.2%

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

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

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot \left(c \cdot x\right)\right)}} \]
      10. *-commutative97.2%

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \color{blue}{\left(x \cdot c\right)}\right) \cdot \left(s \cdot \left(c \cdot x\right)\right)} \]
      11. *-commutative97.2%

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\left({c}^{2} \cdot \left(s \cdot s\right)\right) \cdot \left(x \cdot x\right)}} \]
      4. *-commutative64.8%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{s \cdot s}}{{c}^{2} \cdot {x}^{2}}} \]
      10. associate-/r*67.0%

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{s}}{s}}}{{c}^{2} \cdot {x}^{2}} \]
      11. unpow267.0%

        \[\leadsto \frac{\frac{\frac{1}{s}}{s}}{{c}^{2} \cdot \color{blue}{\left(x \cdot x\right)}} \]
      12. *-commutative67.0%

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

        \[\leadsto \frac{\frac{\frac{1}{s}}{s}}{\left(x \cdot x\right) \cdot \color{blue}{\left(c \cdot c\right)}} \]
      14. swap-sqr81.4%

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

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

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

        \[\leadsto \color{blue}{\frac{1}{s \cdot \left({\left(x \cdot c\right)}^{2} \cdot s\right)}} \]
      18. *-commutative89.2%

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

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

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

    if 1.99999999999999996e150 < x

    1. Initial program 52.9%

      \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
    2. Step-by-step derivation
      1. associate-*r*60.1%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\color{blue}{\left(c \cdot c\right)} \cdot \left(x \cdot \left(s \cdot s\right)\right)\right)} \]
      5. associate-*r*79.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.7 \cdot 10^{-12}:\\ \;\;\;\;\frac{\cos \left(x \cdot 2\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \left(c \cdot \left(s \cdot c\right)\right)\right)}\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{-11}:\\ \;\;\;\;\frac{1}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}}\\ \mathbf{elif}\;x \leq 2 \cdot 10^{+150}:\\ \;\;\;\;\frac{\cos \left(x \cdot 2\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \left(c \cdot \left(s \cdot c\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(x \cdot 2\right)}{x \cdot \left(\left(c \cdot c\right) \cdot \left(s \cdot \left(x \cdot s\right)\right)\right)}\\ \end{array} \]

Alternative 4: 81.1% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -1.15 \cdot 10^{+84}:\\ \;\;\;\;\frac{1}{{\left(s \cdot \left(x \cdot c\right)\right)}^{2}}\\ \mathbf{elif}\;c \leq -2.75 \cdot 10^{-157}:\\ \;\;\;\;\frac{\cos \left(x \cdot 2\right)}{\left(c \cdot c\right) \cdot \left(x \cdot \left(s \cdot \left(x \cdot s\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}}\\ \end{array} \end{array} \]
(FPCore (x c s)
 :precision binary64
 (if (<= c -1.15e+84)
   (/ 1.0 (pow (* s (* x c)) 2.0))
   (if (<= c -2.75e-157)
     (/ (cos (* x 2.0)) (* (* c c) (* x (* s (* x s)))))
     (/ 1.0 (pow (* c (* x s)) 2.0)))))
double code(double x, double c, double s) {
	double tmp;
	if (c <= -1.15e+84) {
		tmp = 1.0 / pow((s * (x * c)), 2.0);
	} else if (c <= -2.75e-157) {
		tmp = cos((x * 2.0)) / ((c * c) * (x * (s * (x * s))));
	} else {
		tmp = 1.0 / pow((c * (x * s)), 2.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) :: tmp
    if (c <= (-1.15d+84)) then
        tmp = 1.0d0 / ((s * (x * c)) ** 2.0d0)
    else if (c <= (-2.75d-157)) then
        tmp = cos((x * 2.0d0)) / ((c * c) * (x * (s * (x * s))))
    else
        tmp = 1.0d0 / ((c * (x * s)) ** 2.0d0)
    end if
    code = tmp
end function
public static double code(double x, double c, double s) {
	double tmp;
	if (c <= -1.15e+84) {
		tmp = 1.0 / Math.pow((s * (x * c)), 2.0);
	} else if (c <= -2.75e-157) {
		tmp = Math.cos((x * 2.0)) / ((c * c) * (x * (s * (x * s))));
	} else {
		tmp = 1.0 / Math.pow((c * (x * s)), 2.0);
	}
	return tmp;
}
def code(x, c, s):
	tmp = 0
	if c <= -1.15e+84:
		tmp = 1.0 / math.pow((s * (x * c)), 2.0)
	elif c <= -2.75e-157:
		tmp = math.cos((x * 2.0)) / ((c * c) * (x * (s * (x * s))))
	else:
		tmp = 1.0 / math.pow((c * (x * s)), 2.0)
	return tmp
function code(x, c, s)
	tmp = 0.0
	if (c <= -1.15e+84)
		tmp = Float64(1.0 / (Float64(s * Float64(x * c)) ^ 2.0));
	elseif (c <= -2.75e-157)
		tmp = Float64(cos(Float64(x * 2.0)) / Float64(Float64(c * c) * Float64(x * Float64(s * Float64(x * s)))));
	else
		tmp = Float64(1.0 / (Float64(c * Float64(x * s)) ^ 2.0));
	end
	return tmp
end
function tmp_2 = code(x, c, s)
	tmp = 0.0;
	if (c <= -1.15e+84)
		tmp = 1.0 / ((s * (x * c)) ^ 2.0);
	elseif (c <= -2.75e-157)
		tmp = cos((x * 2.0)) / ((c * c) * (x * (s * (x * s))));
	else
		tmp = 1.0 / ((c * (x * s)) ^ 2.0);
	end
	tmp_2 = tmp;
end
code[x_, c_, s_] := If[LessEqual[c, -1.15e+84], N[(1.0 / N[Power[N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -2.75e-157], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(N[(c * c), $MachinePrecision] * N[(x * N[(s * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.15 \cdot 10^{+84}:\\
\;\;\;\;\frac{1}{{\left(s \cdot \left(x \cdot c\right)\right)}^{2}}\\

\mathbf{elif}\;c \leq -2.75 \cdot 10^{-157}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{\left(c \cdot c\right) \cdot \left(x \cdot \left(s \cdot \left(x \cdot s\right)\right)\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -1.1499999999999999e84

    1. Initial program 56.2%

      \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
    2. Step-by-step derivation
      1. *-commutative56.2%

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

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

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

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(c \cdot c\right)} \cdot \left(x \cdot x\right)\right) \cdot {s}^{2}} \]
      5. unswap-sqr78.5%

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

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(c \cdot x\right) \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot s\right)}} \]
      7. swap-sqr96.4%

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)}} \]
      8. *-commutative96.4%

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

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot \left(c \cdot x\right)\right)}} \]
      10. *-commutative96.4%

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \color{blue}{\left(x \cdot c\right)}\right) \cdot \left(s \cdot \left(c \cdot x\right)\right)} \]
      11. *-commutative96.4%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\left(c \cdot c\right) \cdot \left(\left(s \cdot s\right) \cdot \left(x \cdot x\right)\right)}} \]
    7. Step-by-step derivation
      1. *-commutative55.9%

        \[\leadsto \frac{1}{\color{blue}{\left(\left(s \cdot s\right) \cdot \left(x \cdot x\right)\right) \cdot \left(c \cdot c\right)}} \]
      2. unswap-sqr67.7%

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

        \[\leadsto \frac{1}{\left(\color{blue}{\left(x \cdot s\right)} \cdot \left(s \cdot x\right)\right) \cdot \left(c \cdot c\right)} \]
      4. *-commutative67.7%

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

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

        \[\leadsto \frac{1}{{\left(x \cdot s\right)}^{2} \cdot \color{blue}{{c}^{2}}} \]
      7. pow-prod-down93.1%

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

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

        \[\leadsto \frac{1}{{\color{blue}{\left(s \cdot \left(x \cdot c\right)\right)}}^{2}} \]
    8. Applied egg-rr94.2%

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

    if -1.1499999999999999e84 < c < -2.7499999999999999e-157

    1. Initial program 75.3%

      \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
    2. Step-by-step derivation
      1. unpow275.3%

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

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

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

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

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

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

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

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

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

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

    if -2.7499999999999999e-157 < c

    1. Initial program 63.7%

      \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
    2. Step-by-step derivation
      1. *-commutative63.7%

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

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

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

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

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

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(c \cdot x\right) \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot s\right)}} \]
      7. swap-sqr98.4%

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)}} \]
      8. *-commutative98.4%

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

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot \left(c \cdot x\right)\right)}} \]
      10. *-commutative98.4%

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \color{blue}{\left(x \cdot c\right)}\right) \cdot \left(s \cdot \left(c \cdot x\right)\right)} \]
      11. *-commutative98.4%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{s \cdot s}}{{c}^{2} \cdot {x}^{2}}} \]
      10. associate-/r*53.0%

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{s}}{s}}}{{c}^{2} \cdot {x}^{2}} \]
      11. unpow253.0%

        \[\leadsto \frac{\frac{\frac{1}{s}}{s}}{{c}^{2} \cdot \color{blue}{\left(x \cdot x\right)}} \]
      12. *-commutative53.0%

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

        \[\leadsto \frac{\frac{\frac{1}{s}}{s}}{\left(x \cdot x\right) \cdot \color{blue}{\left(c \cdot c\right)}} \]
      14. swap-sqr62.8%

        \[\leadsto \frac{\frac{\frac{1}{s}}{s}}{\color{blue}{\left(x \cdot c\right) \cdot \left(x \cdot c\right)}} \]
      15. unpow262.8%

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

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

        \[\leadsto \color{blue}{\frac{1}{s \cdot \left({\left(x \cdot c\right)}^{2} \cdot s\right)}} \]
      18. *-commutative70.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -1.15 \cdot 10^{+84}:\\ \;\;\;\;\frac{1}{{\left(s \cdot \left(x \cdot c\right)\right)}^{2}}\\ \mathbf{elif}\;c \leq -2.75 \cdot 10^{-157}:\\ \;\;\;\;\frac{\cos \left(x \cdot 2\right)}{\left(c \cdot c\right) \cdot \left(x \cdot \left(s \cdot \left(x \cdot s\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}}\\ \end{array} \]

Alternative 5: 97.3% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := s \cdot \left(x \cdot c\right)\\ \frac{\frac{1}{t_0}}{t_0} \cdot \cos \left(x \cdot 2\right) \end{array} \end{array} \]
(FPCore (x c s)
 :precision binary64
 (let* ((t_0 (* s (* x c)))) (* (/ (/ 1.0 t_0) t_0) (cos (* x 2.0)))))
double code(double x, double c, double s) {
	double t_0 = s * (x * c);
	return ((1.0 / t_0) / t_0) * cos((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
    real(8) :: t_0
    t_0 = s * (x * c)
    code = ((1.0d0 / t_0) / t_0) * cos((x * 2.0d0))
end function
public static double code(double x, double c, double s) {
	double t_0 = s * (x * c);
	return ((1.0 / t_0) / t_0) * Math.cos((x * 2.0));
}
def code(x, c, s):
	t_0 = s * (x * c)
	return ((1.0 / t_0) / t_0) * math.cos((x * 2.0))
function code(x, c, s)
	t_0 = Float64(s * Float64(x * c))
	return Float64(Float64(Float64(1.0 / t_0) / t_0) * cos(Float64(x * 2.0)))
end
function tmp = code(x, c, s)
	t_0 = s * (x * c);
	tmp = ((1.0 / t_0) / t_0) * cos((x * 2.0));
end
code[x_, c_, s_] := Block[{t$95$0 = N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision] * N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := s \cdot \left(x \cdot c\right)\\
\frac{\frac{1}{t_0}}{t_0} \cdot \cos \left(x \cdot 2\right)
\end{array}
\end{array}
Derivation
  1. Initial program 64.4%

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Step-by-step derivation
    1. *-commutative64.4%

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

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

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

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(c \cdot c\right)} \cdot \left(x \cdot x\right)\right) \cdot {s}^{2}} \]
    5. unswap-sqr76.7%

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

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(c \cdot x\right) \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot s\right)}} \]
    7. swap-sqr97.5%

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)}} \]
    8. *-commutative97.5%

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

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot \left(c \cdot x\right)\right)}} \]
    10. *-commutative97.5%

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \color{blue}{\left(x \cdot c\right)}\right) \cdot \left(s \cdot \left(c \cdot x\right)\right)} \]
    11. *-commutative97.5%

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

    \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \left(x \cdot c\right)\right) \cdot \left(s \cdot \left(x \cdot c\right)\right)}} \]
  4. Step-by-step derivation
    1. div-inv97.6%

      \[\leadsto \color{blue}{\cos \left(2 \cdot x\right) \cdot \frac{1}{\left(s \cdot \left(x \cdot c\right)\right) \cdot \left(s \cdot \left(x \cdot c\right)\right)}} \]
    2. *-commutative97.6%

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

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

      \[\leadsto \cos \left(x \cdot 2\right) \cdot \color{blue}{{\left(s \cdot \left(x \cdot c\right)\right)}^{\left(-2\right)}} \]
    5. metadata-eval97.8%

      \[\leadsto \cos \left(x \cdot 2\right) \cdot {\left(s \cdot \left(x \cdot c\right)\right)}^{\color{blue}{-2}} \]
  5. Applied egg-rr97.8%

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

      \[\leadsto \cos \left(x \cdot 2\right) \cdot {\left(s \cdot \left(x \cdot c\right)\right)}^{\color{blue}{\left(-1 + -1\right)}} \]
    2. pow-prod-up97.7%

      \[\leadsto \cos \left(x \cdot 2\right) \cdot \color{blue}{\left({\left(s \cdot \left(x \cdot c\right)\right)}^{-1} \cdot {\left(s \cdot \left(x \cdot c\right)\right)}^{-1}\right)} \]
    3. unpow-197.7%

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

      \[\leadsto \cos \left(x \cdot 2\right) \cdot \left(\frac{1}{s \cdot \left(x \cdot c\right)} \cdot \color{blue}{\frac{1}{s \cdot \left(x \cdot c\right)}}\right) \]
  7. Applied egg-rr97.7%

    \[\leadsto \cos \left(x \cdot 2\right) \cdot \color{blue}{\left(\frac{1}{s \cdot \left(x \cdot c\right)} \cdot \frac{1}{s \cdot \left(x \cdot c\right)}\right)} \]
  8. Step-by-step derivation
    1. un-div-inv97.8%

      \[\leadsto \cos \left(x \cdot 2\right) \cdot \color{blue}{\frac{\frac{1}{s \cdot \left(x \cdot c\right)}}{s \cdot \left(x \cdot c\right)}} \]
  9. Applied egg-rr97.8%

    \[\leadsto \cos \left(x \cdot 2\right) \cdot \color{blue}{\frac{\frac{1}{s \cdot \left(x \cdot c\right)}}{s \cdot \left(x \cdot c\right)}} \]
  10. Final simplification97.8%

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

Alternative 6: 94.8% accurate, 2.7× speedup?

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

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

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Step-by-step derivation
    1. *-commutative64.4%

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

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

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

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(c \cdot c\right)} \cdot \left(x \cdot x\right)\right) \cdot {s}^{2}} \]
    5. unswap-sqr76.7%

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

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(c \cdot x\right) \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot s\right)}} \]
    7. swap-sqr97.5%

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)}} \]
    8. *-commutative97.5%

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

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot \left(c \cdot x\right)\right)}} \]
    10. *-commutative97.5%

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \color{blue}{\left(x \cdot c\right)}\right) \cdot \left(s \cdot \left(c \cdot x\right)\right)} \]
    11. *-commutative97.5%

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

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

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

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

Alternative 7: 97.0% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := s \cdot \left(x \cdot c\right)\\ \frac{\cos \left(x \cdot 2\right)}{t_0 \cdot t_0} \end{array} \end{array} \]
(FPCore (x c s)
 :precision binary64
 (let* ((t_0 (* s (* x c)))) (/ (cos (* x 2.0)) (* t_0 t_0))))
double code(double x, double c, double s) {
	double t_0 = s * (x * c);
	return cos((x * 2.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 = s * (x * c)
    code = cos((x * 2.0d0)) / (t_0 * t_0)
end function
public static double code(double x, double c, double s) {
	double t_0 = s * (x * c);
	return Math.cos((x * 2.0)) / (t_0 * t_0);
}
def code(x, c, s):
	t_0 = s * (x * c)
	return math.cos((x * 2.0)) / (t_0 * t_0)
function code(x, c, s)
	t_0 = Float64(s * Float64(x * c))
	return Float64(cos(Float64(x * 2.0)) / Float64(t_0 * t_0))
end
function tmp = code(x, c, s)
	t_0 = s * (x * c);
	tmp = cos((x * 2.0)) / (t_0 * t_0);
end
code[x_, c_, s_] := Block[{t$95$0 = N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]}, N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := s \cdot \left(x \cdot c\right)\\
\frac{\cos \left(x \cdot 2\right)}{t_0 \cdot t_0}
\end{array}
\end{array}
Derivation
  1. Initial program 64.4%

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Step-by-step derivation
    1. *-commutative64.4%

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

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

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

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(c \cdot c\right)} \cdot \left(x \cdot x\right)\right) \cdot {s}^{2}} \]
    5. unswap-sqr76.7%

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

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(c \cdot x\right) \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot s\right)}} \]
    7. swap-sqr97.5%

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)}} \]
    8. *-commutative97.5%

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

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot \left(c \cdot x\right)\right)}} \]
    10. *-commutative97.5%

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \color{blue}{\left(x \cdot c\right)}\right) \cdot \left(s \cdot \left(c \cdot x\right)\right)} \]
    11. *-commutative97.5%

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

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

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

Alternative 8: 77.6% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \frac{1}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}} \end{array} \]
(FPCore (x c s) :precision binary64 (/ 1.0 (pow (* c (* x s)) 2.0)))
double code(double x, double c, double s) {
	return 1.0 / pow((c * (x * s)), 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 = 1.0d0 / ((c * (x * s)) ** 2.0d0)
end function
public static double code(double x, double c, double s) {
	return 1.0 / Math.pow((c * (x * s)), 2.0);
}
def code(x, c, s):
	return 1.0 / math.pow((c * (x * s)), 2.0)
function code(x, c, s)
	return Float64(1.0 / (Float64(c * Float64(x * s)) ^ 2.0))
end
function tmp = code(x, c, s)
	tmp = 1.0 / ((c * (x * s)) ^ 2.0);
end
code[x_, c_, s_] := N[(1.0 / N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Step-by-step derivation
    1. *-commutative64.4%

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

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

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

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(c \cdot c\right)} \cdot \left(x \cdot x\right)\right) \cdot {s}^{2}} \]
    5. unswap-sqr76.7%

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

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(c \cdot x\right) \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot s\right)}} \]
    7. swap-sqr97.5%

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)}} \]
    8. *-commutative97.5%

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

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot \left(c \cdot x\right)\right)}} \]
    10. *-commutative97.5%

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \color{blue}{\left(x \cdot c\right)}\right) \cdot \left(s \cdot \left(c \cdot x\right)\right)} \]
    11. *-commutative97.5%

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{\left({c}^{2} \cdot \left(s \cdot s\right)\right) \cdot \left(x \cdot x\right)}} \]
    4. *-commutative54.6%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{s \cdot s}}{{c}^{2} \cdot {x}^{2}}} \]
    10. associate-/r*55.7%

      \[\leadsto \frac{\color{blue}{\frac{\frac{1}{s}}{s}}}{{c}^{2} \cdot {x}^{2}} \]
    11. unpow255.7%

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

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

      \[\leadsto \frac{\frac{\frac{1}{s}}{s}}{\left(x \cdot x\right) \cdot \color{blue}{\left(c \cdot c\right)}} \]
    14. swap-sqr65.7%

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{{\left(c \cdot \left(s \cdot x\right)\right)}^{2}}} \]
  7. Final simplification78.4%

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

Alternative 9: 77.7% accurate, 20.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{c \cdot \left(x \cdot s\right)}\\ t_0 \cdot t_0 \end{array} \end{array} \]
(FPCore (x c s)
 :precision binary64
 (let* ((t_0 (/ 1.0 (* c (* x s))))) (* t_0 t_0)))
double code(double x, double c, double s) {
	double t_0 = 1.0 / (c * (x * s));
	return 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 = 1.0d0 / (c * (x * s))
    code = t_0 * t_0
end function
public static double code(double x, double c, double s) {
	double t_0 = 1.0 / (c * (x * s));
	return t_0 * t_0;
}
def code(x, c, s):
	t_0 = 1.0 / (c * (x * s))
	return t_0 * t_0
function code(x, c, s)
	t_0 = Float64(1.0 / Float64(c * Float64(x * s)))
	return Float64(t_0 * t_0)
end
function tmp = code(x, c, s)
	t_0 = 1.0 / (c * (x * s));
	tmp = t_0 * t_0;
end
code[x_, c_, s_] := Block[{t$95$0 = N[(1.0 / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * t$95$0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{c \cdot \left(x \cdot s\right)}\\
t_0 \cdot t_0
\end{array}
\end{array}
Derivation
  1. Initial program 64.4%

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Step-by-step derivation
    1. associate-/r*64.3%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{c \cdot c} \cdot \frac{1}{x \cdot \left(x \cdot \left(s \cdot s\right)\right)}} \]
    2. inv-pow57.2%

      \[\leadsto \color{blue}{{\left(c \cdot c\right)}^{-1}} \cdot \frac{1}{x \cdot \left(x \cdot \left(s \cdot s\right)\right)} \]
    3. inv-pow57.2%

      \[\leadsto {\left(c \cdot c\right)}^{-1} \cdot \color{blue}{{\left(x \cdot \left(x \cdot \left(s \cdot s\right)\right)\right)}^{-1}} \]
    4. associate-*r*54.9%

      \[\leadsto {\left(c \cdot c\right)}^{-1} \cdot {\color{blue}{\left(\left(x \cdot x\right) \cdot \left(s \cdot s\right)\right)}}^{-1} \]
    5. pow254.9%

      \[\leadsto {\left(c \cdot c\right)}^{-1} \cdot {\left(\color{blue}{{x}^{2}} \cdot \left(s \cdot s\right)\right)}^{-1} \]
    6. pow254.9%

      \[\leadsto {\left(c \cdot c\right)}^{-1} \cdot {\left({x}^{2} \cdot \color{blue}{{s}^{2}}\right)}^{-1} \]
    7. unpow-prod-down66.0%

      \[\leadsto {\left(c \cdot c\right)}^{-1} \cdot {\color{blue}{\left({\left(x \cdot s\right)}^{2}\right)}}^{-1} \]
    8. *-commutative66.0%

      \[\leadsto {\left(c \cdot c\right)}^{-1} \cdot {\left({\color{blue}{\left(s \cdot x\right)}}^{2}\right)}^{-1} \]
    9. unpow-prod-down66.1%

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

      \[\leadsto {\color{blue}{\left(c \cdot \left(c \cdot {\left(s \cdot x\right)}^{2}\right)\right)}}^{-1} \]
    11. inv-pow73.5%

      \[\leadsto \color{blue}{\frac{1}{c \cdot \left(c \cdot {\left(s \cdot x\right)}^{2}\right)}} \]
    12. add-sqr-sqrt73.4%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{c \cdot \left(c \cdot {\left(s \cdot x\right)}^{2}\right)}} \cdot \sqrt{\frac{1}{c \cdot \left(c \cdot {\left(s \cdot x\right)}^{2}\right)}}} \]
  8. Applied egg-rr78.3%

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

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

Alternative 10: 72.1% accurate, 24.1× speedup?

\[\begin{array}{l} \\ \frac{1}{c \cdot \left(c \cdot \left(\left(x \cdot s\right) \cdot \left(x \cdot s\right)\right)\right)} \end{array} \]
(FPCore (x c s) :precision binary64 (/ 1.0 (* c (* c (* (* x s) (* x s))))))
double code(double x, double c, double s) {
	return 1.0 / (c * (c * ((x * s) * (x * 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 * (c * ((x * s) * (x * s))))
end function
public static double code(double x, double c, double s) {
	return 1.0 / (c * (c * ((x * s) * (x * s))));
}
def code(x, c, s):
	return 1.0 / (c * (c * ((x * s) * (x * s))))
function code(x, c, s)
	return Float64(1.0 / Float64(c * Float64(c * Float64(Float64(x * s) * Float64(x * s)))))
end
function tmp = code(x, c, s)
	tmp = 1.0 / (c * (c * ((x * s) * (x * s))));
end
code[x_, c_, s_] := N[(1.0 / N[(c * N[(c * N[(N[(x * s), $MachinePrecision] * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Step-by-step derivation
    1. *-commutative64.4%

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

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

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

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(c \cdot c\right)} \cdot \left(x \cdot x\right)\right) \cdot {s}^{2}} \]
    5. unswap-sqr76.7%

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

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(c \cdot x\right) \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot s\right)}} \]
    7. swap-sqr97.5%

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)}} \]
    8. *-commutative97.5%

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

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot \left(c \cdot x\right)\right)}} \]
    10. *-commutative97.5%

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \color{blue}{\left(x \cdot c\right)}\right) \cdot \left(s \cdot \left(c \cdot x\right)\right)} \]
    11. *-commutative97.5%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{\left(\left(s \cdot s\right) \cdot \left(c \cdot c\right)\right) \cdot \left(x \cdot x\right)}} \]
    5. *-commutative54.6%

      \[\leadsto \frac{1}{\color{blue}{\left(\left(c \cdot c\right) \cdot \left(s \cdot s\right)\right)} \cdot \left(x \cdot x\right)} \]
    6. associate-*r*54.9%

      \[\leadsto \frac{1}{\color{blue}{\left(c \cdot c\right) \cdot \left(\left(s \cdot s\right) \cdot \left(x \cdot x\right)\right)}} \]
    7. swap-sqr66.1%

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

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

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

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

      \[\leadsto \frac{1}{c \cdot \left(c \cdot \color{blue}{\left(\left(s \cdot x\right) \cdot \left(s \cdot x\right)\right)}\right)} \]
  11. Applied egg-rr73.5%

    \[\leadsto \frac{1}{c \cdot \left(c \cdot \color{blue}{\left(\left(s \cdot x\right) \cdot \left(s \cdot x\right)\right)}\right)} \]
  12. Final simplification73.5%

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

Reproduce

?
herbie shell --seed 2023194 
(FPCore (x c s)
  :name "mixedcos"
  :precision binary64
  (/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))