mixedcos

Percentage Accurate: 67.2% → 97.4%
Time: 17.0s
Alternatives: 12
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 12 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 67.2% 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.4% accurate, 2.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 92.3% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := c \cdot \left(x \cdot s\right)\\ t_1 := \cos \left(x \cdot 2\right)\\ \mathbf{if}\;s \leq 6 \cdot 10^{+160}:\\ \;\;\;\;\frac{t_1}{\left(x \cdot c\right) \cdot \left(s \cdot t_0\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_1}{\left(x \cdot s\right) \cdot \left(c \cdot t_0\right)}\\ \end{array} \end{array} \]
(FPCore (x c s)
 :precision binary64
 (let* ((t_0 (* c (* x s))) (t_1 (cos (* x 2.0))))
   (if (<= s 6e+160)
     (/ t_1 (* (* x c) (* s t_0)))
     (/ t_1 (* (* x s) (* c t_0))))))
double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	double t_1 = cos((x * 2.0));
	double tmp;
	if (s <= 6e+160) {
		tmp = t_1 / ((x * c) * (s * t_0));
	} else {
		tmp = t_1 / ((x * s) * (c * t_0));
	}
	return tmp;
}
real(8) function code(x, c, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c
    real(8), intent (in) :: s
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = c * (x * s)
    t_1 = cos((x * 2.0d0))
    if (s <= 6d+160) then
        tmp = t_1 / ((x * c) * (s * t_0))
    else
        tmp = t_1 / ((x * s) * (c * t_0))
    end if
    code = tmp
end function
public static double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	double t_1 = Math.cos((x * 2.0));
	double tmp;
	if (s <= 6e+160) {
		tmp = t_1 / ((x * c) * (s * t_0));
	} else {
		tmp = t_1 / ((x * s) * (c * t_0));
	}
	return tmp;
}
def code(x, c, s):
	t_0 = c * (x * s)
	t_1 = math.cos((x * 2.0))
	tmp = 0
	if s <= 6e+160:
		tmp = t_1 / ((x * c) * (s * t_0))
	else:
		tmp = t_1 / ((x * s) * (c * t_0))
	return tmp
function code(x, c, s)
	t_0 = Float64(c * Float64(x * s))
	t_1 = cos(Float64(x * 2.0))
	tmp = 0.0
	if (s <= 6e+160)
		tmp = Float64(t_1 / Float64(Float64(x * c) * Float64(s * t_0)));
	else
		tmp = Float64(t_1 / Float64(Float64(x * s) * Float64(c * t_0)));
	end
	return tmp
end
function tmp_2 = code(x, c, s)
	t_0 = c * (x * s);
	t_1 = cos((x * 2.0));
	tmp = 0.0;
	if (s <= 6e+160)
		tmp = t_1 / ((x * c) * (s * t_0));
	else
		tmp = t_1 / ((x * s) * (c * t_0));
	end
	tmp_2 = tmp;
end
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[s, 6e+160], N[(t$95$1 / N[(N[(x * c), $MachinePrecision] * N[(s * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / N[(N[(x * s), $MachinePrecision] * N[(c * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if s < 5.9999999999999997e160

    1. Initial program 70.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.9999999999999997e160 < s

    1. Initial program 56.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 86.8% accurate, 2.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.3 \cdot 10^{-16}:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\

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


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

    1. Initial program 68.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. *-commutative68.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{{c}^{2}}}{\color{blue}{{x}^{2} \cdot {s}^{2}}} \]
      3. unpow254.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.2999999999999999e-16 < x

    1. Initial program 70.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. *-commutative70.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 97.2% accurate, 2.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 97.3% accurate, 2.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 93.1% accurate, 2.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 95.2% accurate, 2.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 79.0% accurate, 3.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{{c}^{2}}}{{s}^{2} \cdot {x}^{2}}} \]
    2. *-commutative53.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 76.1% accurate, 24.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 76.1% accurate, 24.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{{c}^{2}}}{{s}^{2} \cdot {x}^{2}}} \]
    2. *-commutative53.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{c \cdot \left(x \cdot s\right)} \cdot \frac{1}{\sqrt{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)}}} \]
    13. sqrt-prod37.4%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 78.9% accurate, 24.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{{c}^{2}}}{{s}^{2} \cdot {x}^{2}}} \]
    2. *-commutative53.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{c \cdot \left(x \cdot s\right)} \cdot \frac{1}{\sqrt{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)}}} \]
    13. sqrt-prod37.4%

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

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

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

    \[\leadsto \color{blue}{\frac{1}{c \cdot \left(x \cdot s\right)} \cdot \frac{1}{c \cdot \left(x \cdot s\right)}} \]
  9. Step-by-step derivation
    1. un-div-inv78.3%

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

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

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

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

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

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

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

Alternative 12: 78.9% accurate, 24.1× speedup?

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

\\
\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 68.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{{c}^{2}}}{{s}^{2} \cdot {x}^{2}}} \]
    2. *-commutative53.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{c \cdot \left(x \cdot s\right)} \cdot \frac{1}{\sqrt{\color{blue}{\left(\left(c \cdot x\right) \cdot s\right) \cdot \left(\left(c \cdot x\right) \cdot s\right)}}} \]
    13. sqrt-prod37.4%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-1 \cdot \color{blue}{-1}}{\left(-c \cdot \left(x \cdot s\right)\right) \cdot \left(-c \cdot \left(x \cdot s\right)\right)} \]
    10. metadata-eval78.3%

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

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

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

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

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

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

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

Reproduce

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