
(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:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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}
(FPCore (x c s)
:precision binary64
(let* ((t_0 (cos (* 2.0 x))) (t_1 (* x (* c s))))
(if (<= (/ t_0 (* (pow c 2.0) (* x (* x (pow s 2.0))))) INFINITY)
(* (/ (/ 1.0 c) (* x s)) (/ t_0 (* c (* x s))))
(/ (/ t_0 t_1) t_1))))
double code(double x, double c, double s) {
double t_0 = cos((2.0 * x));
double t_1 = x * (c * s);
double tmp;
if ((t_0 / (pow(c, 2.0) * (x * (x * pow(s, 2.0))))) <= ((double) INFINITY)) {
tmp = ((1.0 / c) / (x * s)) * (t_0 / (c * (x * s)));
} else {
tmp = (t_0 / t_1) / t_1;
}
return tmp;
}
public static double code(double x, double c, double s) {
double t_0 = Math.cos((2.0 * x));
double t_1 = x * (c * s);
double tmp;
if ((t_0 / (Math.pow(c, 2.0) * (x * (x * Math.pow(s, 2.0))))) <= Double.POSITIVE_INFINITY) {
tmp = ((1.0 / c) / (x * s)) * (t_0 / (c * (x * s)));
} else {
tmp = (t_0 / t_1) / t_1;
}
return tmp;
}
def code(x, c, s): t_0 = math.cos((2.0 * x)) t_1 = x * (c * s) tmp = 0 if (t_0 / (math.pow(c, 2.0) * (x * (x * math.pow(s, 2.0))))) <= math.inf: tmp = ((1.0 / c) / (x * s)) * (t_0 / (c * (x * s))) else: tmp = (t_0 / t_1) / t_1 return tmp
function code(x, c, s) t_0 = cos(Float64(2.0 * x)) t_1 = Float64(x * Float64(c * s)) tmp = 0.0 if (Float64(t_0 / Float64((c ^ 2.0) * Float64(x * Float64(x * (s ^ 2.0))))) <= Inf) tmp = Float64(Float64(Float64(1.0 / c) / Float64(x * s)) * Float64(t_0 / Float64(c * Float64(x * s)))); else tmp = Float64(Float64(t_0 / t_1) / t_1); end return tmp end
function tmp_2 = code(x, c, s) t_0 = cos((2.0 * x)); t_1 = x * (c * s); tmp = 0.0; if ((t_0 / ((c ^ 2.0) * (x * (x * (s ^ 2.0))))) <= Inf) tmp = ((1.0 / c) / (x * s)) * (t_0 / (c * (x * s))); else tmp = (t_0 / t_1) / t_1; end tmp_2 = tmp; end
code[x_, c_, s_] := Block[{t$95$0 = N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 / N[(N[Power[c, 2.0], $MachinePrecision] * N[(x * N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[(1.0 / c), $MachinePrecision] / N[(x * s), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / t$95$1), $MachinePrecision] / t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(2 \cdot x\right)\\
t_1 := x \cdot \left(c \cdot s\right)\\
\mathbf{if}\;\frac{t\_0}{{c}^{2} \cdot \left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \leq \infty:\\
\;\;\;\;\frac{\frac{1}{c}}{x \cdot s} \cdot \frac{t\_0}{c \cdot \left(x \cdot s\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{t\_1}}{t\_1}\\
\end{array}
\end{array}
if (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) < +inf.0Initial program 76.3%
associate-/r*76.0%
*-commutative76.0%
unpow276.0%
sqr-neg76.0%
unpow276.0%
cos-neg76.0%
*-commutative76.0%
distribute-rgt-neg-in76.0%
metadata-eval76.0%
unpow276.0%
sqr-neg76.0%
unpow276.0%
associate-*r*70.1%
unpow270.1%
*-commutative70.1%
Simplified70.1%
Applied egg-rr99.6%
Taylor expanded in c around 0 99.6%
associate-/r*99.6%
Simplified99.6%
if +inf.0 < (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) Initial program 0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
sqr-neg0.0%
unpow20.0%
cos-neg0.0%
*-commutative0.0%
distribute-rgt-neg-in0.0%
metadata-eval0.0%
unpow20.0%
sqr-neg0.0%
unpow20.0%
associate-*r*0.0%
unpow20.0%
*-commutative0.0%
Simplified0.0%
Applied egg-rr83.2%
associate-*l/83.1%
unpow-prod-down11.0%
times-frac11.0%
unpow-prod-down0.0%
pow20.0%
associate-*r*0.0%
*-commutative0.0%
times-frac0.0%
*-un-lft-identity0.0%
add-sqr-sqrt0.0%
associate-/r*0.0%
Applied egg-rr99.2%
Final simplification99.6%
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* c (* x s))))
(if (<= x 1.9e-15)
(/ 1.0 (pow t_0 2.0))
(/ (/ (cos (* 2.0 x)) (* c t_0)) (* x s)))))
double code(double x, double c, double s) {
double t_0 = c * (x * s);
double tmp;
if (x <= 1.9e-15) {
tmp = 1.0 / pow(t_0, 2.0);
} else {
tmp = (cos((2.0 * x)) / (c * t_0)) / (x * s);
}
return tmp;
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
real(8) :: tmp
t_0 = c * (x * s)
if (x <= 1.9d-15) then
tmp = 1.0d0 / (t_0 ** 2.0d0)
else
tmp = (cos((2.0d0 * x)) / (c * t_0)) / (x * s)
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double t_0 = c * (x * s);
double tmp;
if (x <= 1.9e-15) {
tmp = 1.0 / Math.pow(t_0, 2.0);
} else {
tmp = (Math.cos((2.0 * x)) / (c * t_0)) / (x * s);
}
return tmp;
}
def code(x, c, s): t_0 = c * (x * s) tmp = 0 if x <= 1.9e-15: tmp = 1.0 / math.pow(t_0, 2.0) else: tmp = (math.cos((2.0 * x)) / (c * t_0)) / (x * s) return tmp
function code(x, c, s) t_0 = Float64(c * Float64(x * s)) tmp = 0.0 if (x <= 1.9e-15) tmp = Float64(1.0 / (t_0 ^ 2.0)); else tmp = Float64(Float64(cos(Float64(2.0 * x)) / Float64(c * t_0)) / Float64(x * s)); end return tmp end
function tmp_2 = code(x, c, s) t_0 = c * (x * s); tmp = 0.0; if (x <= 1.9e-15) tmp = 1.0 / (t_0 ^ 2.0); else tmp = (cos((2.0 * x)) / (c * t_0)) / (x * s); end tmp_2 = tmp; end
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.9e-15], N[(1.0 / N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(c * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(x * s), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
\mathbf{if}\;x \leq 1.9 \cdot 10^{-15}:\\
\;\;\;\;\frac{1}{{t\_0}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cos \left(2 \cdot x\right)}{c \cdot t\_0}}{x \cdot s}\\
\end{array}
\end{array}
if x < 1.9000000000000001e-15Initial program 63.0%
associate-/r*62.5%
*-commutative62.5%
unpow262.5%
sqr-neg62.5%
unpow262.5%
cos-neg62.5%
*-commutative62.5%
distribute-rgt-neg-in62.5%
metadata-eval62.5%
unpow262.5%
sqr-neg62.5%
unpow262.5%
associate-*r*57.5%
unpow257.5%
*-commutative57.5%
Simplified57.5%
Taylor expanded in x around 0 53.6%
associate-/r*53.1%
*-commutative53.1%
unpow253.1%
unpow253.1%
swap-sqr67.8%
unpow267.8%
associate-/r*68.3%
unpow268.3%
unpow268.3%
swap-sqr85.9%
unpow285.9%
Simplified85.9%
if 1.9000000000000001e-15 < x Initial program 68.3%
associate-/r*68.9%
*-commutative68.9%
unpow268.9%
sqr-neg68.9%
unpow268.9%
cos-neg68.9%
*-commutative68.9%
distribute-rgt-neg-in68.9%
metadata-eval68.9%
unpow268.9%
sqr-neg68.9%
unpow268.9%
associate-*r*64.1%
unpow264.1%
*-commutative64.1%
Simplified64.1%
Applied egg-rr94.8%
*-commutative94.8%
div-inv94.8%
unpow294.8%
associate-/r*95.5%
associate-/r*91.3%
*-commutative91.3%
*-commutative91.3%
associate-*l*91.3%
Applied egg-rr91.3%
div-inv91.2%
associate-*r*91.3%
*-commutative91.3%
associate-*l*87.0%
Applied egg-rr87.0%
associate-*r/87.0%
*-rgt-identity87.0%
associate-/l/87.0%
*-commutative87.0%
associate-*r*91.3%
*-commutative91.3%
Simplified91.3%
Final simplification87.3%
(FPCore (x c s) :precision binary64 (let* ((t_0 (* x (* c s)))) (/ (/ (cos (* 2.0 x)) t_0) t_0)))
double code(double x, double c, double s) {
double t_0 = x * (c * s);
return (cos((2.0 * x)) / t_0) / t_0;
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
t_0 = x * (c * s)
code = (cos((2.0d0 * x)) / t_0) / t_0
end function
public static double code(double x, double c, double s) {
double t_0 = x * (c * s);
return (Math.cos((2.0 * x)) / t_0) / t_0;
}
def code(x, c, s): t_0 = x * (c * s) return (math.cos((2.0 * x)) / t_0) / t_0
function code(x, c, s) t_0 = Float64(x * Float64(c * s)) return Float64(Float64(cos(Float64(2.0 * x)) / t_0) / t_0) end
function tmp = code(x, c, s) t_0 = x * (c * s); tmp = (cos((2.0 * x)) / t_0) / t_0; end
code[x_, c_, s_] := Block[{t$95$0 = N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(c \cdot s\right)\\
\frac{\frac{\cos \left(2 \cdot x\right)}{t\_0}}{t\_0}
\end{array}
\end{array}
Initial program 64.4%
associate-/r*64.2%
*-commutative64.2%
unpow264.2%
sqr-neg64.2%
unpow264.2%
cos-neg64.2%
*-commutative64.2%
distribute-rgt-neg-in64.2%
metadata-eval64.2%
unpow264.2%
sqr-neg64.2%
unpow264.2%
associate-*r*59.2%
unpow259.2%
*-commutative59.2%
Simplified59.2%
Applied egg-rr96.9%
associate-*l/96.9%
unpow-prod-down78.0%
times-frac77.4%
unpow-prod-down59.2%
pow259.2%
associate-*r*63.8%
*-commutative63.8%
times-frac64.4%
*-un-lft-identity64.4%
add-sqr-sqrt64.4%
associate-/r*64.3%
Applied egg-rr97.0%
Final simplification97.0%
(FPCore (x c s) :precision binary64 (/ 1.0 (pow (* c (* x s)) 2.0)))
double code(double x, double c, double s) {
return 1.0 / pow((c * (x * s)), 2.0);
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = 1.0d0 / ((c * (x * s)) ** 2.0d0)
end function
public static double code(double x, double c, double s) {
return 1.0 / Math.pow((c * (x * s)), 2.0);
}
def code(x, c, s): return 1.0 / math.pow((c * (x * s)), 2.0)
function code(x, c, s) return Float64(1.0 / (Float64(c * Float64(x * s)) ^ 2.0)) end
function tmp = code(x, c, s) tmp = 1.0 / ((c * (x * s)) ^ 2.0); end
code[x_, c_, s_] := N[(1.0 / N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}}
\end{array}
Initial program 64.4%
associate-/r*64.2%
*-commutative64.2%
unpow264.2%
sqr-neg64.2%
unpow264.2%
cos-neg64.2%
*-commutative64.2%
distribute-rgt-neg-in64.2%
metadata-eval64.2%
unpow264.2%
sqr-neg64.2%
unpow264.2%
associate-*r*59.2%
unpow259.2%
*-commutative59.2%
Simplified59.2%
Taylor expanded in x around 0 53.2%
associate-/r*52.8%
*-commutative52.8%
unpow252.8%
unpow252.8%
swap-sqr64.9%
unpow264.9%
associate-/r*65.3%
unpow265.3%
unpow265.3%
swap-sqr79.7%
unpow279.7%
Simplified79.7%
(FPCore (x c s) :precision binary64 (pow (* c (* x s)) -2.0))
double code(double x, double c, double s) {
return pow((c * (x * s)), -2.0);
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = (c * (x * s)) ** (-2.0d0)
end function
public static double code(double x, double c, double s) {
return Math.pow((c * (x * s)), -2.0);
}
def code(x, c, s): return math.pow((c * (x * s)), -2.0)
function code(x, c, s) return Float64(c * Float64(x * s)) ^ -2.0 end
function tmp = code(x, c, s) tmp = (c * (x * s)) ^ -2.0; end
code[x_, c_, s_] := N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]
\begin{array}{l}
\\
{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}
\end{array}
Initial program 64.4%
associate-/r*64.2%
*-commutative64.2%
unpow264.2%
sqr-neg64.2%
unpow264.2%
cos-neg64.2%
*-commutative64.2%
distribute-rgt-neg-in64.2%
metadata-eval64.2%
unpow264.2%
sqr-neg64.2%
unpow264.2%
associate-*r*59.2%
unpow259.2%
*-commutative59.2%
Simplified59.2%
Taylor expanded in x around 0 53.2%
associate-/r*52.8%
*-commutative52.8%
unpow252.8%
unpow252.8%
swap-sqr64.9%
unpow264.9%
associate-/r*65.3%
unpow265.3%
unpow265.3%
swap-sqr79.7%
unpow279.7%
Simplified79.7%
Taylor expanded in c around 0 53.2%
associate-*r*54.2%
*-commutative54.2%
unpow254.2%
unpow254.2%
swap-sqr67.1%
*-commutative67.1%
unpow267.1%
swap-sqr79.2%
associate-/l/79.2%
*-rgt-identity79.2%
associate-*r/79.1%
unpow-179.1%
unpow-179.1%
pow-sqr79.2%
metadata-eval79.2%
*-commutative79.2%
*-commutative79.2%
associate-*r*79.7%
Simplified79.7%
Final simplification79.7%
(FPCore (x c s) :precision binary64 (let* ((t_0 (* c (* x s)))) (/ (/ 1.0 t_0) t_0)))
double code(double x, double c, double s) {
double t_0 = c * (x * s);
return (1.0 / t_0) / t_0;
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
t_0 = c * (x * s)
code = (1.0d0 / t_0) / t_0
end function
public static double code(double x, double c, double s) {
double t_0 = c * (x * s);
return (1.0 / t_0) / t_0;
}
def code(x, c, s): t_0 = c * (x * s) return (1.0 / t_0) / t_0
function code(x, c, s) t_0 = Float64(c * Float64(x * s)) return Float64(Float64(1.0 / t_0) / t_0) end
function tmp = code(x, c, s) t_0 = c * (x * s); tmp = (1.0 / t_0) / t_0; end
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
\frac{\frac{1}{t\_0}}{t\_0}
\end{array}
\end{array}
Initial program 64.4%
associate-/r*64.2%
*-commutative64.2%
unpow264.2%
sqr-neg64.2%
unpow264.2%
cos-neg64.2%
*-commutative64.2%
distribute-rgt-neg-in64.2%
metadata-eval64.2%
unpow264.2%
sqr-neg64.2%
unpow264.2%
associate-*r*59.2%
unpow259.2%
*-commutative59.2%
Simplified59.2%
Taylor expanded in x around 0 53.2%
associate-/r*52.8%
*-commutative52.8%
unpow252.8%
unpow252.8%
swap-sqr64.9%
unpow264.9%
associate-/r*65.3%
unpow265.3%
unpow265.3%
swap-sqr79.7%
unpow279.7%
Simplified79.7%
pow-flip79.7%
*-commutative79.7%
associate-*l*79.2%
metadata-eval79.2%
Applied egg-rr79.2%
associate-*r*79.7%
*-commutative79.7%
associate-*r*78.2%
metadata-eval78.2%
pow-div78.2%
inv-pow78.2%
associate-*r*77.2%
*-commutative77.2%
*-commutative77.2%
pow177.2%
associate-*r*79.7%
*-commutative79.7%
*-commutative79.7%
Applied egg-rr79.7%
(FPCore (x c s) :precision binary64 (/ 1.0 (* c (* (* x s) (* c (* x s))))))
double code(double x, double c, double s) {
return 1.0 / (c * ((x * s) * (c * (x * s))));
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = 1.0d0 / (c * ((x * s) * (c * (x * s))))
end function
public static double code(double x, double c, double s) {
return 1.0 / (c * ((x * s) * (c * (x * s))));
}
def code(x, c, s): return 1.0 / (c * ((x * s) * (c * (x * s))))
function code(x, c, s) return Float64(1.0 / Float64(c * Float64(Float64(x * s) * Float64(c * Float64(x * s))))) end
function tmp = code(x, c, s) tmp = 1.0 / (c * ((x * s) * (c * (x * s)))); end
code[x_, c_, s_] := N[(1.0 / N[(c * N[(N[(x * s), $MachinePrecision] * N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{c \cdot \left(\left(x \cdot s\right) \cdot \left(c \cdot \left(x \cdot s\right)\right)\right)}
\end{array}
Initial program 64.4%
associate-/r*64.2%
*-commutative64.2%
unpow264.2%
sqr-neg64.2%
unpow264.2%
cos-neg64.2%
*-commutative64.2%
distribute-rgt-neg-in64.2%
metadata-eval64.2%
unpow264.2%
sqr-neg64.2%
unpow264.2%
associate-*r*59.2%
unpow259.2%
*-commutative59.2%
Simplified59.2%
Taylor expanded in x around 0 53.2%
associate-/r*52.8%
*-commutative52.8%
unpow252.8%
unpow252.8%
swap-sqr64.9%
unpow264.9%
associate-/r*65.3%
unpow265.3%
unpow265.3%
swap-sqr79.7%
unpow279.7%
Simplified79.7%
unpow279.7%
associate-*l*78.3%
*-commutative78.3%
associate-*l*76.7%
Applied egg-rr76.7%
Taylor expanded in x around 0 78.3%
Final simplification78.3%
herbie shell --seed 2024182
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))