mixedcos

Percentage Accurate: 66.6% → 99.3%
Time: 16.0s
Alternatives: 10
Speedup: 24.1×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 66.6% 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: 99.3% accurate, 2.6× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ c_m = \left|c\right| \\ s_m = \left|s\right| \\ [x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\ \\ \begin{array}{l} \mathbf{if}\;x\_m \leq 3.8 \cdot 10^{-66}:\\ \;\;\;\;{\left(\frac{\frac{\frac{1}{x\_m}}{s\_m}}{c\_m}\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{\cos \left(x\_m \cdot 2\right)}{x\_m \cdot c\_m}}{s\_m}}{s\_m \cdot \left(x\_m \cdot c\_m\right)}\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
 :precision binary64
 (if (<= x_m 3.8e-66)
   (pow (/ (/ (/ 1.0 x_m) s_m) c_m) 2.0)
   (/ (/ (/ (cos (* x_m 2.0)) (* x_m c_m)) s_m) (* s_m (* x_m c_m)))))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
	double tmp;
	if (x_m <= 3.8e-66) {
		tmp = pow((((1.0 / x_m) / s_m) / c_m), 2.0);
	} else {
		tmp = ((cos((x_m * 2.0)) / (x_m * c_m)) / s_m) / (s_m * (x_m * c_m));
	}
	return tmp;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s_m
    real(8) :: tmp
    if (x_m <= 3.8d-66) then
        tmp = (((1.0d0 / x_m) / s_m) / c_m) ** 2.0d0
    else
        tmp = ((cos((x_m * 2.0d0)) / (x_m * c_m)) / s_m) / (s_m * (x_m * c_m))
    end if
    code = tmp
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
	double tmp;
	if (x_m <= 3.8e-66) {
		tmp = Math.pow((((1.0 / x_m) / s_m) / c_m), 2.0);
	} else {
		tmp = ((Math.cos((x_m * 2.0)) / (x_m * c_m)) / s_m) / (s_m * (x_m * c_m));
	}
	return tmp;
}
x_m = math.fabs(x)
c_m = math.fabs(c)
s_m = math.fabs(s)
[x_m, c_m, s_m] = sort([x_m, c_m, s_m])
def code(x_m, c_m, s_m):
	tmp = 0
	if x_m <= 3.8e-66:
		tmp = math.pow((((1.0 / x_m) / s_m) / c_m), 2.0)
	else:
		tmp = ((math.cos((x_m * 2.0)) / (x_m * c_m)) / s_m) / (s_m * (x_m * c_m))
	return tmp
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
x_m, c_m, s_m = sort([x_m, c_m, s_m])
function code(x_m, c_m, s_m)
	tmp = 0.0
	if (x_m <= 3.8e-66)
		tmp = Float64(Float64(Float64(1.0 / x_m) / s_m) / c_m) ^ 2.0;
	else
		tmp = Float64(Float64(Float64(cos(Float64(x_m * 2.0)) / Float64(x_m * c_m)) / s_m) / Float64(s_m * Float64(x_m * c_m)));
	end
	return tmp
end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp_2 = code(x_m, c_m, s_m)
	tmp = 0.0;
	if (x_m <= 3.8e-66)
		tmp = (((1.0 / x_m) / s_m) / c_m) ^ 2.0;
	else
		tmp = ((cos((x_m * 2.0)) / (x_m * c_m)) / s_m) / (s_m * (x_m * c_m));
	end
	tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := If[LessEqual[x$95$m, 3.8e-66], N[Power[N[(N[(N[(1.0 / x$95$m), $MachinePrecision] / s$95$m), $MachinePrecision] / c$95$m), $MachinePrecision], 2.0], $MachinePrecision], N[(N[(N[(N[Cos[N[(x$95$m * 2.0), $MachinePrecision]], $MachinePrecision] / N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision] / s$95$m), $MachinePrecision] / N[(s$95$m * N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 3.8 \cdot 10^{-66}:\\
\;\;\;\;{\left(\frac{\frac{\frac{1}{x\_m}}{s\_m}}{c\_m}\right)}^{2}\\

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


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

    1. Initial program 64.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. associate-/r*64.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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. associate-*l/96.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{c}}{x \cdot s} \cdot \color{blue}{\frac{\frac{1}{c \cdot s}}{x}} \]
      16. associate-/r*84.8%

        \[\leadsto \frac{\frac{1}{c}}{x \cdot s} \cdot \frac{\color{blue}{\frac{\frac{1}{c}}{s}}}{x} \]
      17. associate-/l/86.9%

        \[\leadsto \frac{\frac{1}{c}}{x \cdot s} \cdot \color{blue}{\frac{\frac{1}{c}}{x \cdot s}} \]
      18. unpow286.9%

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

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

    if 3.7999999999999998e-66 < x

    1. Initial program 66.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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. associate-*l/95.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.3% accurate, 2.6× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ c_m = \left|c\right| \\ s_m = \left|s\right| \\ [x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\ \\ \begin{array}{l} t_0 := s\_m \cdot \left(x\_m \cdot c\_m\right)\\ \mathbf{if}\;x\_m \leq 1.42 \cdot 10^{-68}:\\ \;\;\;\;{\left(c\_m \cdot \left(x\_m \cdot s\_m\right)\right)}^{-2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\cos \left(x\_m \cdot 2\right)}{t\_0}}{t\_0}\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
 :precision binary64
 (let* ((t_0 (* s_m (* x_m c_m))))
   (if (<= x_m 1.42e-68)
     (pow (* c_m (* x_m s_m)) -2.0)
     (/ (/ (cos (* x_m 2.0)) t_0) t_0))))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
	double t_0 = s_m * (x_m * c_m);
	double tmp;
	if (x_m <= 1.42e-68) {
		tmp = pow((c_m * (x_m * s_m)), -2.0);
	} else {
		tmp = (cos((x_m * 2.0)) / t_0) / t_0;
	}
	return tmp;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = s_m * (x_m * c_m)
    if (x_m <= 1.42d-68) then
        tmp = (c_m * (x_m * s_m)) ** (-2.0d0)
    else
        tmp = (cos((x_m * 2.0d0)) / t_0) / t_0
    end if
    code = tmp
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
	double t_0 = s_m * (x_m * c_m);
	double tmp;
	if (x_m <= 1.42e-68) {
		tmp = Math.pow((c_m * (x_m * s_m)), -2.0);
	} else {
		tmp = (Math.cos((x_m * 2.0)) / t_0) / t_0;
	}
	return tmp;
}
x_m = math.fabs(x)
c_m = math.fabs(c)
s_m = math.fabs(s)
[x_m, c_m, s_m] = sort([x_m, c_m, s_m])
def code(x_m, c_m, s_m):
	t_0 = s_m * (x_m * c_m)
	tmp = 0
	if x_m <= 1.42e-68:
		tmp = math.pow((c_m * (x_m * s_m)), -2.0)
	else:
		tmp = (math.cos((x_m * 2.0)) / t_0) / t_0
	return tmp
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
x_m, c_m, s_m = sort([x_m, c_m, s_m])
function code(x_m, c_m, s_m)
	t_0 = Float64(s_m * Float64(x_m * c_m))
	tmp = 0.0
	if (x_m <= 1.42e-68)
		tmp = Float64(c_m * Float64(x_m * s_m)) ^ -2.0;
	else
		tmp = Float64(Float64(cos(Float64(x_m * 2.0)) / t_0) / t_0);
	end
	return tmp
end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp_2 = code(x_m, c_m, s_m)
	t_0 = s_m * (x_m * c_m);
	tmp = 0.0;
	if (x_m <= 1.42e-68)
		tmp = (c_m * (x_m * s_m)) ^ -2.0;
	else
		tmp = (cos((x_m * 2.0)) / t_0) / t_0;
	end
	tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[(s$95$m * N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$95$m, 1.42e-68], N[Power[N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], N[(N[(N[Cos[N[(x$95$m * 2.0), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := s\_m \cdot \left(x\_m \cdot c\_m\right)\\
\mathbf{if}\;x\_m \leq 1.42 \cdot 10^{-68}:\\
\;\;\;\;{\left(c\_m \cdot \left(x\_m \cdot s\_m\right)\right)}^{-2}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cos \left(x\_m \cdot 2\right)}{t\_0}}{t\_0}\\


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

    1. Initial program 64.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\left(c \cdot c\right)} \cdot {\left(x \cdot s\right)}^{2}} \]
      9. unpow270.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-sqr86.0%

        \[\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. unpow286.0%

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

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

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

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

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

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

        \[\leadsto \frac{1}{\left(c \cdot c\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(s \cdot s\right)}\right)} \]
      5. swap-sqr70.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)}} \]
      6. swap-sqr86.0%

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{\left(c \cdot x\right) \cdot s}}{\left(c \cdot x\right) \cdot s}} \]
      10. *-lft-identity84.0%

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

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

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

        \[\leadsto {\left(\left(c \cdot x\right) \cdot s\right)}^{-1} \cdot \color{blue}{{\left(\left(c \cdot x\right) \cdot s\right)}^{-1}} \]
      14. pow-sqr84.0%

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

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

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

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

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

    if 1.42e-68 < x

    1. Initial program 66.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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. associate-*l/95.5%

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

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

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

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

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

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

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

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

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

Alternative 3: 97.1% accurate, 2.6× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ c_m = \left|c\right| \\ s_m = \left|s\right| \\ [x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\ \\ \begin{array}{l} \mathbf{if}\;x\_m \leq 4.4 \cdot 10^{-36}:\\ \;\;\;\;{\left(\frac{\frac{\frac{1}{x\_m}}{s\_m}}{c\_m}\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\cos \left(x\_m \cdot 2\right)}{s\_m \cdot \left(x\_m \cdot c\_m\right)}}{c\_m \cdot \left(x\_m \cdot s\_m\right)}\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
 :precision binary64
 (if (<= x_m 4.4e-36)
   (pow (/ (/ (/ 1.0 x_m) s_m) c_m) 2.0)
   (/ (/ (cos (* x_m 2.0)) (* s_m (* x_m c_m))) (* c_m (* x_m s_m)))))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
	double tmp;
	if (x_m <= 4.4e-36) {
		tmp = pow((((1.0 / x_m) / s_m) / c_m), 2.0);
	} else {
		tmp = (cos((x_m * 2.0)) / (s_m * (x_m * c_m))) / (c_m * (x_m * s_m));
	}
	return tmp;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s_m
    real(8) :: tmp
    if (x_m <= 4.4d-36) then
        tmp = (((1.0d0 / x_m) / s_m) / c_m) ** 2.0d0
    else
        tmp = (cos((x_m * 2.0d0)) / (s_m * (x_m * c_m))) / (c_m * (x_m * s_m))
    end if
    code = tmp
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
	double tmp;
	if (x_m <= 4.4e-36) {
		tmp = Math.pow((((1.0 / x_m) / s_m) / c_m), 2.0);
	} else {
		tmp = (Math.cos((x_m * 2.0)) / (s_m * (x_m * c_m))) / (c_m * (x_m * s_m));
	}
	return tmp;
}
x_m = math.fabs(x)
c_m = math.fabs(c)
s_m = math.fabs(s)
[x_m, c_m, s_m] = sort([x_m, c_m, s_m])
def code(x_m, c_m, s_m):
	tmp = 0
	if x_m <= 4.4e-36:
		tmp = math.pow((((1.0 / x_m) / s_m) / c_m), 2.0)
	else:
		tmp = (math.cos((x_m * 2.0)) / (s_m * (x_m * c_m))) / (c_m * (x_m * s_m))
	return tmp
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
x_m, c_m, s_m = sort([x_m, c_m, s_m])
function code(x_m, c_m, s_m)
	tmp = 0.0
	if (x_m <= 4.4e-36)
		tmp = Float64(Float64(Float64(1.0 / x_m) / s_m) / c_m) ^ 2.0;
	else
		tmp = Float64(Float64(cos(Float64(x_m * 2.0)) / Float64(s_m * Float64(x_m * c_m))) / Float64(c_m * Float64(x_m * s_m)));
	end
	return tmp
end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp_2 = code(x_m, c_m, s_m)
	tmp = 0.0;
	if (x_m <= 4.4e-36)
		tmp = (((1.0 / x_m) / s_m) / c_m) ^ 2.0;
	else
		tmp = (cos((x_m * 2.0)) / (s_m * (x_m * c_m))) / (c_m * (x_m * s_m));
	end
	tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := If[LessEqual[x$95$m, 4.4e-36], N[Power[N[(N[(N[(1.0 / x$95$m), $MachinePrecision] / s$95$m), $MachinePrecision] / c$95$m), $MachinePrecision], 2.0], $MachinePrecision], N[(N[(N[Cos[N[(x$95$m * 2.0), $MachinePrecision]], $MachinePrecision] / N[(s$95$m * N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 4.4 \cdot 10^{-36}:\\
\;\;\;\;{\left(\frac{\frac{\frac{1}{x\_m}}{s\_m}}{c\_m}\right)}^{2}\\

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


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

    1. Initial program 65.1%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{\cos \left(x \cdot -2\right)}{{c}^{2}}}{{s}^{2} \cdot {x}^{2}}} \]
    4. Add Preprocessing
    5. Applied egg-rr79.0%

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

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

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

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

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

        \[\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. associate-*l/96.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{c}}{x \cdot s} \cdot \color{blue}{\frac{\frac{1}{c \cdot s}}{x}} \]
      16. associate-/r*85.4%

        \[\leadsto \frac{\frac{1}{c}}{x \cdot s} \cdot \frac{\color{blue}{\frac{\frac{1}{c}}{s}}}{x} \]
      17. associate-/l/87.4%

        \[\leadsto \frac{\frac{1}{c}}{x \cdot s} \cdot \color{blue}{\frac{\frac{1}{c}}{x \cdot s}} \]
      18. unpow287.4%

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

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

    if 4.3999999999999999e-36 < x

    1. Initial program 64.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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. associate-*l/95.0%

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

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

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

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

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

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

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

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

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

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

Alternative 4: 93.8% accurate, 2.6× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ c_m = \left|c\right| \\ s_m = \left|s\right| \\ [x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\ \\ \begin{array}{l} \mathbf{if}\;s\_m \leq 2.2 \cdot 10^{+214}:\\ \;\;\;\;\frac{\frac{\cos \left(x\_m \cdot 2\right)}{c\_m}}{\left(s\_m \cdot \left(x\_m \cdot c\_m\right)\right) \cdot \left(x\_m \cdot s\_m\right)}\\ \mathbf{else}:\\ \;\;\;\;{\left(c\_m \cdot \left(x\_m \cdot s\_m\right)\right)}^{-2}\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
 :precision binary64
 (if (<= s_m 2.2e+214)
   (/ (/ (cos (* x_m 2.0)) c_m) (* (* s_m (* x_m c_m)) (* x_m s_m)))
   (pow (* c_m (* x_m s_m)) -2.0)))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
	double tmp;
	if (s_m <= 2.2e+214) {
		tmp = (cos((x_m * 2.0)) / c_m) / ((s_m * (x_m * c_m)) * (x_m * s_m));
	} else {
		tmp = pow((c_m * (x_m * s_m)), -2.0);
	}
	return tmp;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s_m
    real(8) :: tmp
    if (s_m <= 2.2d+214) then
        tmp = (cos((x_m * 2.0d0)) / c_m) / ((s_m * (x_m * c_m)) * (x_m * s_m))
    else
        tmp = (c_m * (x_m * s_m)) ** (-2.0d0)
    end if
    code = tmp
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
	double tmp;
	if (s_m <= 2.2e+214) {
		tmp = (Math.cos((x_m * 2.0)) / c_m) / ((s_m * (x_m * c_m)) * (x_m * s_m));
	} else {
		tmp = Math.pow((c_m * (x_m * s_m)), -2.0);
	}
	return tmp;
}
x_m = math.fabs(x)
c_m = math.fabs(c)
s_m = math.fabs(s)
[x_m, c_m, s_m] = sort([x_m, c_m, s_m])
def code(x_m, c_m, s_m):
	tmp = 0
	if s_m <= 2.2e+214:
		tmp = (math.cos((x_m * 2.0)) / c_m) / ((s_m * (x_m * c_m)) * (x_m * s_m))
	else:
		tmp = math.pow((c_m * (x_m * s_m)), -2.0)
	return tmp
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
x_m, c_m, s_m = sort([x_m, c_m, s_m])
function code(x_m, c_m, s_m)
	tmp = 0.0
	if (s_m <= 2.2e+214)
		tmp = Float64(Float64(cos(Float64(x_m * 2.0)) / c_m) / Float64(Float64(s_m * Float64(x_m * c_m)) * Float64(x_m * s_m)));
	else
		tmp = Float64(c_m * Float64(x_m * s_m)) ^ -2.0;
	end
	return tmp
end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp_2 = code(x_m, c_m, s_m)
	tmp = 0.0;
	if (s_m <= 2.2e+214)
		tmp = (cos((x_m * 2.0)) / c_m) / ((s_m * (x_m * c_m)) * (x_m * s_m));
	else
		tmp = (c_m * (x_m * s_m)) ^ -2.0;
	end
	tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := If[LessEqual[s$95$m, 2.2e+214], N[(N[(N[Cos[N[(x$95$m * 2.0), $MachinePrecision]], $MachinePrecision] / c$95$m), $MachinePrecision] / N[(N[(s$95$m * N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision] * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
\mathbf{if}\;s\_m \leq 2.2 \cdot 10^{+214}:\\
\;\;\;\;\frac{\frac{\cos \left(x\_m \cdot 2\right)}{c\_m}}{\left(s\_m \cdot \left(x\_m \cdot c\_m\right)\right) \cdot \left(x\_m \cdot s\_m\right)}\\

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


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

    1. Initial program 67.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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. *-commutative97.1%

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

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

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

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

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

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

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

    if 2.20000000000000023e214 < s

    1. Initial program 41.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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-sqr82.4%

        \[\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. unpow282.4%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{\left(c \cdot x\right) \cdot s}}{\left(c \cdot x\right) \cdot s}} \]
      10. *-lft-identity70.0%

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

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

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

        \[\leadsto {\left(\left(c \cdot x\right) \cdot s\right)}^{-1} \cdot \color{blue}{{\left(\left(c \cdot x\right) \cdot s\right)}^{-1}} \]
      14. pow-sqr70.0%

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

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

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

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

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

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

Alternative 5: 80.2% accurate, 2.9× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ c_m = \left|c\right| \\ s_m = \left|s\right| \\ [x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\ \\ {\left(\frac{\frac{\frac{1}{x\_m}}{s\_m}}{c\_m}\right)}^{2} \end{array} \]
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
 :precision binary64
 (pow (/ (/ (/ 1.0 x_m) s_m) c_m) 2.0))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
	return pow((((1.0 / x_m) / s_m) / c_m), 2.0);
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s_m
    code = (((1.0d0 / x_m) / s_m) / c_m) ** 2.0d0
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
	return Math.pow((((1.0 / x_m) / s_m) / c_m), 2.0);
}
x_m = math.fabs(x)
c_m = math.fabs(c)
s_m = math.fabs(s)
[x_m, c_m, s_m] = sort([x_m, c_m, s_m])
def code(x_m, c_m, s_m):
	return math.pow((((1.0 / x_m) / s_m) / c_m), 2.0)
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
x_m, c_m, s_m = sort([x_m, c_m, s_m])
function code(x_m, c_m, s_m)
	return Float64(Float64(Float64(1.0 / x_m) / s_m) / c_m) ^ 2.0
end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp = code(x_m, c_m, s_m)
	tmp = (((1.0 / x_m) / s_m) / c_m) ^ 2.0;
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := N[Power[N[(N[(N[(1.0 / x$95$m), $MachinePrecision] / s$95$m), $MachinePrecision] / c$95$m), $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
{\left(\frac{\frac{\frac{1}{x\_m}}{s\_m}}{c\_m}\right)}^{2}
\end{array}
Derivation
  1. Initial program 64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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. associate-*l/96.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{c}}{x \cdot s} \cdot \color{blue}{\frac{\frac{1}{c \cdot s}}{x}} \]
    16. associate-/r*79.0%

      \[\leadsto \frac{\frac{1}{c}}{x \cdot s} \cdot \frac{\color{blue}{\frac{\frac{1}{c}}{s}}}{x} \]
    17. associate-/l/80.3%

      \[\leadsto \frac{\frac{1}{c}}{x \cdot s} \cdot \color{blue}{\frac{\frac{1}{c}}{x \cdot s}} \]
    18. unpow280.3%

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

    \[\leadsto \color{blue}{{\left(\frac{\frac{\frac{1}{x}}{s}}{c}\right)}^{2}} \]
  13. Add Preprocessing

Alternative 6: 80.2% accurate, 20.9× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ c_m = \left|c\right| \\ s_m = \left|s\right| \\ [x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\ \\ \begin{array}{l} t_0 := \frac{\frac{1}{c\_m}}{x\_m \cdot s\_m}\\ t\_0 \cdot t\_0 \end{array} \end{array} \]
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
 :precision binary64
 (let* ((t_0 (/ (/ 1.0 c_m) (* x_m s_m)))) (* t_0 t_0)))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
	double t_0 = (1.0 / c_m) / (x_m * s_m);
	return t_0 * t_0;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s_m
    real(8) :: t_0
    t_0 = (1.0d0 / c_m) / (x_m * s_m)
    code = t_0 * t_0
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
	double t_0 = (1.0 / c_m) / (x_m * s_m);
	return t_0 * t_0;
}
x_m = math.fabs(x)
c_m = math.fabs(c)
s_m = math.fabs(s)
[x_m, c_m, s_m] = sort([x_m, c_m, s_m])
def code(x_m, c_m, s_m):
	t_0 = (1.0 / c_m) / (x_m * s_m)
	return t_0 * t_0
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
x_m, c_m, s_m = sort([x_m, c_m, s_m])
function code(x_m, c_m, s_m)
	t_0 = Float64(Float64(1.0 / c_m) / Float64(x_m * s_m))
	return Float64(t_0 * t_0)
end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp = code(x_m, c_m, s_m)
	t_0 = (1.0 / c_m) / (x_m * s_m);
	tmp = t_0 * t_0;
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[(N[(1.0 / c$95$m), $MachinePrecision] / N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * t$95$0), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{1}{c\_m}}{x\_m \cdot s\_m}\\
t\_0 \cdot t\_0
\end{array}
\end{array}
Derivation
  1. Initial program 64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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.3%

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

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

      \[\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-sqr79.9%

      \[\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. unpow279.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(c \cdot \color{blue}{\left(x \cdot s\right)}\right)}^{-2} \]
    2. /-rgt-identity80.3%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{c}}{x \cdot s} \cdot \color{blue}{\frac{\frac{1}{c}}{x \cdot s}} \]
  14. Applied egg-rr80.3%

    \[\leadsto \color{blue}{\frac{\frac{1}{c}}{x \cdot s} \cdot \frac{\frac{1}{c}}{x \cdot s}} \]
  15. Add Preprocessing

Alternative 7: 80.2% accurate, 20.9× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ c_m = \left|c\right| \\ s_m = \left|s\right| \\ [x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\ \\ \begin{array}{l} t_0 := \frac{1}{c\_m \cdot \left(x\_m \cdot s\_m\right)}\\ t\_0 \cdot t\_0 \end{array} \end{array} \]
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
 :precision binary64
 (let* ((t_0 (/ 1.0 (* c_m (* x_m s_m))))) (* t_0 t_0)))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
	double t_0 = 1.0 / (c_m * (x_m * s_m));
	return t_0 * t_0;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s_m
    real(8) :: t_0
    t_0 = 1.0d0 / (c_m * (x_m * s_m))
    code = t_0 * t_0
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
	double t_0 = 1.0 / (c_m * (x_m * s_m));
	return t_0 * t_0;
}
x_m = math.fabs(x)
c_m = math.fabs(c)
s_m = math.fabs(s)
[x_m, c_m, s_m] = sort([x_m, c_m, s_m])
def code(x_m, c_m, s_m):
	t_0 = 1.0 / (c_m * (x_m * s_m))
	return t_0 * t_0
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
x_m, c_m, s_m = sort([x_m, c_m, s_m])
function code(x_m, c_m, s_m)
	t_0 = Float64(1.0 / Float64(c_m * Float64(x_m * s_m)))
	return Float64(t_0 * t_0)
end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp = code(x_m, c_m, s_m)
	t_0 = 1.0 / (c_m * (x_m * s_m));
	tmp = t_0 * t_0;
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[(1.0 / N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * t$95$0), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := \frac{1}{c\_m \cdot \left(x\_m \cdot s\_m\right)}\\
t\_0 \cdot t\_0
\end{array}
\end{array}
Derivation
  1. Initial program 64.9%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\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. Taylor expanded in x around 0 80.3%

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

Alternative 8: 80.2% accurate, 24.1× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ c_m = \left|c\right| \\ s_m = \left|s\right| \\ [x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\ \\ \begin{array}{l} t_0 := c\_m \cdot \left(x\_m \cdot s\_m\right)\\ \frac{\frac{1}{t\_0}}{t\_0} \end{array} \end{array} \]
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
 :precision binary64
 (let* ((t_0 (* c_m (* x_m s_m)))) (/ (/ 1.0 t_0) t_0)))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
	double t_0 = c_m * (x_m * s_m);
	return (1.0 / t_0) / t_0;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s_m
    real(8) :: t_0
    t_0 = c_m * (x_m * s_m)
    code = (1.0d0 / t_0) / t_0
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
	double t_0 = c_m * (x_m * s_m);
	return (1.0 / t_0) / t_0;
}
x_m = math.fabs(x)
c_m = math.fabs(c)
s_m = math.fabs(s)
[x_m, c_m, s_m] = sort([x_m, c_m, s_m])
def code(x_m, c_m, s_m):
	t_0 = c_m * (x_m * s_m)
	return (1.0 / t_0) / t_0
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
x_m, c_m, s_m = sort([x_m, c_m, s_m])
function code(x_m, c_m, s_m)
	t_0 = Float64(c_m * Float64(x_m * s_m))
	return Float64(Float64(1.0 / t_0) / t_0)
end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp = code(x_m, c_m, s_m)
	t_0 = c_m * (x_m * s_m);
	tmp = (1.0 / t_0) / t_0;
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := c\_m \cdot \left(x\_m \cdot s\_m\right)\\
\frac{\frac{1}{t\_0}}{t\_0}
\end{array}
\end{array}
Derivation
  1. Initial program 64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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.3%

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

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

      \[\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-sqr79.9%

      \[\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. unpow279.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 78.5% accurate, 24.1× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ c_m = \left|c\right| \\ s_m = \left|s\right| \\ [x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\ \\ \frac{1}{\left(x\_m \cdot s\_m\right) \cdot \left(c\_m \cdot \left(c\_m \cdot \left(x\_m \cdot s\_m\right)\right)\right)} \end{array} \]
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
 :precision binary64
 (/ 1.0 (* (* x_m s_m) (* c_m (* c_m (* x_m s_m))))))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
	return 1.0 / ((x_m * s_m) * (c_m * (c_m * (x_m * s_m))));
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s_m
    code = 1.0d0 / ((x_m * s_m) * (c_m * (c_m * (x_m * s_m))))
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
	return 1.0 / ((x_m * s_m) * (c_m * (c_m * (x_m * s_m))));
}
x_m = math.fabs(x)
c_m = math.fabs(c)
s_m = math.fabs(s)
[x_m, c_m, s_m] = sort([x_m, c_m, s_m])
def code(x_m, c_m, s_m):
	return 1.0 / ((x_m * s_m) * (c_m * (c_m * (x_m * s_m))))
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
x_m, c_m, s_m = sort([x_m, c_m, s_m])
function code(x_m, c_m, s_m)
	return Float64(1.0 / Float64(Float64(x_m * s_m) * Float64(c_m * Float64(c_m * Float64(x_m * s_m)))))
end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp = code(x_m, c_m, s_m)
	tmp = 1.0 / ((x_m * s_m) * (c_m * (c_m * (x_m * s_m))));
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := N[(1.0 / N[(N[(x$95$m * s$95$m), $MachinePrecision] * N[(c$95$m * N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\frac{1}{\left(x\_m \cdot s\_m\right) \cdot \left(c\_m \cdot \left(c\_m \cdot \left(x\_m \cdot s\_m\right)\right)\right)}
\end{array}
Derivation
  1. Initial program 64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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.3%

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

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

      \[\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-sqr79.9%

      \[\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. unpow279.9%

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

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

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

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

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

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

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

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

Alternative 10: 78.1% accurate, 24.1× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ c_m = \left|c\right| \\ s_m = \left|s\right| \\ [x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\ \\ \begin{array}{l} t_0 := s\_m \cdot \left(x\_m \cdot c\_m\right)\\ \frac{1}{t\_0 \cdot t\_0} \end{array} \end{array} \]
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
 :precision binary64
 (let* ((t_0 (* s_m (* x_m c_m)))) (/ 1.0 (* t_0 t_0))))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
	double t_0 = s_m * (x_m * c_m);
	return 1.0 / (t_0 * t_0);
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s_m
    real(8) :: t_0
    t_0 = s_m * (x_m * c_m)
    code = 1.0d0 / (t_0 * t_0)
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
	double t_0 = s_m * (x_m * c_m);
	return 1.0 / (t_0 * t_0);
}
x_m = math.fabs(x)
c_m = math.fabs(c)
s_m = math.fabs(s)
[x_m, c_m, s_m] = sort([x_m, c_m, s_m])
def code(x_m, c_m, s_m):
	t_0 = s_m * (x_m * c_m)
	return 1.0 / (t_0 * t_0)
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
x_m, c_m, s_m = sort([x_m, c_m, s_m])
function code(x_m, c_m, s_m)
	t_0 = Float64(s_m * Float64(x_m * c_m))
	return Float64(1.0 / Float64(t_0 * t_0))
end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp = code(x_m, c_m, s_m)
	t_0 = s_m * (x_m * c_m);
	tmp = 1.0 / (t_0 * t_0);
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[(s$95$m * N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]}, N[(1.0 / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := s\_m \cdot \left(x\_m \cdot c\_m\right)\\
\frac{1}{t\_0 \cdot t\_0}
\end{array}
\end{array}
Derivation
  1. Initial program 64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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.3%

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

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

      \[\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-sqr79.9%

      \[\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. unpow279.9%

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

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

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

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

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

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

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

Reproduce

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