mixedcos

Percentage Accurate: 66.8% → 97.1%
Time: 13.3s
Alternatives: 6
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 6 alternatives:

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

Initial Program: 66.8% accurate, 1.0× speedup?

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

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

Alternative 1: 97.1% accurate, 1.4× speedup?

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

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. *-un-lft-identity68.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 97.0% accurate, 1.4× speedup?

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

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. *-un-lft-identity68.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 97.1% accurate, 2.7× speedup?

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

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. *-un-lft-identity68.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 96.9% accurate, 2.7× speedup?

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

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. *-un-lft-identity68.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 79.2% accurate, 20.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 79.1% accurate, 24.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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