| Alternative 1 | |
|---|---|
| Accuracy | 97.6% |
| Cost | 7757 |
(FPCore (x c s) :precision binary64 (/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* s (* c x))) (t_1 (cos (+ x x))))
(if (<= c -6e+220)
(* (/ (/ 1.0 x) (* c s)) (/ t_1 (* x (* c s))))
(if (or (<= c -6.6e-200) (not (<= c 9e-124)))
(* (/ (cos (* x -2.0)) (* c (* x s))) (/ (/ (/ -1.0 x) s) (- c)))
(/ (/ t_1 t_0) t_0)))))double code(double x, double c, double s) {
return cos((2.0 * x)) / (pow(c, 2.0) * ((x * pow(s, 2.0)) * x));
}
double code(double x, double c, double s) {
double t_0 = s * (c * x);
double t_1 = cos((x + x));
double tmp;
if (c <= -6e+220) {
tmp = ((1.0 / x) / (c * s)) * (t_1 / (x * (c * s)));
} else if ((c <= -6.6e-200) || !(c <= 9e-124)) {
tmp = (cos((x * -2.0)) / (c * (x * s))) * (((-1.0 / x) / s) / -c);
} else {
tmp = (t_1 / t_0) / t_0;
}
return tmp;
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = cos((2.0d0 * x)) / ((c ** 2.0d0) * ((x * (s ** 2.0d0)) * x))
end function
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = s * (c * x)
t_1 = cos((x + x))
if (c <= (-6d+220)) then
tmp = ((1.0d0 / x) / (c * s)) * (t_1 / (x * (c * s)))
else if ((c <= (-6.6d-200)) .or. (.not. (c <= 9d-124))) then
tmp = (cos((x * (-2.0d0))) / (c * (x * s))) * ((((-1.0d0) / x) / s) / -c)
else
tmp = (t_1 / t_0) / t_0
end if
code = tmp
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));
}
public static double code(double x, double c, double s) {
double t_0 = s * (c * x);
double t_1 = Math.cos((x + x));
double tmp;
if (c <= -6e+220) {
tmp = ((1.0 / x) / (c * s)) * (t_1 / (x * (c * s)));
} else if ((c <= -6.6e-200) || !(c <= 9e-124)) {
tmp = (Math.cos((x * -2.0)) / (c * (x * s))) * (((-1.0 / x) / s) / -c);
} else {
tmp = (t_1 / t_0) / t_0;
}
return tmp;
}
def code(x, c, s): return math.cos((2.0 * x)) / (math.pow(c, 2.0) * ((x * math.pow(s, 2.0)) * x))
def code(x, c, s): t_0 = s * (c * x) t_1 = math.cos((x + x)) tmp = 0 if c <= -6e+220: tmp = ((1.0 / x) / (c * s)) * (t_1 / (x * (c * s))) elif (c <= -6.6e-200) or not (c <= 9e-124): tmp = (math.cos((x * -2.0)) / (c * (x * s))) * (((-1.0 / x) / s) / -c) else: tmp = (t_1 / t_0) / t_0 return tmp
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 code(x, c, s) t_0 = Float64(s * Float64(c * x)) t_1 = cos(Float64(x + x)) tmp = 0.0 if (c <= -6e+220) tmp = Float64(Float64(Float64(1.0 / x) / Float64(c * s)) * Float64(t_1 / Float64(x * Float64(c * s)))); elseif ((c <= -6.6e-200) || !(c <= 9e-124)) tmp = Float64(Float64(cos(Float64(x * -2.0)) / Float64(c * Float64(x * s))) * Float64(Float64(Float64(-1.0 / x) / s) / Float64(-c))); else tmp = Float64(Float64(t_1 / t_0) / t_0); end return tmp end
function tmp = code(x, c, s) tmp = cos((2.0 * x)) / ((c ^ 2.0) * ((x * (s ^ 2.0)) * x)); end
function tmp_2 = code(x, c, s) t_0 = s * (c * x); t_1 = cos((x + x)); tmp = 0.0; if (c <= -6e+220) tmp = ((1.0 / x) / (c * s)) * (t_1 / (x * (c * s))); elseif ((c <= -6.6e-200) || ~((c <= 9e-124))) tmp = (cos((x * -2.0)) / (c * (x * s))) * (((-1.0 / x) / s) / -c); else tmp = (t_1 / t_0) / t_0; end tmp_2 = tmp; 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]
code[x_, c_, s_] := Block[{t$95$0 = N[(s * N[(c * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[c, -6e+220], N[(N[(N[(1.0 / x), $MachinePrecision] / N[(c * s), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 / N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[c, -6.6e-200], N[Not[LessEqual[c, 9e-124]], $MachinePrecision]], N[(N[(N[Cos[N[(x * -2.0), $MachinePrecision]], $MachinePrecision] / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(-1.0 / x), $MachinePrecision] / s), $MachinePrecision] / (-c)), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]]]]
\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}
\begin{array}{l}
t_0 := s \cdot \left(c \cdot x\right)\\
t_1 := \cos \left(x + x\right)\\
\mathbf{if}\;c \leq -6 \cdot 10^{+220}:\\
\;\;\;\;\frac{\frac{1}{x}}{c \cdot s} \cdot \frac{t_1}{x \cdot \left(c \cdot s\right)}\\
\mathbf{elif}\;c \leq -6.6 \cdot 10^{-200} \lor \neg \left(c \leq 9 \cdot 10^{-124}\right):\\
\;\;\;\;\frac{\cos \left(x \cdot -2\right)}{c \cdot \left(x \cdot s\right)} \cdot \frac{\frac{\frac{-1}{x}}{s}}{-c}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_1}{t_0}}{t_0}\\
\end{array}
Results
if c < -6.00000000000000048e220Initial program 60.1%
Simplified61.3%
[Start]60.1 | \[ \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}
\] |
|---|---|
*-commutative [=>]60.1 | \[ \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\color{blue}{\left({s}^{2} \cdot x\right)} \cdot x\right)}
\] |
associate-*l* [=>]53.4 | \[ \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left({s}^{2} \cdot \left(x \cdot x\right)\right)}}
\] |
associate-*r* [=>]53.6 | \[ \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot {s}^{2}\right) \cdot \left(x \cdot x\right)}}
\] |
*-commutative [=>]53.6 | \[ \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(x \cdot x\right) \cdot \left({c}^{2} \cdot {s}^{2}\right)}}
\] |
unpow2 [=>]53.6 | \[ \frac{\cos \left(2 \cdot x\right)}{\left(x \cdot x\right) \cdot \left({c}^{2} \cdot \color{blue}{\left(s \cdot s\right)}\right)}
\] |
associate-*r* [=>]61.3 | \[ \frac{\cos \left(2 \cdot x\right)}{\left(x \cdot x\right) \cdot \color{blue}{\left(\left({c}^{2} \cdot s\right) \cdot s\right)}}
\] |
associate-*r* [=>]61.3 | \[ \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left(x \cdot x\right) \cdot \left({c}^{2} \cdot s\right)\right) \cdot s}}
\] |
*-commutative [=>]61.3 | \[ \frac{\cos \left(2 \cdot x\right)}{\color{blue}{s \cdot \left(\left(x \cdot x\right) \cdot \left({c}^{2} \cdot s\right)\right)}}
\] |
unpow2 [=>]61.3 | \[ \frac{\cos \left(2 \cdot x\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \left(\color{blue}{\left(c \cdot c\right)} \cdot s\right)\right)}
\] |
Applied egg-rr49.9%
[Start]61.3 | \[ \frac{\cos \left(2 \cdot x\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}
\] |
|---|---|
*-un-lft-identity [=>]61.3 | \[ \frac{\color{blue}{1 \cdot \cos \left(2 \cdot x\right)}}{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}
\] |
add-sqr-sqrt [=>]61.3 | \[ \frac{1 \cdot \cos \left(2 \cdot x\right)}{\color{blue}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)} \cdot \sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}}}
\] |
times-frac [=>]61.3 | \[ \color{blue}{\frac{1}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}}}
\] |
*-commutative [=>]61.3 | \[ \frac{1}{\sqrt{\color{blue}{\left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right) \cdot s}}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}}
\] |
sqrt-prod [=>]32.2 | \[ \frac{1}{\color{blue}{\sqrt{\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)} \cdot \sqrt{s}}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}}
\] |
sqrt-prod [=>]32.2 | \[ \frac{1}{\color{blue}{\left(\sqrt{x \cdot x} \cdot \sqrt{\left(c \cdot c\right) \cdot s}\right)} \cdot \sqrt{s}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}}
\] |
sqrt-prod [=>]17.1 | \[ \frac{1}{\left(\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \sqrt{\left(c \cdot c\right) \cdot s}\right) \cdot \sqrt{s}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}}
\] |
add-sqr-sqrt [<=]32.2 | \[ \frac{1}{\left(\color{blue}{x} \cdot \sqrt{\left(c \cdot c\right) \cdot s}\right) \cdot \sqrt{s}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}}
\] |
sqrt-prod [=>]32.2 | \[ \frac{1}{\left(x \cdot \color{blue}{\left(\sqrt{c \cdot c} \cdot \sqrt{s}\right)}\right) \cdot \sqrt{s}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}}
\] |
sqrt-prod [=>]0.0 | \[ \frac{1}{\left(x \cdot \left(\color{blue}{\left(\sqrt{c} \cdot \sqrt{c}\right)} \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}}
\] |
add-sqr-sqrt [<=]32.2 | \[ \frac{1}{\left(x \cdot \left(\color{blue}{c} \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}}
\] |
Simplified96.5%
[Start]49.9 | \[ \frac{1}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}} \cdot \frac{\cos \left(x + x\right)}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
|---|---|
associate-*l/ [=>]49.9 | \[ \color{blue}{\frac{1 \cdot \frac{\cos \left(x + x\right)}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}}
\] |
*-lft-identity [=>]49.9 | \[ \frac{\color{blue}{\frac{\cos \left(x + x\right)}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
associate-*l* [=>]49.1 | \[ \frac{\frac{\cos \left(x + x\right)}{\color{blue}{x \cdot \left(\left(c \cdot \sqrt{s}\right) \cdot \sqrt{s}\right)}}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
associate-*l* [=>]49.1 | \[ \frac{\frac{\cos \left(x + x\right)}{x \cdot \color{blue}{\left(c \cdot \left(\sqrt{s} \cdot \sqrt{s}\right)\right)}}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
rem-square-sqrt [=>]49.2 | \[ \frac{\frac{\cos \left(x + x\right)}{x \cdot \left(c \cdot \color{blue}{s}\right)}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
*-commutative [=>]49.2 | \[ \frac{\frac{\cos \left(x + x\right)}{x \cdot \color{blue}{\left(s \cdot c\right)}}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
associate-*l* [=>]49.2 | \[ \frac{\frac{\cos \left(x + x\right)}{x \cdot \left(s \cdot c\right)}}{\color{blue}{x \cdot \left(\left(c \cdot \sqrt{s}\right) \cdot \sqrt{s}\right)}}
\] |
associate-*l* [=>]49.2 | \[ \frac{\frac{\cos \left(x + x\right)}{x \cdot \left(s \cdot c\right)}}{x \cdot \color{blue}{\left(c \cdot \left(\sqrt{s} \cdot \sqrt{s}\right)\right)}}
\] |
rem-square-sqrt [=>]96.5 | \[ \frac{\frac{\cos \left(x + x\right)}{x \cdot \left(s \cdot c\right)}}{x \cdot \left(c \cdot \color{blue}{s}\right)}
\] |
*-commutative [=>]96.5 | \[ \frac{\frac{\cos \left(x + x\right)}{x \cdot \left(s \cdot c\right)}}{x \cdot \color{blue}{\left(s \cdot c\right)}}
\] |
Taylor expanded in x around 0 88.7%
Applied egg-rr96.5%
[Start]88.7 | \[ \frac{\frac{\cos \left(x + x\right)}{c \cdot \left(s \cdot x\right)}}{x \cdot \left(s \cdot c\right)}
\] |
|---|---|
div-inv [=>]88.7 | \[ \color{blue}{\frac{\cos \left(x + x\right)}{c \cdot \left(s \cdot x\right)} \cdot \frac{1}{x \cdot \left(s \cdot c\right)}}
\] |
*-commutative [=>]88.7 | \[ \color{blue}{\frac{1}{x \cdot \left(s \cdot c\right)} \cdot \frac{\cos \left(x + x\right)}{c \cdot \left(s \cdot x\right)}}
\] |
associate-/r* [=>]88.7 | \[ \color{blue}{\frac{\frac{1}{x}}{s \cdot c}} \cdot \frac{\cos \left(x + x\right)}{c \cdot \left(s \cdot x\right)}
\] |
*-commutative [=>]88.7 | \[ \frac{\frac{1}{x}}{\color{blue}{c \cdot s}} \cdot \frac{\cos \left(x + x\right)}{c \cdot \left(s \cdot x\right)}
\] |
associate-*r* [=>]96.5 | \[ \frac{\frac{1}{x}}{c \cdot s} \cdot \frac{\cos \left(x + x\right)}{\color{blue}{\left(c \cdot s\right) \cdot x}}
\] |
*-commutative [<=]96.5 | \[ \frac{\frac{1}{x}}{c \cdot s} \cdot \frac{\cos \left(x + x\right)}{\color{blue}{\left(s \cdot c\right)} \cdot x}
\] |
*-commutative [<=]96.5 | \[ \frac{\frac{1}{x}}{c \cdot s} \cdot \frac{\cos \left(x + x\right)}{\color{blue}{x \cdot \left(s \cdot c\right)}}
\] |
*-commutative [=>]96.5 | \[ \frac{\frac{1}{x}}{c \cdot s} \cdot \frac{\cos \left(x + x\right)}{x \cdot \color{blue}{\left(c \cdot s\right)}}
\] |
if -6.00000000000000048e220 < c < -6.5999999999999995e-200 or 8.9999999999999992e-124 < c Initial program 62.8%
Simplified66.0%
[Start]62.8 | \[ \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}
\] |
|---|---|
*-commutative [=>]62.8 | \[ \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\color{blue}{\left({s}^{2} \cdot x\right)} \cdot x\right)}
\] |
associate-*l* [=>]56.8 | \[ \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left({s}^{2} \cdot \left(x \cdot x\right)\right)}}
\] |
associate-*r* [=>]57.1 | \[ \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot {s}^{2}\right) \cdot \left(x \cdot x\right)}}
\] |
*-commutative [=>]57.1 | \[ \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(x \cdot x\right) \cdot \left({c}^{2} \cdot {s}^{2}\right)}}
\] |
unpow2 [=>]57.1 | \[ \frac{\cos \left(2 \cdot x\right)}{\left(x \cdot x\right) \cdot \left({c}^{2} \cdot \color{blue}{\left(s \cdot s\right)}\right)}
\] |
associate-*r* [=>]62.8 | \[ \frac{\cos \left(2 \cdot x\right)}{\left(x \cdot x\right) \cdot \color{blue}{\left(\left({c}^{2} \cdot s\right) \cdot s\right)}}
\] |
associate-*r* [=>]66.0 | \[ \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left(x \cdot x\right) \cdot \left({c}^{2} \cdot s\right)\right) \cdot s}}
\] |
*-commutative [=>]66.0 | \[ \frac{\cos \left(2 \cdot x\right)}{\color{blue}{s \cdot \left(\left(x \cdot x\right) \cdot \left({c}^{2} \cdot s\right)\right)}}
\] |
unpow2 [=>]66.0 | \[ \frac{\cos \left(2 \cdot x\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \left(\color{blue}{\left(c \cdot c\right)} \cdot s\right)\right)}
\] |
Applied egg-rr75.1%
[Start]66.0 | \[ \frac{\cos \left(2 \cdot x\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}
\] |
|---|---|
*-un-lft-identity [=>]66.0 | \[ \frac{\color{blue}{1 \cdot \cos \left(2 \cdot x\right)}}{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}
\] |
add-sqr-sqrt [=>]66.0 | \[ \frac{1 \cdot \cos \left(2 \cdot x\right)}{\color{blue}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)} \cdot \sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}}}
\] |
times-frac [=>]66.0 | \[ \color{blue}{\frac{1}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}}}
\] |
*-commutative [=>]66.0 | \[ \frac{1}{\sqrt{\color{blue}{\left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right) \cdot s}}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}}
\] |
sqrt-prod [=>]50.9 | \[ \frac{1}{\color{blue}{\sqrt{\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)} \cdot \sqrt{s}}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}}
\] |
sqrt-prod [=>]50.9 | \[ \frac{1}{\color{blue}{\left(\sqrt{x \cdot x} \cdot \sqrt{\left(c \cdot c\right) \cdot s}\right)} \cdot \sqrt{s}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}}
\] |
sqrt-prod [=>]24.9 | \[ \frac{1}{\left(\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \sqrt{\left(c \cdot c\right) \cdot s}\right) \cdot \sqrt{s}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}}
\] |
add-sqr-sqrt [<=]42.7 | \[ \frac{1}{\left(\color{blue}{x} \cdot \sqrt{\left(c \cdot c\right) \cdot s}\right) \cdot \sqrt{s}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}}
\] |
sqrt-prod [=>]42.7 | \[ \frac{1}{\left(x \cdot \color{blue}{\left(\sqrt{c \cdot c} \cdot \sqrt{s}\right)}\right) \cdot \sqrt{s}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}}
\] |
sqrt-prod [=>]16.0 | \[ \frac{1}{\left(x \cdot \left(\color{blue}{\left(\sqrt{c} \cdot \sqrt{c}\right)} \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}}
\] |
add-sqr-sqrt [<=]43.2 | \[ \frac{1}{\left(x \cdot \left(\color{blue}{c} \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}}
\] |
Simplified96.0%
[Start]75.1 | \[ \frac{1}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}} \cdot \frac{\cos \left(x + x\right)}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
|---|---|
associate-*l/ [=>]75.1 | \[ \color{blue}{\frac{1 \cdot \frac{\cos \left(x + x\right)}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}}
\] |
*-lft-identity [=>]75.1 | \[ \frac{\color{blue}{\frac{\cos \left(x + x\right)}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
associate-*l* [=>]72.6 | \[ \frac{\frac{\cos \left(x + x\right)}{\color{blue}{x \cdot \left(\left(c \cdot \sqrt{s}\right) \cdot \sqrt{s}\right)}}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
associate-*l* [=>]72.7 | \[ \frac{\frac{\cos \left(x + x\right)}{x \cdot \color{blue}{\left(c \cdot \left(\sqrt{s} \cdot \sqrt{s}\right)\right)}}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
rem-square-sqrt [=>]72.8 | \[ \frac{\frac{\cos \left(x + x\right)}{x \cdot \left(c \cdot \color{blue}{s}\right)}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
*-commutative [=>]72.8 | \[ \frac{\frac{\cos \left(x + x\right)}{x \cdot \color{blue}{\left(s \cdot c\right)}}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
associate-*l* [=>]72.8 | \[ \frac{\frac{\cos \left(x + x\right)}{x \cdot \left(s \cdot c\right)}}{\color{blue}{x \cdot \left(\left(c \cdot \sqrt{s}\right) \cdot \sqrt{s}\right)}}
\] |
associate-*l* [=>]72.8 | \[ \frac{\frac{\cos \left(x + x\right)}{x \cdot \left(s \cdot c\right)}}{x \cdot \color{blue}{\left(c \cdot \left(\sqrt{s} \cdot \sqrt{s}\right)\right)}}
\] |
rem-square-sqrt [=>]96.0 | \[ \frac{\frac{\cos \left(x + x\right)}{x \cdot \left(s \cdot c\right)}}{x \cdot \left(c \cdot \color{blue}{s}\right)}
\] |
*-commutative [=>]96.0 | \[ \frac{\frac{\cos \left(x + x\right)}{x \cdot \left(s \cdot c\right)}}{x \cdot \color{blue}{\left(s \cdot c\right)}}
\] |
Applied egg-rr95.4%
[Start]96.0 | \[ \frac{\frac{\cos \left(x + x\right)}{x \cdot \left(s \cdot c\right)}}{x \cdot \left(s \cdot c\right)}
\] |
|---|---|
frac-2neg [=>]96.0 | \[ \color{blue}{\frac{-\frac{\cos \left(x + x\right)}{x \cdot \left(s \cdot c\right)}}{-x \cdot \left(s \cdot c\right)}}
\] |
div-inv [=>]96.0 | \[ \color{blue}{\left(-\frac{\cos \left(x + x\right)}{x \cdot \left(s \cdot c\right)}\right) \cdot \frac{1}{-x \cdot \left(s \cdot c\right)}}
\] |
associate-*r* [=>]95.4 | \[ \left(-\frac{\cos \left(x + x\right)}{x \cdot \left(s \cdot c\right)}\right) \cdot \frac{1}{-\color{blue}{\left(x \cdot s\right) \cdot c}}
\] |
distribute-rgt-neg-in [=>]95.4 | \[ \left(-\frac{\cos \left(x + x\right)}{x \cdot \left(s \cdot c\right)}\right) \cdot \frac{1}{\color{blue}{\left(x \cdot s\right) \cdot \left(-c\right)}}
\] |
Simplified98.6%
[Start]95.4 | \[ \left(-\frac{\cos \left(x + x\right)}{x \cdot \left(s \cdot c\right)}\right) \cdot \frac{1}{\left(x \cdot s\right) \cdot \left(-c\right)}
\] |
|---|---|
*-commutative [=>]95.4 | \[ \color{blue}{\frac{1}{\left(x \cdot s\right) \cdot \left(-c\right)} \cdot \left(-\frac{\cos \left(x + x\right)}{x \cdot \left(s \cdot c\right)}\right)}
\] |
associate-/r* [=>]95.3 | \[ \color{blue}{\frac{\frac{1}{x \cdot s}}{-c}} \cdot \left(-\frac{\cos \left(x + x\right)}{x \cdot \left(s \cdot c\right)}\right)
\] |
associate-/r* [=>]95.4 | \[ \frac{\color{blue}{\frac{\frac{1}{x}}{s}}}{-c} \cdot \left(-\frac{\cos \left(x + x\right)}{x \cdot \left(s \cdot c\right)}\right)
\] |
distribute-neg-frac [=>]95.4 | \[ \frac{\frac{\frac{1}{x}}{s}}{-c} \cdot \color{blue}{\frac{-\cos \left(x + x\right)}{x \cdot \left(s \cdot c\right)}}
\] |
count-2 [=>]95.4 | \[ \frac{\frac{\frac{1}{x}}{s}}{-c} \cdot \frac{-\cos \color{blue}{\left(2 \cdot x\right)}}{x \cdot \left(s \cdot c\right)}
\] |
metadata-eval [<=]95.4 | \[ \frac{\frac{\frac{1}{x}}{s}}{-c} \cdot \frac{-\cos \left(\color{blue}{\left(--2\right)} \cdot x\right)}{x \cdot \left(s \cdot c\right)}
\] |
distribute-lft-neg-in [<=]95.4 | \[ \frac{\frac{\frac{1}{x}}{s}}{-c} \cdot \frac{-\cos \color{blue}{\left(--2 \cdot x\right)}}{x \cdot \left(s \cdot c\right)}
\] |
cos-neg [=>]95.4 | \[ \frac{\frac{\frac{1}{x}}{s}}{-c} \cdot \frac{-\color{blue}{\cos \left(-2 \cdot x\right)}}{x \cdot \left(s \cdot c\right)}
\] |
*-commutative [=>]95.4 | \[ \frac{\frac{\frac{1}{x}}{s}}{-c} \cdot \frac{-\cos \color{blue}{\left(x \cdot -2\right)}}{x \cdot \left(s \cdot c\right)}
\] |
*-commutative [=>]95.4 | \[ \frac{\frac{\frac{1}{x}}{s}}{-c} \cdot \frac{-\cos \left(x \cdot -2\right)}{\color{blue}{\left(s \cdot c\right) \cdot x}}
\] |
*-commutative [=>]95.4 | \[ \frac{\frac{\frac{1}{x}}{s}}{-c} \cdot \frac{-\cos \left(x \cdot -2\right)}{\color{blue}{\left(c \cdot s\right)} \cdot x}
\] |
associate-*r* [<=]98.6 | \[ \frac{\frac{\frac{1}{x}}{s}}{-c} \cdot \frac{-\cos \left(x \cdot -2\right)}{\color{blue}{c \cdot \left(s \cdot x\right)}}
\] |
if -6.5999999999999995e-200 < c < 8.9999999999999992e-124Initial program 7.9%
Simplified10.2%
[Start]7.9 | \[ \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}
\] |
|---|---|
*-commutative [=>]7.9 | \[ \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\color{blue}{\left({s}^{2} \cdot x\right)} \cdot x\right)}
\] |
associate-*l* [=>]6.8 | \[ \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left({s}^{2} \cdot \left(x \cdot x\right)\right)}}
\] |
associate-*r* [=>]7.2 | \[ \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({c}^{2} \cdot {s}^{2}\right) \cdot \left(x \cdot x\right)}}
\] |
*-commutative [=>]7.2 | \[ \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(x \cdot x\right) \cdot \left({c}^{2} \cdot {s}^{2}\right)}}
\] |
unpow2 [=>]7.2 | \[ \frac{\cos \left(2 \cdot x\right)}{\left(x \cdot x\right) \cdot \left({c}^{2} \cdot \color{blue}{\left(s \cdot s\right)}\right)}
\] |
associate-*r* [=>]10.4 | \[ \frac{\cos \left(2 \cdot x\right)}{\left(x \cdot x\right) \cdot \color{blue}{\left(\left({c}^{2} \cdot s\right) \cdot s\right)}}
\] |
associate-*r* [=>]10.2 | \[ \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left(x \cdot x\right) \cdot \left({c}^{2} \cdot s\right)\right) \cdot s}}
\] |
*-commutative [=>]10.2 | \[ \frac{\cos \left(2 \cdot x\right)}{\color{blue}{s \cdot \left(\left(x \cdot x\right) \cdot \left({c}^{2} \cdot s\right)\right)}}
\] |
unpow2 [=>]10.2 | \[ \frac{\cos \left(2 \cdot x\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \left(\color{blue}{\left(c \cdot c\right)} \cdot s\right)\right)}
\] |
Applied egg-rr37.8%
[Start]10.2 | \[ \frac{\cos \left(2 \cdot x\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot s\right)\right)}
\] |
|---|---|
add-log-exp [=>]1.0 | \[ \frac{\cos \left(2 \cdot x\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\log \left(e^{\left(c \cdot c\right) \cdot s}\right)}\right)}
\] |
*-un-lft-identity [=>]1.0 | \[ \frac{\cos \left(2 \cdot x\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \log \color{blue}{\left(1 \cdot e^{\left(c \cdot c\right) \cdot s}\right)}\right)}
\] |
log-prod [=>]1.0 | \[ \frac{\cos \left(2 \cdot x\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(\log 1 + \log \left(e^{\left(c \cdot c\right) \cdot s}\right)\right)}\right)}
\] |
metadata-eval [=>]1.0 | \[ \frac{\cos \left(2 \cdot x\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \left(\color{blue}{0} + \log \left(e^{\left(c \cdot c\right) \cdot s}\right)\right)\right)}
\] |
add-log-exp [<=]10.2 | \[ \frac{\cos \left(2 \cdot x\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \left(0 + \color{blue}{\left(c \cdot c\right) \cdot s}\right)\right)}
\] |
associate-*l* [=>]37.8 | \[ \frac{\cos \left(2 \cdot x\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \left(0 + \color{blue}{c \cdot \left(c \cdot s\right)}\right)\right)}
\] |
Applied egg-rr96.5%
[Start]37.8 | \[ \frac{\cos \left(2 \cdot x\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \left(0 + c \cdot \left(c \cdot s\right)\right)\right)}
\] |
|---|---|
*-un-lft-identity [=>]37.8 | \[ \frac{\color{blue}{1 \cdot \cos \left(2 \cdot x\right)}}{s \cdot \left(\left(x \cdot x\right) \cdot \left(0 + c \cdot \left(c \cdot s\right)\right)\right)}
\] |
add-sqr-sqrt [=>]37.7 | \[ \frac{1 \cdot \cos \left(2 \cdot x\right)}{\color{blue}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(0 + c \cdot \left(c \cdot s\right)\right)\right)} \cdot \sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(0 + c \cdot \left(c \cdot s\right)\right)\right)}}}
\] |
times-frac [=>]37.7 | \[ \color{blue}{\frac{1}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(0 + c \cdot \left(c \cdot s\right)\right)\right)}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt{s \cdot \left(\left(x \cdot x\right) \cdot \left(0 + c \cdot \left(c \cdot s\right)\right)\right)}}}
\] |
Simplified93.7%
[Start]96.5 | \[ \frac{1}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}} \cdot \frac{\cos \left(x + x\right)}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
|---|---|
associate-*l/ [=>]96.5 | \[ \color{blue}{\frac{1 \cdot \frac{\cos \left(x + x\right)}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}}
\] |
*-lft-identity [=>]96.5 | \[ \frac{\color{blue}{\frac{\cos \left(x + x\right)}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
associate-*r* [=>]91.2 | \[ \frac{\frac{\cos \left(x + x\right)}{\color{blue}{\left(\left(x \cdot c\right) \cdot \sqrt{s}\right)} \cdot \sqrt{s}}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
associate-*l* [=>]91.2 | \[ \frac{\frac{\cos \left(x + x\right)}{\color{blue}{\left(x \cdot c\right) \cdot \left(\sqrt{s} \cdot \sqrt{s}\right)}}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
unpow1/2 [<=]91.2 | \[ \frac{\frac{\cos \left(x + x\right)}{\left(x \cdot c\right) \cdot \left(\color{blue}{{s}^{0.5}} \cdot \sqrt{s}\right)}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
metadata-eval [<=]91.2 | \[ \frac{\frac{\cos \left(x + x\right)}{\left(x \cdot c\right) \cdot \left({s}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot \sqrt{s}\right)}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
unpow1/2 [<=]91.2 | \[ \frac{\frac{\cos \left(x + x\right)}{\left(x \cdot c\right) \cdot \left({s}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{s}^{0.5}}\right)}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
metadata-eval [<=]91.2 | \[ \frac{\frac{\cos \left(x + x\right)}{\left(x \cdot c\right) \cdot \left({s}^{\left(\frac{1}{2}\right)} \cdot {s}^{\color{blue}{\left(\frac{1}{2}\right)}}\right)}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
sqr-pow [<=]91.5 | \[ \frac{\frac{\cos \left(x + x\right)}{\left(x \cdot c\right) \cdot \color{blue}{{s}^{1}}}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
unpow1 [=>]91.5 | \[ \frac{\frac{\cos \left(x + x\right)}{\left(x \cdot c\right) \cdot \color{blue}{s}}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
associate-*r* [<=]93.2 | \[ \frac{\frac{\cos \left(x + x\right)}{\color{blue}{x \cdot \left(c \cdot s\right)}}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
*-commutative [<=]93.2 | \[ \frac{\frac{\cos \left(x + x\right)}{\color{blue}{\left(c \cdot s\right) \cdot x}}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
*-commutative [=>]93.2 | \[ \frac{\frac{\cos \left(x + x\right)}{\color{blue}{\left(s \cdot c\right)} \cdot x}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
associate-*l* [=>]91.5 | \[ \frac{\frac{\cos \left(x + x\right)}{\color{blue}{s \cdot \left(c \cdot x\right)}}}{\left(x \cdot \left(c \cdot \sqrt{s}\right)\right) \cdot \sqrt{s}}
\] |
associate-*r* [=>]93.4 | \[ \frac{\frac{\cos \left(x + x\right)}{s \cdot \left(c \cdot x\right)}}{\color{blue}{\left(\left(x \cdot c\right) \cdot \sqrt{s}\right)} \cdot \sqrt{s}}
\] |
associate-*l* [=>]93.3 | \[ \frac{\frac{\cos \left(x + x\right)}{s \cdot \left(c \cdot x\right)}}{\color{blue}{\left(x \cdot c\right) \cdot \left(\sqrt{s} \cdot \sqrt{s}\right)}}
\] |
Final simplification97.5%
| Alternative 1 | |
|---|---|
| Accuracy | 97.6% |
| Cost | 7757 |
| Alternative 2 | |
|---|---|
| Accuracy | 97.6% |
| Cost | 7757 |
| Alternative 3 | |
|---|---|
| Accuracy | 85.2% |
| Cost | 7625 |
| Alternative 4 | |
|---|---|
| Accuracy | 93.6% |
| Cost | 7625 |
| Alternative 5 | |
|---|---|
| Accuracy | 96.5% |
| Cost | 7624 |
| Alternative 6 | |
|---|---|
| Accuracy | 95.8% |
| Cost | 7360 |
| Alternative 7 | |
|---|---|
| Accuracy | 69.4% |
| Cost | 1097 |
| Alternative 8 | |
|---|---|
| Accuracy | 73.8% |
| Cost | 1097 |
| Alternative 9 | |
|---|---|
| Accuracy | 75.2% |
| Cost | 964 |
| Alternative 10 | |
|---|---|
| Accuracy | 74.1% |
| Cost | 964 |
| Alternative 11 | |
|---|---|
| Accuracy | 74.2% |
| Cost | 964 |
| Alternative 12 | |
|---|---|
| Accuracy | 74.3% |
| Cost | 964 |
| Alternative 13 | |
|---|---|
| Accuracy | 39.2% |
| Cost | 832 |
| Alternative 14 | |
|---|---|
| Accuracy | 44.5% |
| Cost | 832 |
| Alternative 15 | |
|---|---|
| Accuracy | 58.3% |
| Cost | 832 |
herbie shell --seed 2023146
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))