mixedcos

Percentage Accurate: 66.8% → 97.0%
Time: 15.9s
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: 66.8% 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.0% accurate, 2.6× speedup?

\[\begin{array}{l} s = |s|\\ [c, s] = \mathsf{sort}([c, s])\\ \\ \begin{array}{l} t_0 := \cos \left(x \cdot 2\right)\\ \mathbf{if}\;x \leq 2.7 \cdot 10^{+60}:\\ \;\;\;\;\frac{\frac{\frac{t_0}{x \cdot s}}{c}}{c \cdot \left(x \cdot s\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{1}{x}}{s \cdot c}}{s \cdot c} \cdot \frac{t_0}{x}\\ \end{array} \end{array} \]
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
 :precision binary64
 (let* ((t_0 (cos (* x 2.0))))
   (if (<= x 2.7e+60)
     (/ (/ (/ t_0 (* x s)) c) (* c (* x s)))
     (* (/ (/ (/ 1.0 x) (* s c)) (* s c)) (/ t_0 x)))))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
	double t_0 = cos((x * 2.0));
	double tmp;
	if (x <= 2.7e+60) {
		tmp = ((t_0 / (x * s)) / c) / (c * (x * s));
	} else {
		tmp = (((1.0 / x) / (s * c)) / (s * c)) * (t_0 / x);
	}
	return tmp;
}
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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))
    if (x <= 2.7d+60) then
        tmp = ((t_0 / (x * s)) / c) / (c * (x * s))
    else
        tmp = (((1.0d0 / x) / (s * c)) / (s * c)) * (t_0 / x)
    end if
    code = tmp
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
	double t_0 = Math.cos((x * 2.0));
	double tmp;
	if (x <= 2.7e+60) {
		tmp = ((t_0 / (x * s)) / c) / (c * (x * s));
	} else {
		tmp = (((1.0 / x) / (s * c)) / (s * c)) * (t_0 / x);
	}
	return tmp;
}
s = abs(s)
[c, s] = sort([c, s])
def code(x, c, s):
	t_0 = math.cos((x * 2.0))
	tmp = 0
	if x <= 2.7e+60:
		tmp = ((t_0 / (x * s)) / c) / (c * (x * s))
	else:
		tmp = (((1.0 / x) / (s * c)) / (s * c)) * (t_0 / x)
	return tmp
s = abs(s)
c, s = sort([c, s])
function code(x, c, s)
	t_0 = cos(Float64(x * 2.0))
	tmp = 0.0
	if (x <= 2.7e+60)
		tmp = Float64(Float64(Float64(t_0 / Float64(x * s)) / c) / Float64(c * Float64(x * s)));
	else
		tmp = Float64(Float64(Float64(Float64(1.0 / x) / Float64(s * c)) / Float64(s * c)) * Float64(t_0 / x));
	end
	return tmp
end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
	t_0 = cos((x * 2.0));
	tmp = 0.0;
	if (x <= 2.7e+60)
		tmp = ((t_0 / (x * s)) / c) / (c * (x * s));
	else
		tmp = (((1.0 / x) / (s * c)) / (s * c)) * (t_0 / x);
	end
	tmp_2 = tmp;
end
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 2.7e+60], N[(N[(N[(t$95$0 / N[(x * s), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision] / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(1.0 / x), $MachinePrecision] / N[(s * c), $MachinePrecision]), $MachinePrecision] / N[(s * c), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := \cos \left(x \cdot 2\right)\\
\mathbf{if}\;x \leq 2.7 \cdot 10^{+60}:\\
\;\;\;\;\frac{\frac{\frac{t_0}{x \cdot s}}{c}}{c \cdot \left(x \cdot s\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{x}}{s \cdot c}}{s \cdot c} \cdot \frac{t_0}{x}\\


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

    1. Initial program 72.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. *-un-lft-identity72.5%

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\left(\sqrt{c} \cdot \sqrt{c}\right)} \cdot \sqrt{\left(x \cdot {s}^{2}\right) \cdot x}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
      7. add-sqr-sqrt51.2%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{c \cdot \sqrt{{\left(x \cdot s\right)}^{2}}} \cdot \frac{\cos \left(2 \cdot x\right)}{c \cdot \sqrt{{\left(x \cdot s\right)}^{2}}}} \]
    4. Step-by-step derivation
      1. associate-*l/89.9%

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

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

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

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

        \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{c \cdot \left|\color{blue}{s \cdot x}\right|}}{c \cdot \sqrt{{\left(x \cdot s\right)}^{2}}} \]
      6. unpow289.9%

        \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{c \cdot \left|s \cdot x\right|}}{c \cdot \sqrt{\color{blue}{\left(x \cdot s\right) \cdot \left(x \cdot s\right)}}} \]
      7. rem-sqrt-square98.7%

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

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

      \[\leadsto \color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{c \cdot \left|s \cdot x\right|}}{c \cdot \left|s \cdot x\right|}} \]
    6. Taylor expanded in x around inf 80.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos \left(x \cdot 2\right) \cdot {\left(\left(c \cdot s\right) \cdot x\right)}^{\color{blue}{\left(-2\right)}} \]
      2. pow-flip98.0%

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

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

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

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

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

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

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

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

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

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

    if 2.6999999999999999e60 < x

    1. Initial program 72.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. *-un-lft-identity72.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 97.2% accurate, 2.7× speedup?

\[\begin{array}{l} s = |s|\\ [c, s] = \mathsf{sort}([c, s])\\ \\ \frac{\cos \left(x \cdot 2\right)}{x \cdot \left(s \cdot c\right)} \cdot \frac{\frac{-1}{x}}{s \cdot \left(-c\right)} \end{array} \]
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
 :precision binary64
 (* (/ (cos (* x 2.0)) (* x (* s c))) (/ (/ -1.0 x) (* s (- c)))))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
	return (cos((x * 2.0)) / (x * (s * c))) * ((-1.0 / x) / (s * -c));
}
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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)) / (x * (s * c))) * (((-1.0d0) / x) / (s * -c))
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
	return (Math.cos((x * 2.0)) / (x * (s * c))) * ((-1.0 / x) / (s * -c));
}
s = abs(s)
[c, s] = sort([c, s])
def code(x, c, s):
	return (math.cos((x * 2.0)) / (x * (s * c))) * ((-1.0 / x) / (s * -c))
s = abs(s)
c, s = sort([c, s])
function code(x, c, s)
	return Float64(Float64(cos(Float64(x * 2.0)) / Float64(x * Float64(s * c))) * Float64(Float64(-1.0 / x) / Float64(s * Float64(-c))))
end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
	tmp = (cos((x * 2.0)) / (x * (s * c))) * ((-1.0 / x) / (s * -c));
end
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := N[(N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(x * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(-1.0 / x), $MachinePrecision] / N[(s * (-c)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{\cos \left(x \cdot 2\right)}{x \cdot \left(s \cdot c\right)} \cdot \frac{\frac{-1}{x}}{s \cdot \left(-c\right)}
\end{array}
Derivation
  1. Initial program 72.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. *-un-lft-identity72.5%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{c \cdot \sqrt{{\left(x \cdot s\right)}^{2}}} \cdot \frac{\cos \left(2 \cdot x\right)}{c \cdot \sqrt{{\left(x \cdot s\right)}^{2}}}} \]
  4. Step-by-step derivation
    1. associate-*l/89.5%

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

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

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

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

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

      \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{c \cdot \left|s \cdot x\right|}}{c \cdot \sqrt{\color{blue}{\left(x \cdot s\right) \cdot \left(x \cdot s\right)}}} \]
    7. rem-sqrt-square96.9%

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

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

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

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

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

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

      \[\leadsto \left(-\frac{\frac{\cos \color{blue}{\left(x \cdot 2\right)}}{c}}{\left|s \cdot x\right|}\right) \cdot \frac{1}{-c \cdot \left|s \cdot x\right|} \]
    5. add-sqr-sqrt55.3%

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

      \[\leadsto \left(-\frac{\frac{\cos \left(x \cdot 2\right)}{c}}{\color{blue}{\sqrt{s \cdot x} \cdot \sqrt{s \cdot x}}}\right) \cdot \frac{1}{-c \cdot \left|s \cdot x\right|} \]
    7. add-sqr-sqrt67.0%

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

      \[\leadsto \left(-\frac{\frac{\cos \left(x \cdot 2\right)}{c}}{s \cdot x}\right) \cdot \frac{1}{-\color{blue}{\left|s \cdot x\right| \cdot c}} \]
    9. distribute-rgt-neg-in67.0%

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

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

      \[\leadsto \color{blue}{\frac{1}{\left(s \cdot x\right) \cdot \left(-c\right)} \cdot \left(-\frac{\frac{\cos \left(x \cdot 2\right)}{c}}{s \cdot x}\right)} \]
    2. distribute-rgt-neg-out96.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{1}{x}}}{c \cdot \left(-s\right)} \cdot \left(-\frac{\cos \left(x \cdot 2\right)}{\left(c \cdot s\right) \cdot x}\right) \]
    5. distribute-rgt-neg-out98.3%

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

      \[\leadsto \frac{\frac{1}{x}}{-\color{blue}{s \cdot c}} \cdot \left(-\frac{\cos \left(x \cdot 2\right)}{\left(c \cdot s\right) \cdot x}\right) \]
    7. distribute-rgt-neg-in98.3%

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

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

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

Alternative 3: 97.2% accurate, 2.7× speedup?

\[\begin{array}{l} s = |s|\\ [c, s] = \mathsf{sort}([c, s])\\ \\ \frac{\cos \left(x \cdot 2\right)}{x \cdot \left(s \cdot c\right)} \cdot \frac{-1}{x \cdot \left(s \cdot \left(-c\right)\right)} \end{array} \]
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
 :precision binary64
 (* (/ (cos (* x 2.0)) (* x (* s c))) (/ -1.0 (* x (* s (- c))))))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
	return (cos((x * 2.0)) / (x * (s * c))) * (-1.0 / (x * (s * -c)));
}
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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)) / (x * (s * c))) * ((-1.0d0) / (x * (s * -c)))
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
	return (Math.cos((x * 2.0)) / (x * (s * c))) * (-1.0 / (x * (s * -c)));
}
s = abs(s)
[c, s] = sort([c, s])
def code(x, c, s):
	return (math.cos((x * 2.0)) / (x * (s * c))) * (-1.0 / (x * (s * -c)))
s = abs(s)
c, s = sort([c, s])
function code(x, c, s)
	return Float64(Float64(cos(Float64(x * 2.0)) / Float64(x * Float64(s * c))) * Float64(-1.0 / Float64(x * Float64(s * Float64(-c)))))
end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
	tmp = (cos((x * 2.0)) / (x * (s * c))) * (-1.0 / (x * (s * -c)));
end
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := N[(N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(x * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(x * N[(s * (-c)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{\cos \left(x \cdot 2\right)}{x \cdot \left(s \cdot c\right)} \cdot \frac{-1}{x \cdot \left(s \cdot \left(-c\right)\right)}
\end{array}
Derivation
  1. Initial program 72.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. *-un-lft-identity72.5%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{c \cdot \sqrt{{\left(x \cdot s\right)}^{2}}} \cdot \frac{\cos \left(2 \cdot x\right)}{c \cdot \sqrt{{\left(x \cdot s\right)}^{2}}}} \]
  4. Step-by-step derivation
    1. associate-*l/89.5%

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

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

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

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

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

      \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{c \cdot \left|s \cdot x\right|}}{c \cdot \sqrt{\color{blue}{\left(x \cdot s\right) \cdot \left(x \cdot s\right)}}} \]
    7. rem-sqrt-square96.9%

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

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

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

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

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

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

      \[\leadsto \left(-\frac{\frac{\cos \color{blue}{\left(x \cdot 2\right)}}{c}}{\left|s \cdot x\right|}\right) \cdot \frac{1}{-c \cdot \left|s \cdot x\right|} \]
    5. add-sqr-sqrt55.3%

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

      \[\leadsto \left(-\frac{\frac{\cos \left(x \cdot 2\right)}{c}}{\color{blue}{\sqrt{s \cdot x} \cdot \sqrt{s \cdot x}}}\right) \cdot \frac{1}{-c \cdot \left|s \cdot x\right|} \]
    7. add-sqr-sqrt67.0%

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

      \[\leadsto \left(-\frac{\frac{\cos \left(x \cdot 2\right)}{c}}{s \cdot x}\right) \cdot \frac{1}{-\color{blue}{\left|s \cdot x\right| \cdot c}} \]
    9. distribute-rgt-neg-in67.0%

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

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

      \[\leadsto \color{blue}{\frac{1}{\left(s \cdot x\right) \cdot \left(-c\right)} \cdot \left(-\frac{\frac{\cos \left(x \cdot 2\right)}{c}}{s \cdot x}\right)} \]
    2. distribute-rgt-neg-out96.9%

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

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

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

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

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

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

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

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

Alternative 4: 87.2% accurate, 2.7× speedup?

\[\begin{array}{l} s = |s|\\ [c, s] = \mathsf{sort}([c, s])\\ \\ \begin{array}{l} t_0 := c \cdot \left(x \cdot s\right)\\ \mathbf{if}\;x \leq 4 \cdot 10^{-152}:\\ \;\;\;\;\frac{\frac{1}{t_0}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\cos \left(x \cdot 2\right)}{s \cdot c}}{x \cdot t_0}\\ \end{array} \end{array} \]
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
 :precision binary64
 (let* ((t_0 (* c (* x s))))
   (if (<= x 4e-152)
     (/ (/ 1.0 t_0) t_0)
     (/ (/ (cos (* x 2.0)) (* s c)) (* x t_0)))))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	double tmp;
	if (x <= 4e-152) {
		tmp = (1.0 / t_0) / t_0;
	} else {
		tmp = (cos((x * 2.0)) / (s * c)) / (x * t_0);
	}
	return tmp;
}
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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 (x <= 4d-152) then
        tmp = (1.0d0 / t_0) / t_0
    else
        tmp = (cos((x * 2.0d0)) / (s * c)) / (x * t_0)
    end if
    code = tmp
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	double tmp;
	if (x <= 4e-152) {
		tmp = (1.0 / t_0) / t_0;
	} else {
		tmp = (Math.cos((x * 2.0)) / (s * c)) / (x * t_0);
	}
	return tmp;
}
s = abs(s)
[c, s] = sort([c, s])
def code(x, c, s):
	t_0 = c * (x * s)
	tmp = 0
	if x <= 4e-152:
		tmp = (1.0 / t_0) / t_0
	else:
		tmp = (math.cos((x * 2.0)) / (s * c)) / (x * t_0)
	return tmp
s = abs(s)
c, s = sort([c, s])
function code(x, c, s)
	t_0 = Float64(c * Float64(x * s))
	tmp = 0.0
	if (x <= 4e-152)
		tmp = Float64(Float64(1.0 / t_0) / t_0);
	else
		tmp = Float64(Float64(cos(Float64(x * 2.0)) / Float64(s * c)) / Float64(x * t_0));
	end
	return tmp
end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
	t_0 = c * (x * s);
	tmp = 0.0;
	if (x <= 4e-152)
		tmp = (1.0 / t_0) / t_0;
	else
		tmp = (cos((x * 2.0)) / (s * c)) / (x * t_0);
	end
	tmp_2 = tmp;
end
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 4e-152], N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(s * c), $MachinePrecision]), $MachinePrecision] / N[(x * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
\mathbf{if}\;x \leq 4 \cdot 10^{-152}:\\
\;\;\;\;\frac{\frac{1}{t_0}}{t_0}\\

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


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

    1. Initial program 70.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\sqrt{{\left(c \cdot \left|s \cdot x\right|\right)}^{2}} \cdot \sqrt{{\left(c \cdot \left|s \cdot x\right|\right)}^{2}}}} \]
      5. add-sqr-sqrt88.5%

        \[\leadsto \frac{1}{\color{blue}{{\left(c \cdot \left|s \cdot x\right|\right)}^{2}}} \]
      6. pow-flip88.5%

        \[\leadsto \color{blue}{{\left(c \cdot \left|s \cdot x\right|\right)}^{\left(-2\right)}} \]
      7. add-sqr-sqrt53.3%

        \[\leadsto {\left(c \cdot \left|\color{blue}{\sqrt{s \cdot x} \cdot \sqrt{s \cdot x}}\right|\right)}^{\left(-2\right)} \]
      8. fabs-sqr53.3%

        \[\leadsto {\left(c \cdot \color{blue}{\left(\sqrt{s \cdot x} \cdot \sqrt{s \cdot x}\right)}\right)}^{\left(-2\right)} \]
      9. add-sqr-sqrt88.5%

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

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

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

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

        \[\leadsto \color{blue}{{\left(c \cdot \left(s \cdot x\right)\right)}^{-1} \cdot {\left(c \cdot \left(s \cdot x\right)\right)}^{-1}} \]
      3. pow-prod-down88.5%

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

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

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

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

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

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

        \[\leadsto \frac{1}{-\left(c \cdot s\right) \cdot x} \cdot \color{blue}{\frac{1}{-\left(c \cdot s\right) \cdot x}} \]
      10. un-div-inv87.9%

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

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

    if 4.00000000000000026e-152 < x

    1. Initial program 75.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. *-un-lft-identity75.6%

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\left(\sqrt{c} \cdot \sqrt{c}\right)} \cdot \sqrt{\left(x \cdot {s}^{2}\right) \cdot x}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
      7. add-sqr-sqrt56.5%

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

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

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

        \[\leadsto \frac{1}{c \cdot \sqrt{\color{blue}{{x}^{2}} \cdot {s}^{2}}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}} \]
      11. pow-prod-down56.5%

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

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

      \[\leadsto \color{blue}{\frac{1}{c \cdot \sqrt{{\left(x \cdot s\right)}^{2}}} \cdot \frac{\cos \left(2 \cdot x\right)}{c \cdot \sqrt{{\left(x \cdot s\right)}^{2}}}} \]
    4. Step-by-step derivation
      1. associate-*l/88.2%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{c \cdot \left|s \cdot x\right|}}{c \cdot \left|s \cdot x\right|}} \]
    6. Taylor expanded in x around inf 83.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{\cos \left(x \cdot 2\right)}{\left(c \cdot s\right) \cdot x}}}{\left(c \cdot s\right) \cdot x} \]
      7. add-sqr-sqrt68.9%

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

        \[\leadsto \frac{\color{blue}{\sqrt{\frac{\cos \left(x \cdot 2\right)}{\left(c \cdot s\right) \cdot x} \cdot \frac{\cos \left(x \cdot 2\right)}{\left(c \cdot s\right) \cdot x}}}}{\left(c \cdot s\right) \cdot x} \]
      9. sqr-neg76.6%

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

        \[\leadsto \frac{\color{blue}{\sqrt{-\frac{\cos \left(x \cdot 2\right)}{\left(c \cdot s\right) \cdot x}} \cdot \sqrt{-\frac{\cos \left(x \cdot 2\right)}{\left(c \cdot s\right) \cdot x}}}}{\left(c \cdot s\right) \cdot x} \]
      11. add-sqr-sqrt38.0%

        \[\leadsto \frac{\color{blue}{-\frac{\cos \left(x \cdot 2\right)}{\left(c \cdot s\right) \cdot x}}}{\left(c \cdot s\right) \cdot x} \]
      12. remove-double-neg38.0%

        \[\leadsto \frac{-\frac{\cos \left(x \cdot 2\right)}{\left(c \cdot s\right) \cdot x}}{\color{blue}{-\left(-\left(c \cdot s\right) \cdot x\right)}} \]
      13. distribute-rgt-neg-out38.0%

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

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

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

Alternative 5: 97.2% accurate, 2.7× speedup?

\[\begin{array}{l} s = |s|\\ [c, s] = \mathsf{sort}([c, s])\\ \\ \frac{-\frac{\cos \left(x \cdot 2\right)}{x \cdot \left(s \cdot c\right)}}{x \cdot \left(s \cdot \left(-c\right)\right)} \end{array} \]
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
 :precision binary64
 (/ (- (/ (cos (* x 2.0)) (* x (* s c)))) (* x (* s (- c)))))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
	return -(cos((x * 2.0)) / (x * (s * c))) / (x * (s * -c));
}
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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)) / (x * (s * c))) / (x * (s * -c))
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
	return -(Math.cos((x * 2.0)) / (x * (s * c))) / (x * (s * -c));
}
s = abs(s)
[c, s] = sort([c, s])
def code(x, c, s):
	return -(math.cos((x * 2.0)) / (x * (s * c))) / (x * (s * -c))
s = abs(s)
c, s = sort([c, s])
function code(x, c, s)
	return Float64(Float64(-Float64(cos(Float64(x * 2.0)) / Float64(x * Float64(s * c)))) / Float64(x * Float64(s * Float64(-c))))
end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
	tmp = -(cos((x * 2.0)) / (x * (s * c))) / (x * (s * -c));
end
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := N[((-N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(x * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) / N[(x * N[(s * (-c)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{-\frac{\cos \left(x \cdot 2\right)}{x \cdot \left(s \cdot c\right)}}{x \cdot \left(s \cdot \left(-c\right)\right)}
\end{array}
Derivation
  1. Initial program 72.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. *-un-lft-identity72.5%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{c \cdot \sqrt{{\left(x \cdot s\right)}^{2}}} \cdot \frac{\cos \left(2 \cdot x\right)}{c \cdot \sqrt{{\left(x \cdot s\right)}^{2}}}} \]
  4. Step-by-step derivation
    1. associate-*l/89.5%

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

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

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

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

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

      \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{c \cdot \left|s \cdot x\right|}}{c \cdot \sqrt{\color{blue}{\left(x \cdot s\right) \cdot \left(x \cdot s\right)}}} \]
    7. rem-sqrt-square96.9%

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

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

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

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

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

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

      \[\leadsto \left(-\frac{\frac{\cos \color{blue}{\left(x \cdot 2\right)}}{c}}{\left|s \cdot x\right|}\right) \cdot \frac{1}{-c \cdot \left|s \cdot x\right|} \]
    5. add-sqr-sqrt55.3%

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

      \[\leadsto \left(-\frac{\frac{\cos \left(x \cdot 2\right)}{c}}{\color{blue}{\sqrt{s \cdot x} \cdot \sqrt{s \cdot x}}}\right) \cdot \frac{1}{-c \cdot \left|s \cdot x\right|} \]
    7. add-sqr-sqrt67.0%

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

      \[\leadsto \left(-\frac{\frac{\cos \left(x \cdot 2\right)}{c}}{s \cdot x}\right) \cdot \frac{1}{-\color{blue}{\left|s \cdot x\right| \cdot c}} \]
    9. distribute-rgt-neg-in67.0%

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

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

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

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

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

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

      \[\leadsto \frac{-\frac{\cos \left(x \cdot 2\right)}{\color{blue}{\left(c \cdot s\right) \cdot x}}}{\left(s \cdot x\right) \cdot \left(-c\right)} \]
    6. distribute-rgt-neg-out95.5%

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

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

      \[\leadsto \frac{-\frac{\cos \left(x \cdot 2\right)}{\left(c \cdot s\right) \cdot x}}{-\color{blue}{\left(c \cdot s\right) \cdot x}} \]
    9. distribute-rgt-neg-in98.2%

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

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

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

Alternative 6: 97.4% accurate, 2.7× speedup?

\[\begin{array}{l} s = |s|\\ [c, s] = \mathsf{sort}([c, s])\\ \\ \begin{array}{l} t_0 := c \cdot \left(x \cdot s\right)\\ \frac{\frac{\cos \left(x \cdot 2\right)}{t_0}}{t_0} \end{array} \end{array} \]
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
 :precision binary64
 (let* ((t_0 (* c (* x s)))) (/ (/ (cos (* x 2.0)) t_0) t_0)))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	return (cos((x * 2.0)) / t_0) / t_0;
}
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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 * 2.0d0)) / t_0) / t_0
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	return (Math.cos((x * 2.0)) / t_0) / t_0;
}
s = abs(s)
[c, s] = sort([c, s])
def code(x, c, s):
	t_0 = c * (x * s)
	return (math.cos((x * 2.0)) / t_0) / t_0
s = abs(s)
c, s = sort([c, s])
function code(x, c, s)
	t_0 = Float64(c * Float64(x * s))
	return Float64(Float64(cos(Float64(x * 2.0)) / t_0) / t_0)
end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
	t_0 = c * (x * s);
	tmp = (cos((x * 2.0)) / t_0) / t_0;
end
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
\frac{\frac{\cos \left(x \cdot 2\right)}{t_0}}{t_0}
\end{array}
\end{array}
Derivation
  1. Initial program 72.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. *-un-lft-identity72.5%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{c \cdot \sqrt{{\left(x \cdot s\right)}^{2}}} \cdot \frac{\cos \left(2 \cdot x\right)}{c \cdot \sqrt{{\left(x \cdot s\right)}^{2}}}} \]
  4. Step-by-step derivation
    1. associate-*l/89.5%

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

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

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

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

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

      \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{c \cdot \left|s \cdot x\right|}}{c \cdot \sqrt{\color{blue}{\left(x \cdot s\right) \cdot \left(x \cdot s\right)}}} \]
    7. rem-sqrt-square96.9%

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

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

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

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

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

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

      \[\leadsto \left(-\frac{\frac{\cos \color{blue}{\left(x \cdot 2\right)}}{c}}{\left|s \cdot x\right|}\right) \cdot \frac{1}{-c \cdot \left|s \cdot x\right|} \]
    5. add-sqr-sqrt55.3%

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

      \[\leadsto \left(-\frac{\frac{\cos \left(x \cdot 2\right)}{c}}{\color{blue}{\sqrt{s \cdot x} \cdot \sqrt{s \cdot x}}}\right) \cdot \frac{1}{-c \cdot \left|s \cdot x\right|} \]
    7. add-sqr-sqrt67.0%

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

      \[\leadsto \left(-\frac{\frac{\cos \left(x \cdot 2\right)}{c}}{s \cdot x}\right) \cdot \frac{1}{-\color{blue}{\left|s \cdot x\right| \cdot c}} \]
    9. distribute-rgt-neg-in67.0%

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

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

      \[\leadsto \color{blue}{\frac{1}{\left(s \cdot x\right) \cdot \left(-c\right)} \cdot \left(-\frac{\frac{\cos \left(x \cdot 2\right)}{c}}{s \cdot x}\right)} \]
    2. distribute-rgt-neg-out96.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{-\left(c \cdot s\right) \cdot x} \cdot \color{blue}{\left(\sqrt{\frac{\cos \left(x \cdot 2\right)}{\left(c \cdot s\right) \cdot x}} \cdot \sqrt{\frac{\cos \left(x \cdot 2\right)}{\left(c \cdot s\right) \cdot x}}\right)} \]
    5. add-sqr-sqrt33.7%

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

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

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

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

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

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

Alternative 7: 97.3% accurate, 2.7× speedup?

\[\begin{array}{l} s = |s|\\ [c, s] = \mathsf{sort}([c, s])\\ \\ \frac{\frac{\frac{\cos \left(x \cdot 2\right)}{x \cdot s}}{c}}{c \cdot \left(x \cdot s\right)} \end{array} \]
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
 :precision binary64
 (/ (/ (/ (cos (* x 2.0)) (* x s)) c) (* c (* x s))))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
	return ((cos((x * 2.0)) / (x * s)) / c) / (c * (x * s));
}
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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)) / (x * s)) / c) / (c * (x * s))
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
	return ((Math.cos((x * 2.0)) / (x * s)) / c) / (c * (x * s));
}
s = abs(s)
[c, s] = sort([c, s])
def code(x, c, s):
	return ((math.cos((x * 2.0)) / (x * s)) / c) / (c * (x * s))
s = abs(s)
c, s = sort([c, s])
function code(x, c, s)
	return Float64(Float64(Float64(cos(Float64(x * 2.0)) / Float64(x * s)) / c) / Float64(c * Float64(x * s)))
end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
	tmp = ((cos((x * 2.0)) / (x * s)) / c) / (c * (x * s));
end
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := N[(N[(N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(x * s), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision] / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{\frac{\frac{\cos \left(x \cdot 2\right)}{x \cdot s}}{c}}{c \cdot \left(x \cdot s\right)}
\end{array}
Derivation
  1. Initial program 72.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. *-un-lft-identity72.5%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{c \cdot \sqrt{{\left(x \cdot s\right)}^{2}}} \cdot \frac{\cos \left(2 \cdot x\right)}{c \cdot \sqrt{{\left(x \cdot s\right)}^{2}}}} \]
  4. Step-by-step derivation
    1. associate-*l/89.5%

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

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

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

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

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

      \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{c \cdot \left|s \cdot x\right|}}{c \cdot \sqrt{\color{blue}{\left(x \cdot s\right) \cdot \left(x \cdot s\right)}}} \]
    7. rem-sqrt-square96.9%

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

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

    \[\leadsto \color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{c \cdot \left|s \cdot x\right|}}{c \cdot \left|s \cdot x\right|}} \]
  6. Taylor expanded in x around inf 81.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 79.6% accurate, 3.0× speedup?

\[\begin{array}{l} s = |s|\\ [c, s] = \mathsf{sort}([c, s])\\ \\ {\left(c \cdot \left(x \cdot s\right)\right)}^{-2} \end{array} \]
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s) :precision binary64 (pow (* c (* x s)) -2.0))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
	return pow((c * (x * s)), -2.0);
}
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
real(8) function code(x, c, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c
    real(8), intent (in) :: s
    code = (c * (x * s)) ** (-2.0d0)
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
	return Math.pow((c * (x * s)), -2.0);
}
s = abs(s)
[c, s] = sort([c, s])
def code(x, c, s):
	return math.pow((c * (x * s)), -2.0)
s = abs(s)
c, s = sort([c, s])
function code(x, c, s)
	return Float64(c * Float64(x * s)) ^ -2.0
end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
	tmp = (c * (x * s)) ^ -2.0;
end
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}
\end{array}
Derivation
  1. Initial program 72.5%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{{\left(c \cdot \sqrt{\color{blue}{\left(x \cdot s\right) \cdot \left(x \cdot s\right)}}\right)}^{2}} \]
    11. rem-sqrt-square83.6%

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{\sqrt{{\left(c \cdot \left|s \cdot x\right|\right)}^{2}} \cdot \sqrt{{\left(c \cdot \left|s \cdot x\right|\right)}^{2}}}} \]
    5. add-sqr-sqrt83.6%

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

      \[\leadsto \color{blue}{{\left(c \cdot \left|s \cdot x\right|\right)}^{\left(-2\right)}} \]
    7. add-sqr-sqrt48.3%

      \[\leadsto {\left(c \cdot \left|\color{blue}{\sqrt{s \cdot x} \cdot \sqrt{s \cdot x}}\right|\right)}^{\left(-2\right)} \]
    8. fabs-sqr48.3%

      \[\leadsto {\left(c \cdot \color{blue}{\left(\sqrt{s \cdot x} \cdot \sqrt{s \cdot x}\right)}\right)}^{\left(-2\right)} \]
    9. add-sqr-sqrt83.9%

      \[\leadsto {\left(c \cdot \color{blue}{\left(s \cdot x\right)}\right)}^{\left(-2\right)} \]
    10. metadata-eval83.9%

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

    \[\leadsto \color{blue}{{\left(c \cdot \left(s \cdot x\right)\right)}^{-2}} \]
  7. Final simplification83.9%

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

Alternative 9: 79.4% accurate, 24.1× speedup?

\[\begin{array}{l} s = |s|\\ [c, s] = \mathsf{sort}([c, s])\\ \\ \begin{array}{l} t_0 := c \cdot \left(x \cdot s\right)\\ \frac{1}{t_0 \cdot t_0} \end{array} \end{array} \]
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
 :precision binary64
 (let* ((t_0 (* c (* x s)))) (/ 1.0 (* t_0 t_0))))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	return 1.0 / (t_0 * t_0);
}
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	return 1.0 / (t_0 * t_0);
}
s = abs(s)
[c, s] = sort([c, s])
def code(x, c, s):
	t_0 = c * (x * s)
	return 1.0 / (t_0 * t_0)
s = abs(s)
c, s = sort([c, s])
function code(x, c, s)
	t_0 = Float64(c * Float64(x * s))
	return Float64(1.0 / Float64(t_0 * t_0))
end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
	t_0 = c * (x * s);
	tmp = 1.0 / (t_0 * t_0);
end
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, N[(1.0 / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
\frac{1}{t_0 \cdot t_0}
\end{array}
\end{array}
Derivation
  1. Initial program 72.5%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{{\left(c \cdot \sqrt{\color{blue}{\left(x \cdot s\right) \cdot \left(x \cdot s\right)}}\right)}^{2}} \]
    11. rem-sqrt-square83.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{\left(c \cdot \left|s \cdot x\right|\right)} \cdot \sqrt{{\left(c \cdot \left|s \cdot x\right|\right)}^{2}}} \]
    8. add-sqr-sqrt34.8%

      \[\leadsto \frac{1}{\left(c \cdot \left|\color{blue}{\sqrt{s \cdot x} \cdot \sqrt{s \cdot x}}\right|\right) \cdot \sqrt{{\left(c \cdot \left|s \cdot x\right|\right)}^{2}}} \]
    9. fabs-sqr34.8%

      \[\leadsto \frac{1}{\left(c \cdot \color{blue}{\left(\sqrt{s \cdot x} \cdot \sqrt{s \cdot x}\right)}\right) \cdot \sqrt{{\left(c \cdot \left|s \cdot x\right|\right)}^{2}}} \]
    10. add-sqr-sqrt61.8%

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

      \[\leadsto \frac{1}{\left(c \cdot \left(s \cdot x\right)\right) \cdot \color{blue}{{\left(c \cdot \left|s \cdot x\right|\right)}^{\left(\frac{2}{2}\right)}}} \]
    12. metadata-eval62.5%

      \[\leadsto \frac{1}{\left(c \cdot \left(s \cdot x\right)\right) \cdot {\left(c \cdot \left|s \cdot x\right|\right)}^{\color{blue}{1}}} \]
    13. pow162.5%

      \[\leadsto \frac{1}{\left(c \cdot \left(s \cdot x\right)\right) \cdot \color{blue}{\left(c \cdot \left|s \cdot x\right|\right)}} \]
    14. add-sqr-sqrt42.4%

      \[\leadsto \frac{1}{\left(c \cdot \left(s \cdot x\right)\right) \cdot \left(c \cdot \left|\color{blue}{\sqrt{s \cdot x} \cdot \sqrt{s \cdot x}}\right|\right)} \]
    15. fabs-sqr42.4%

      \[\leadsto \frac{1}{\left(c \cdot \left(s \cdot x\right)\right) \cdot \left(c \cdot \color{blue}{\left(\sqrt{s \cdot x} \cdot \sqrt{s \cdot x}\right)}\right)} \]
    16. add-sqr-sqrt83.6%

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

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

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

Alternative 10: 79.6% accurate, 24.1× speedup?

\[\begin{array}{l} s = |s|\\ [c, s] = \mathsf{sort}([c, s])\\ \\ \begin{array}{l} t_0 := c \cdot \left(x \cdot s\right)\\ \frac{\frac{1}{t_0}}{t_0} \end{array} \end{array} \]
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
 :precision binary64
 (let* ((t_0 (* c (* x s)))) (/ (/ 1.0 t_0) t_0)))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	return (1.0 / t_0) / t_0;
}
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	return (1.0 / t_0) / t_0;
}
s = abs(s)
[c, s] = sort([c, s])
def code(x, c, s):
	t_0 = c * (x * s)
	return (1.0 / t_0) / t_0
s = abs(s)
c, s = sort([c, s])
function code(x, c, s)
	t_0 = Float64(c * Float64(x * s))
	return Float64(Float64(1.0 / t_0) / t_0)
end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
	t_0 = c * (x * s);
	tmp = (1.0 / t_0) / t_0;
end
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
\frac{\frac{1}{t_0}}{t_0}
\end{array}
\end{array}
Derivation
  1. Initial program 72.5%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{{\left(c \cdot \sqrt{\color{blue}{\left(x \cdot s\right) \cdot \left(x \cdot s\right)}}\right)}^{2}} \]
    11. rem-sqrt-square83.6%

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{\sqrt{{\left(c \cdot \left|s \cdot x\right|\right)}^{2}} \cdot \sqrt{{\left(c \cdot \left|s \cdot x\right|\right)}^{2}}}} \]
    5. add-sqr-sqrt83.6%

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

      \[\leadsto \color{blue}{{\left(c \cdot \left|s \cdot x\right|\right)}^{\left(-2\right)}} \]
    7. add-sqr-sqrt48.3%

      \[\leadsto {\left(c \cdot \left|\color{blue}{\sqrt{s \cdot x} \cdot \sqrt{s \cdot x}}\right|\right)}^{\left(-2\right)} \]
    8. fabs-sqr48.3%

      \[\leadsto {\left(c \cdot \color{blue}{\left(\sqrt{s \cdot x} \cdot \sqrt{s \cdot x}\right)}\right)}^{\left(-2\right)} \]
    9. add-sqr-sqrt83.9%

      \[\leadsto {\left(c \cdot \color{blue}{\left(s \cdot x\right)}\right)}^{\left(-2\right)} \]
    10. metadata-eval83.9%

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

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

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

      \[\leadsto \color{blue}{{\left(c \cdot \left(s \cdot x\right)\right)}^{-1} \cdot {\left(c \cdot \left(s \cdot x\right)\right)}^{-1}} \]
    3. pow-prod-down83.6%

      \[\leadsto \color{blue}{{\left(\left(c \cdot \left(s \cdot x\right)\right) \cdot \left(c \cdot \left(s \cdot x\right)\right)\right)}^{-1}} \]
    4. sqr-neg83.6%

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

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

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

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

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

      \[\leadsto \frac{1}{-\left(c \cdot s\right) \cdot x} \cdot \color{blue}{\frac{1}{-\left(c \cdot s\right) \cdot x}} \]
    10. un-div-inv83.9%

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

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

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

Reproduce

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