
(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 15 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}
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (* (/ (/ 1.0 s) (* c x)) (/ (cos (* x 2.0)) (* s (* c x)))))
assert(c < s);
double code(double x, double c, double s) {
return ((1.0 / s) / (c * x)) * (cos((x * 2.0)) / (s * (c * x)));
}
NOTE: c and s should be sorted in increasing order before calling this function.
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 / s) / (c * x)) * (cos((x * 2.0d0)) / (s * (c * x)))
end function
assert c < s;
public static double code(double x, double c, double s) {
return ((1.0 / s) / (c * x)) * (Math.cos((x * 2.0)) / (s * (c * x)));
}
[c, s] = sort([c, s]) def code(x, c, s): return ((1.0 / s) / (c * x)) * (math.cos((x * 2.0)) / (s * (c * x)))
c, s = sort([c, s]) function code(x, c, s) return Float64(Float64(Float64(1.0 / s) / Float64(c * x)) * Float64(cos(Float64(x * 2.0)) / Float64(s * Float64(c * x)))) end
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = ((1.0 / s) / (c * x)) * (cos((x * 2.0)) / (s * (c * x)));
end
NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[(N[(N[(1.0 / s), $MachinePrecision] / N[(c * x), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(s * N[(c * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{\frac{1}{s}}{c \cdot x} \cdot \frac{\cos \left(x \cdot 2\right)}{s \cdot \left(c \cdot x\right)}
\end{array}
Initial program 64.8%
associate-/r*64.9%
remove-double-neg64.9%
distribute-lft-neg-out64.9%
distribute-lft-neg-out64.9%
distribute-rgt-neg-out64.9%
associate-/l/64.8%
distribute-rgt-neg-out64.8%
distribute-lft-neg-out64.8%
associate-*l*66.6%
distribute-lft-neg-in66.6%
distribute-lft-neg-out66.6%
remove-double-neg66.6%
associate-*r*66.5%
*-commutative66.5%
associate-*r*65.6%
Simplified71.7%
Taylor expanded in x around 0 57.9%
unpow257.9%
associate-*r*57.9%
unpow257.9%
unpow257.9%
swap-sqr71.6%
swap-sqr95.2%
*-commutative95.2%
*-commutative95.2%
unpow295.2%
*-commutative95.2%
*-commutative95.2%
associate-*l*97.0%
Simplified97.0%
unpow297.0%
Applied egg-rr97.0%
*-un-lft-identity97.0%
times-frac97.0%
associate-/r*97.1%
*-commutative97.1%
Applied egg-rr97.1%
Final simplification97.1%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (if (<= s 3.1e+158) (/ (cos (* x 2.0)) (* c (* x (* c (* s (* s x)))))) (/ 1.0 (pow (* c (* s x)) 2.0))))
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (s <= 3.1e+158) {
tmp = cos((x * 2.0)) / (c * (x * (c * (s * (s * x)))));
} else {
tmp = 1.0 / pow((c * (s * x)), 2.0);
}
return tmp;
}
NOTE: c and s should be sorted in increasing order before calling this 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) :: tmp
if (s <= 3.1d+158) then
tmp = cos((x * 2.0d0)) / (c * (x * (c * (s * (s * x)))))
else
tmp = 1.0d0 / ((c * (s * x)) ** 2.0d0)
end if
code = tmp
end function
assert c < s;
public static double code(double x, double c, double s) {
double tmp;
if (s <= 3.1e+158) {
tmp = Math.cos((x * 2.0)) / (c * (x * (c * (s * (s * x)))));
} else {
tmp = 1.0 / Math.pow((c * (s * x)), 2.0);
}
return tmp;
}
[c, s] = sort([c, s]) def code(x, c, s): tmp = 0 if s <= 3.1e+158: tmp = math.cos((x * 2.0)) / (c * (x * (c * (s * (s * x))))) else: tmp = 1.0 / math.pow((c * (s * x)), 2.0) return tmp
c, s = sort([c, s]) function code(x, c, s) tmp = 0.0 if (s <= 3.1e+158) tmp = Float64(cos(Float64(x * 2.0)) / Float64(c * Float64(x * Float64(c * Float64(s * Float64(s * x)))))); else tmp = Float64(1.0 / (Float64(c * Float64(s * x)) ^ 2.0)); end return tmp end
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
tmp = 0.0;
if (s <= 3.1e+158)
tmp = cos((x * 2.0)) / (c * (x * (c * (s * (s * x)))));
else
tmp = 1.0 / ((c * (s * x)) ^ 2.0);
end
tmp_2 = tmp;
end
NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := If[LessEqual[s, 3.1e+158], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(c * N[(x * N[(c * N[(s * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Power[N[(c * N[(s * x), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;s \leq 3.1 \cdot 10^{+158}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{c \cdot \left(x \cdot \left(c \cdot \left(s \cdot \left(s \cdot x\right)\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{\left(c \cdot \left(s \cdot x\right)\right)}^{2}}\\
\end{array}
\end{array}
if s < 3.1000000000000002e158Initial program 67.3%
associate-/r*67.4%
remove-double-neg67.4%
distribute-lft-neg-out67.4%
distribute-lft-neg-out67.4%
distribute-rgt-neg-out67.4%
associate-/l/67.3%
distribute-rgt-neg-out67.3%
distribute-lft-neg-out67.3%
associate-*l*69.5%
distribute-lft-neg-in69.5%
distribute-lft-neg-out69.5%
remove-double-neg69.5%
associate-*r*69.3%
*-commutative69.3%
associate-*r*68.3%
Simplified74.3%
Taylor expanded in x around 0 61.3%
unpow261.3%
associate-*r*61.3%
unpow261.3%
unpow261.3%
swap-sqr71.3%
swap-sqr95.7%
*-commutative95.7%
*-commutative95.7%
unpow295.7%
*-commutative95.7%
*-commutative95.7%
associate-*l*96.9%
Simplified96.9%
unpow296.9%
associate-*r*94.2%
associate-*r*95.7%
swap-sqr71.3%
unswap-sqr61.3%
*-commutative61.3%
associate-*l*68.3%
associate-*r*68.8%
associate-*l*76.6%
associate-*l*78.2%
associate-*l*84.9%
Applied egg-rr84.9%
if 3.1000000000000002e158 < s Initial program 48.3%
associate-/r*48.3%
remove-double-neg48.3%
distribute-lft-neg-out48.3%
distribute-lft-neg-out48.3%
distribute-rgt-neg-out48.3%
associate-/l/48.3%
distribute-rgt-neg-out48.3%
distribute-lft-neg-out48.3%
associate-*l*48.2%
distribute-lft-neg-in48.2%
distribute-lft-neg-out48.2%
remove-double-neg48.2%
associate-*r*48.2%
*-commutative48.2%
associate-*r*48.3%
Simplified54.9%
Taylor expanded in x around 0 35.6%
unpow235.6%
associate-*r*35.6%
unpow235.6%
unpow235.6%
swap-sqr73.3%
swap-sqr91.8%
*-commutative91.8%
*-commutative91.8%
unpow291.8%
*-commutative91.8%
*-commutative91.8%
associate-*l*97.5%
Simplified97.5%
Taylor expanded in x around 0 35.5%
unpow235.5%
associate-/r*35.5%
unpow235.5%
unpow235.5%
swap-sqr54.1%
unpow254.1%
associate-/r*54.1%
unpow254.1%
swap-sqr91.9%
unpow291.9%
associate-*r*86.2%
*-commutative86.2%
associate-*r*94.2%
Simplified94.2%
Final simplification86.1%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (if (<= s 1.25e+158) (/ (cos (* x 2.0)) (* (* c x) (* c (* s (* s x))))) (/ 1.0 (pow (* c (* s x)) 2.0))))
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (s <= 1.25e+158) {
tmp = cos((x * 2.0)) / ((c * x) * (c * (s * (s * x))));
} else {
tmp = 1.0 / pow((c * (s * x)), 2.0);
}
return tmp;
}
NOTE: c and s should be sorted in increasing order before calling this 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) :: tmp
if (s <= 1.25d+158) then
tmp = cos((x * 2.0d0)) / ((c * x) * (c * (s * (s * x))))
else
tmp = 1.0d0 / ((c * (s * x)) ** 2.0d0)
end if
code = tmp
end function
assert c < s;
public static double code(double x, double c, double s) {
double tmp;
if (s <= 1.25e+158) {
tmp = Math.cos((x * 2.0)) / ((c * x) * (c * (s * (s * x))));
} else {
tmp = 1.0 / Math.pow((c * (s * x)), 2.0);
}
return tmp;
}
[c, s] = sort([c, s]) def code(x, c, s): tmp = 0 if s <= 1.25e+158: tmp = math.cos((x * 2.0)) / ((c * x) * (c * (s * (s * x)))) else: tmp = 1.0 / math.pow((c * (s * x)), 2.0) return tmp
c, s = sort([c, s]) function code(x, c, s) tmp = 0.0 if (s <= 1.25e+158) tmp = Float64(cos(Float64(x * 2.0)) / Float64(Float64(c * x) * Float64(c * Float64(s * Float64(s * x))))); else tmp = Float64(1.0 / (Float64(c * Float64(s * x)) ^ 2.0)); end return tmp end
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
tmp = 0.0;
if (s <= 1.25e+158)
tmp = cos((x * 2.0)) / ((c * x) * (c * (s * (s * x))));
else
tmp = 1.0 / ((c * (s * x)) ^ 2.0);
end
tmp_2 = tmp;
end
NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := If[LessEqual[s, 1.25e+158], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(N[(c * x), $MachinePrecision] * N[(c * N[(s * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Power[N[(c * N[(s * x), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;s \leq 1.25 \cdot 10^{+158}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{\left(c \cdot x\right) \cdot \left(c \cdot \left(s \cdot \left(s \cdot x\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{\left(c \cdot \left(s \cdot x\right)\right)}^{2}}\\
\end{array}
\end{array}
if s < 1.2499999999999999e158Initial program 67.3%
associate-/r*67.4%
remove-double-neg67.4%
distribute-lft-neg-out67.4%
distribute-lft-neg-out67.4%
distribute-rgt-neg-out67.4%
associate-/l/67.3%
distribute-rgt-neg-out67.3%
distribute-lft-neg-out67.3%
associate-*l*69.5%
distribute-lft-neg-in69.5%
distribute-lft-neg-out69.5%
remove-double-neg69.5%
associate-*r*69.3%
*-commutative69.3%
associate-*r*68.3%
Simplified74.3%
Taylor expanded in x around 0 61.3%
unpow261.3%
associate-*r*61.3%
unpow261.3%
unpow261.3%
swap-sqr71.3%
swap-sqr95.7%
*-commutative95.7%
*-commutative95.7%
unpow295.7%
*-commutative95.7%
*-commutative95.7%
associate-*l*96.9%
Simplified96.9%
unpow296.9%
swap-sqr76.2%
*-commutative76.2%
associate-*r*74.3%
*-commutative74.3%
associate-*r*67.1%
associate-*r*69.5%
*-commutative69.5%
associate-*r*68.8%
associate-*l*76.6%
associate-*r*80.0%
*-commutative80.0%
associate-*l*85.9%
Applied egg-rr85.9%
if 1.2499999999999999e158 < s Initial program 48.3%
associate-/r*48.3%
remove-double-neg48.3%
distribute-lft-neg-out48.3%
distribute-lft-neg-out48.3%
distribute-rgt-neg-out48.3%
associate-/l/48.3%
distribute-rgt-neg-out48.3%
distribute-lft-neg-out48.3%
associate-*l*48.2%
distribute-lft-neg-in48.2%
distribute-lft-neg-out48.2%
remove-double-neg48.2%
associate-*r*48.2%
*-commutative48.2%
associate-*r*48.3%
Simplified54.9%
Taylor expanded in x around 0 35.6%
unpow235.6%
associate-*r*35.6%
unpow235.6%
unpow235.6%
swap-sqr73.3%
swap-sqr91.8%
*-commutative91.8%
*-commutative91.8%
unpow291.8%
*-commutative91.8%
*-commutative91.8%
associate-*l*97.5%
Simplified97.5%
Taylor expanded in x around 0 35.5%
unpow235.5%
associate-/r*35.5%
unpow235.5%
unpow235.5%
swap-sqr54.1%
unpow254.1%
associate-/r*54.1%
unpow254.1%
swap-sqr91.9%
unpow291.9%
associate-*r*86.2%
*-commutative86.2%
associate-*r*94.2%
Simplified94.2%
Final simplification87.0%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (if (<= x 1.5e-147) (/ 1.0 (pow (* c (* s x)) 2.0)) (/ (cos (* x 2.0)) (* (* s c) (* x (* s (* c x)))))))
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (x <= 1.5e-147) {
tmp = 1.0 / pow((c * (s * x)), 2.0);
} else {
tmp = cos((x * 2.0)) / ((s * c) * (x * (s * (c * x))));
}
return tmp;
}
NOTE: c and s should be sorted in increasing order before calling this 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) :: tmp
if (x <= 1.5d-147) then
tmp = 1.0d0 / ((c * (s * x)) ** 2.0d0)
else
tmp = cos((x * 2.0d0)) / ((s * c) * (x * (s * (c * x))))
end if
code = tmp
end function
assert c < s;
public static double code(double x, double c, double s) {
double tmp;
if (x <= 1.5e-147) {
tmp = 1.0 / Math.pow((c * (s * x)), 2.0);
} else {
tmp = Math.cos((x * 2.0)) / ((s * c) * (x * (s * (c * x))));
}
return tmp;
}
[c, s] = sort([c, s]) def code(x, c, s): tmp = 0 if x <= 1.5e-147: tmp = 1.0 / math.pow((c * (s * x)), 2.0) else: tmp = math.cos((x * 2.0)) / ((s * c) * (x * (s * (c * x)))) return tmp
c, s = sort([c, s]) function code(x, c, s) tmp = 0.0 if (x <= 1.5e-147) tmp = Float64(1.0 / (Float64(c * Float64(s * x)) ^ 2.0)); else tmp = Float64(cos(Float64(x * 2.0)) / Float64(Float64(s * c) * Float64(x * Float64(s * Float64(c * x))))); end return tmp end
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
tmp = 0.0;
if (x <= 1.5e-147)
tmp = 1.0 / ((c * (s * x)) ^ 2.0);
else
tmp = cos((x * 2.0)) / ((s * c) * (x * (s * (c * x))));
end
tmp_2 = tmp;
end
NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := If[LessEqual[x, 1.5e-147], N[(1.0 / N[Power[N[(c * N[(s * x), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(N[(s * c), $MachinePrecision] * N[(x * N[(s * N[(c * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.5 \cdot 10^{-147}:\\
\;\;\;\;\frac{1}{{\left(c \cdot \left(s \cdot x\right)\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{\left(s \cdot c\right) \cdot \left(x \cdot \left(s \cdot \left(c \cdot x\right)\right)\right)}\\
\end{array}
\end{array}
if x < 1.5000000000000001e-147Initial program 64.1%
associate-/r*64.1%
remove-double-neg64.1%
distribute-lft-neg-out64.1%
distribute-lft-neg-out64.1%
distribute-rgt-neg-out64.1%
associate-/l/64.1%
distribute-rgt-neg-out64.1%
distribute-lft-neg-out64.1%
associate-*l*66.5%
distribute-lft-neg-in66.5%
distribute-lft-neg-out66.5%
remove-double-neg66.5%
associate-*r*65.0%
*-commutative65.0%
associate-*r*63.1%
Simplified68.7%
Taylor expanded in x around 0 55.6%
unpow255.6%
associate-*r*53.8%
unpow253.8%
unpow253.8%
swap-sqr65.2%
swap-sqr93.4%
*-commutative93.4%
*-commutative93.4%
unpow293.4%
*-commutative93.4%
*-commutative93.4%
associate-*l*96.1%
Simplified96.1%
Taylor expanded in x around 0 52.2%
unpow252.2%
associate-/r*52.2%
unpow252.2%
unpow252.2%
swap-sqr68.2%
unpow268.2%
associate-/r*68.2%
unpow268.2%
swap-sqr85.6%
unpow285.6%
associate-*r*83.1%
*-commutative83.1%
associate-*r*86.6%
Simplified86.6%
if 1.5000000000000001e-147 < x Initial program 65.9%
associate-/r*66.2%
remove-double-neg66.2%
distribute-lft-neg-out66.2%
distribute-lft-neg-out66.2%
distribute-rgt-neg-out66.2%
associate-/l/65.9%
distribute-rgt-neg-out65.9%
distribute-lft-neg-out65.9%
associate-*l*66.8%
distribute-lft-neg-in66.8%
distribute-lft-neg-out66.8%
remove-double-neg66.8%
associate-*r*68.7%
*-commutative68.7%
associate-*r*69.7%
Simplified76.6%
Taylor expanded in x around 0 61.6%
unpow261.6%
associate-*r*64.4%
unpow264.4%
unpow264.4%
swap-sqr81.8%
swap-sqr98.2%
*-commutative98.2%
*-commutative98.2%
unpow298.2%
*-commutative98.2%
*-commutative98.2%
associate-*l*98.4%
Simplified98.4%
unpow298.4%
associate-*r*97.3%
associate-*l*95.4%
Applied egg-rr95.4%
Final simplification90.0%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (let* ((t_0 (* s (* c x)))) (* (/ (cos (* x 2.0)) t_0) (/ 1.0 t_0))))
assert(c < s);
double code(double x, double c, double s) {
double t_0 = s * (c * x);
return (cos((x * 2.0)) / t_0) * (1.0 / t_0);
}
NOTE: c and s should be sorted in increasing order before calling this 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
t_0 = s * (c * x)
code = (cos((x * 2.0d0)) / t_0) * (1.0d0 / t_0)
end function
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = s * (c * x);
return (Math.cos((x * 2.0)) / t_0) * (1.0 / t_0);
}
[c, s] = sort([c, s]) def code(x, c, s): t_0 = s * (c * x) return (math.cos((x * 2.0)) / t_0) * (1.0 / t_0)
c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(s * Float64(c * x)) return Float64(Float64(cos(Float64(x * 2.0)) / t_0) * Float64(1.0 / t_0)) end
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
t_0 = s * (c * x);
tmp = (cos((x * 2.0)) / t_0) * (1.0 / t_0);
end
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(s * N[(c * x), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision] * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := s \cdot \left(c \cdot x\right)\\
\frac{\cos \left(x \cdot 2\right)}{t_0} \cdot \frac{1}{t_0}
\end{array}
\end{array}
Initial program 64.8%
associate-/r*64.9%
remove-double-neg64.9%
distribute-lft-neg-out64.9%
distribute-lft-neg-out64.9%
distribute-rgt-neg-out64.9%
associate-/l/64.8%
distribute-rgt-neg-out64.8%
distribute-lft-neg-out64.8%
associate-*l*66.6%
distribute-lft-neg-in66.6%
distribute-lft-neg-out66.6%
remove-double-neg66.6%
associate-*r*66.5%
*-commutative66.5%
associate-*r*65.6%
Simplified71.7%
Taylor expanded in x around 0 57.9%
unpow257.9%
associate-*r*57.9%
unpow257.9%
unpow257.9%
swap-sqr71.6%
swap-sqr95.2%
*-commutative95.2%
*-commutative95.2%
unpow295.2%
*-commutative95.2%
*-commutative95.2%
associate-*l*97.0%
Simplified97.0%
*-un-lft-identity97.0%
unpow297.0%
times-frac97.0%
*-commutative97.0%
Applied egg-rr97.0%
Final simplification97.0%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (let* ((t_0 (* s (* c x)))) (/ (cos (* x 2.0)) (* t_0 t_0))))
assert(c < s);
double code(double x, double c, double s) {
double t_0 = s * (c * x);
return cos((x * 2.0)) / (t_0 * t_0);
}
NOTE: c and s should be sorted in increasing order before calling this 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
t_0 = s * (c * x)
code = cos((x * 2.0d0)) / (t_0 * t_0)
end function
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = s * (c * x);
return Math.cos((x * 2.0)) / (t_0 * t_0);
}
[c, s] = sort([c, s]) def code(x, c, s): t_0 = s * (c * x) return math.cos((x * 2.0)) / (t_0 * t_0)
c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(s * Float64(c * x)) return Float64(cos(Float64(x * 2.0)) / Float64(t_0 * t_0)) end
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
t_0 = s * (c * x);
tmp = cos((x * 2.0)) / (t_0 * t_0);
end
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(s * N[(c * x), $MachinePrecision]), $MachinePrecision]}, N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := s \cdot \left(c \cdot x\right)\\
\frac{\cos \left(x \cdot 2\right)}{t_0 \cdot t_0}
\end{array}
\end{array}
Initial program 64.8%
associate-/r*64.9%
remove-double-neg64.9%
distribute-lft-neg-out64.9%
distribute-lft-neg-out64.9%
distribute-rgt-neg-out64.9%
associate-/l/64.8%
distribute-rgt-neg-out64.8%
distribute-lft-neg-out64.8%
associate-*l*66.6%
distribute-lft-neg-in66.6%
distribute-lft-neg-out66.6%
remove-double-neg66.6%
associate-*r*66.5%
*-commutative66.5%
associate-*r*65.6%
Simplified71.7%
Taylor expanded in x around 0 57.9%
unpow257.9%
associate-*r*57.9%
unpow257.9%
unpow257.9%
swap-sqr71.6%
swap-sqr95.2%
*-commutative95.2%
*-commutative95.2%
unpow295.2%
*-commutative95.2%
*-commutative95.2%
associate-*l*97.0%
Simplified97.0%
unpow297.0%
Applied egg-rr97.0%
Final simplification97.0%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ 1.0 (pow (* c (* s x)) 2.0)))
assert(c < s);
double code(double x, double c, double s) {
return 1.0 / pow((c * (s * x)), 2.0);
}
NOTE: c and s should be sorted in increasing order before calling this function.
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 * (s * x)) ** 2.0d0)
end function
assert c < s;
public static double code(double x, double c, double s) {
return 1.0 / Math.pow((c * (s * x)), 2.0);
}
[c, s] = sort([c, s]) def code(x, c, s): return 1.0 / math.pow((c * (s * x)), 2.0)
c, s = sort([c, s]) function code(x, c, s) return Float64(1.0 / (Float64(c * Float64(s * x)) ^ 2.0)) end
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = 1.0 / ((c * (s * x)) ^ 2.0);
end
NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[(1.0 / N[Power[N[(c * N[(s * x), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{{\left(c \cdot \left(s \cdot x\right)\right)}^{2}}
\end{array}
Initial program 64.8%
associate-/r*64.9%
remove-double-neg64.9%
distribute-lft-neg-out64.9%
distribute-lft-neg-out64.9%
distribute-rgt-neg-out64.9%
associate-/l/64.8%
distribute-rgt-neg-out64.8%
distribute-lft-neg-out64.8%
associate-*l*66.6%
distribute-lft-neg-in66.6%
distribute-lft-neg-out66.6%
remove-double-neg66.6%
associate-*r*66.5%
*-commutative66.5%
associate-*r*65.6%
Simplified71.7%
Taylor expanded in x around 0 57.9%
unpow257.9%
associate-*r*57.9%
unpow257.9%
unpow257.9%
swap-sqr71.6%
swap-sqr95.2%
*-commutative95.2%
*-commutative95.2%
unpow295.2%
*-commutative95.2%
*-commutative95.2%
associate-*l*97.0%
Simplified97.0%
Taylor expanded in x around 0 54.2%
unpow254.2%
associate-/r*54.2%
unpow254.2%
unpow254.2%
swap-sqr66.8%
unpow266.8%
associate-/r*66.9%
unpow266.9%
swap-sqr82.7%
unpow282.7%
associate-*r*81.2%
*-commutative81.2%
associate-*r*83.4%
Simplified83.4%
Final simplification83.4%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (if (<= x 1.5e-27) (/ 1.0 (* x (* (* s (* s x)) (* c c)))) (/ 1.0 (* x (* x (* c (* c (* s s))))))))
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (x <= 1.5e-27) {
tmp = 1.0 / (x * ((s * (s * x)) * (c * c)));
} else {
tmp = 1.0 / (x * (x * (c * (c * (s * s)))));
}
return tmp;
}
NOTE: c and s should be sorted in increasing order before calling this 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) :: tmp
if (x <= 1.5d-27) then
tmp = 1.0d0 / (x * ((s * (s * x)) * (c * c)))
else
tmp = 1.0d0 / (x * (x * (c * (c * (s * s)))))
end if
code = tmp
end function
assert c < s;
public static double code(double x, double c, double s) {
double tmp;
if (x <= 1.5e-27) {
tmp = 1.0 / (x * ((s * (s * x)) * (c * c)));
} else {
tmp = 1.0 / (x * (x * (c * (c * (s * s)))));
}
return tmp;
}
[c, s] = sort([c, s]) def code(x, c, s): tmp = 0 if x <= 1.5e-27: tmp = 1.0 / (x * ((s * (s * x)) * (c * c))) else: tmp = 1.0 / (x * (x * (c * (c * (s * s))))) return tmp
c, s = sort([c, s]) function code(x, c, s) tmp = 0.0 if (x <= 1.5e-27) tmp = Float64(1.0 / Float64(x * Float64(Float64(s * Float64(s * x)) * Float64(c * c)))); else tmp = Float64(1.0 / Float64(x * Float64(x * Float64(c * Float64(c * Float64(s * s)))))); end return tmp end
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
tmp = 0.0;
if (x <= 1.5e-27)
tmp = 1.0 / (x * ((s * (s * x)) * (c * c)));
else
tmp = 1.0 / (x * (x * (c * (c * (s * s)))));
end
tmp_2 = tmp;
end
NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := If[LessEqual[x, 1.5e-27], N[(1.0 / N[(x * N[(N[(s * N[(s * x), $MachinePrecision]), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(x * N[(x * N[(c * N[(c * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.5 \cdot 10^{-27}:\\
\;\;\;\;\frac{1}{x \cdot \left(\left(s \cdot \left(s \cdot x\right)\right) \cdot \left(c \cdot c\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot \left(x \cdot \left(c \cdot \left(c \cdot \left(s \cdot s\right)\right)\right)\right)}\\
\end{array}
\end{array}
if x < 1.5000000000000001e-27Initial program 64.0%
associate-/r*64.0%
remove-double-neg64.0%
distribute-lft-neg-out64.0%
distribute-lft-neg-out64.0%
distribute-rgt-neg-out64.0%
associate-/l/64.0%
distribute-rgt-neg-out64.0%
distribute-lft-neg-out64.0%
associate-*l*66.0%
distribute-lft-neg-in66.0%
distribute-lft-neg-out66.0%
remove-double-neg66.0%
associate-*r*65.8%
*-commutative65.8%
associate-*r*64.2%
Simplified69.7%
Taylor expanded in x around 0 65.8%
*-commutative65.8%
associate-*r*64.8%
*-commutative64.8%
unpow264.8%
unpow264.8%
Simplified64.8%
Taylor expanded in x around 0 61.4%
Taylor expanded in s around 0 61.4%
unpow261.4%
associate-*r*67.1%
Simplified67.1%
if 1.5000000000000001e-27 < x Initial program 67.2%
associate-/r*67.7%
remove-double-neg67.7%
distribute-lft-neg-out67.7%
distribute-lft-neg-out67.7%
distribute-rgt-neg-out67.7%
associate-/l/67.2%
distribute-rgt-neg-out67.2%
distribute-lft-neg-out67.2%
associate-*l*68.6%
distribute-lft-neg-in68.6%
distribute-lft-neg-out68.6%
remove-double-neg68.6%
associate-*r*68.6%
*-commutative68.6%
associate-*r*70.2%
Simplified78.0%
Taylor expanded in x around 0 61.4%
Final simplification65.7%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (if (<= c 1060000.0) (/ 1.0 (* (* s c) (* (* c x) (* s x)))) (/ 1.0 (* (* s (* s x)) (* c (* c x))))))
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (c <= 1060000.0) {
tmp = 1.0 / ((s * c) * ((c * x) * (s * x)));
} else {
tmp = 1.0 / ((s * (s * x)) * (c * (c * x)));
}
return tmp;
}
NOTE: c and s should be sorted in increasing order before calling this 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) :: tmp
if (c <= 1060000.0d0) then
tmp = 1.0d0 / ((s * c) * ((c * x) * (s * x)))
else
tmp = 1.0d0 / ((s * (s * x)) * (c * (c * x)))
end if
code = tmp
end function
assert c < s;
public static double code(double x, double c, double s) {
double tmp;
if (c <= 1060000.0) {
tmp = 1.0 / ((s * c) * ((c * x) * (s * x)));
} else {
tmp = 1.0 / ((s * (s * x)) * (c * (c * x)));
}
return tmp;
}
[c, s] = sort([c, s]) def code(x, c, s): tmp = 0 if c <= 1060000.0: tmp = 1.0 / ((s * c) * ((c * x) * (s * x))) else: tmp = 1.0 / ((s * (s * x)) * (c * (c * x))) return tmp
c, s = sort([c, s]) function code(x, c, s) tmp = 0.0 if (c <= 1060000.0) tmp = Float64(1.0 / Float64(Float64(s * c) * Float64(Float64(c * x) * Float64(s * x)))); else tmp = Float64(1.0 / Float64(Float64(s * Float64(s * x)) * Float64(c * Float64(c * x)))); end return tmp end
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
tmp = 0.0;
if (c <= 1060000.0)
tmp = 1.0 / ((s * c) * ((c * x) * (s * x)));
else
tmp = 1.0 / ((s * (s * x)) * (c * (c * x)));
end
tmp_2 = tmp;
end
NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := If[LessEqual[c, 1060000.0], N[(1.0 / N[(N[(s * c), $MachinePrecision] * N[(N[(c * x), $MachinePrecision] * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(s * N[(s * x), $MachinePrecision]), $MachinePrecision] * N[(c * N[(c * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;c \leq 1060000:\\
\;\;\;\;\frac{1}{\left(s \cdot c\right) \cdot \left(\left(c \cdot x\right) \cdot \left(s \cdot x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(s \cdot \left(s \cdot x\right)\right) \cdot \left(c \cdot \left(c \cdot x\right)\right)}\\
\end{array}
\end{array}
if c < 1.06e6Initial program 63.0%
associate-/r*63.2%
remove-double-neg63.2%
distribute-lft-neg-out63.2%
distribute-lft-neg-out63.2%
distribute-rgt-neg-out63.2%
associate-/l/63.0%
distribute-rgt-neg-out63.0%
distribute-lft-neg-out63.0%
associate-*l*64.9%
distribute-lft-neg-in64.9%
distribute-lft-neg-out64.9%
remove-double-neg64.9%
associate-*r*65.2%
*-commutative65.2%
associate-*r*65.1%
Simplified70.7%
Taylor expanded in x around 0 63.0%
associate-*r*58.8%
swap-sqr73.0%
associate-*r*65.1%
unswap-sqr79.9%
pow279.9%
Applied egg-rr79.9%
*-commutative79.9%
*-commutative79.9%
associate-*r*81.0%
pow281.0%
associate-*r*76.2%
associate-*r*75.2%
*-commutative75.2%
associate-*r*74.7%
*-commutative74.7%
associate-*l*75.9%
*-commutative75.9%
Applied egg-rr75.9%
if 1.06e6 < c Initial program 70.3%
associate-/r*70.3%
remove-double-neg70.3%
distribute-lft-neg-out70.3%
distribute-lft-neg-out70.3%
distribute-rgt-neg-out70.3%
associate-/l/70.3%
distribute-rgt-neg-out70.3%
distribute-lft-neg-out70.3%
associate-*l*71.9%
distribute-lft-neg-in71.9%
distribute-lft-neg-out71.9%
remove-double-neg71.9%
associate-*r*70.5%
*-commutative70.5%
associate-*r*67.4%
Simplified75.1%
Taylor expanded in x around 0 70.6%
associate-*r*64.6%
swap-sqr71.3%
associate-*r*61.2%
unswap-sqr85.2%
pow285.2%
Applied egg-rr85.2%
*-commutative85.2%
*-commutative85.2%
associate-*r*88.3%
pow288.3%
associate-*r*85.1%
associate-*r*85.2%
*-commutative85.2%
associate-*r*85.2%
*-commutative85.2%
associate-*r*78.3%
*-commutative78.3%
associate-*l*78.5%
Applied egg-rr78.5%
Final simplification76.5%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (if (<= c 5000.0) (/ 1.0 (* (* s x) (* (* c x) (* s c)))) (/ 1.0 (* (* s (* s x)) (* c (* c x))))))
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (c <= 5000.0) {
tmp = 1.0 / ((s * x) * ((c * x) * (s * c)));
} else {
tmp = 1.0 / ((s * (s * x)) * (c * (c * x)));
}
return tmp;
}
NOTE: c and s should be sorted in increasing order before calling this 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) :: tmp
if (c <= 5000.0d0) then
tmp = 1.0d0 / ((s * x) * ((c * x) * (s * c)))
else
tmp = 1.0d0 / ((s * (s * x)) * (c * (c * x)))
end if
code = tmp
end function
assert c < s;
public static double code(double x, double c, double s) {
double tmp;
if (c <= 5000.0) {
tmp = 1.0 / ((s * x) * ((c * x) * (s * c)));
} else {
tmp = 1.0 / ((s * (s * x)) * (c * (c * x)));
}
return tmp;
}
[c, s] = sort([c, s]) def code(x, c, s): tmp = 0 if c <= 5000.0: tmp = 1.0 / ((s * x) * ((c * x) * (s * c))) else: tmp = 1.0 / ((s * (s * x)) * (c * (c * x))) return tmp
c, s = sort([c, s]) function code(x, c, s) tmp = 0.0 if (c <= 5000.0) tmp = Float64(1.0 / Float64(Float64(s * x) * Float64(Float64(c * x) * Float64(s * c)))); else tmp = Float64(1.0 / Float64(Float64(s * Float64(s * x)) * Float64(c * Float64(c * x)))); end return tmp end
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
tmp = 0.0;
if (c <= 5000.0)
tmp = 1.0 / ((s * x) * ((c * x) * (s * c)));
else
tmp = 1.0 / ((s * (s * x)) * (c * (c * x)));
end
tmp_2 = tmp;
end
NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := If[LessEqual[c, 5000.0], N[(1.0 / N[(N[(s * x), $MachinePrecision] * N[(N[(c * x), $MachinePrecision] * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(s * N[(s * x), $MachinePrecision]), $MachinePrecision] * N[(c * N[(c * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;c \leq 5000:\\
\;\;\;\;\frac{1}{\left(s \cdot x\right) \cdot \left(\left(c \cdot x\right) \cdot \left(s \cdot c\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(s \cdot \left(s \cdot x\right)\right) \cdot \left(c \cdot \left(c \cdot x\right)\right)}\\
\end{array}
\end{array}
if c < 5e3Initial program 63.0%
associate-/r*63.2%
remove-double-neg63.2%
distribute-lft-neg-out63.2%
distribute-lft-neg-out63.2%
distribute-rgt-neg-out63.2%
associate-/l/63.0%
distribute-rgt-neg-out63.0%
distribute-lft-neg-out63.0%
associate-*l*64.9%
distribute-lft-neg-in64.9%
distribute-lft-neg-out64.9%
remove-double-neg64.9%
associate-*r*65.2%
*-commutative65.2%
associate-*r*65.1%
Simplified70.7%
Taylor expanded in x around 0 63.0%
associate-*r*58.8%
swap-sqr73.0%
associate-*r*65.1%
unswap-sqr79.9%
pow279.9%
Applied egg-rr79.9%
*-commutative79.9%
*-commutative79.9%
associate-*r*81.0%
pow281.0%
*-commutative81.0%
associate-*l*76.2%
*-commutative76.2%
associate-*l*75.8%
*-commutative75.8%
associate-*l*74.7%
*-commutative74.7%
associate-*r*76.6%
*-commutative76.6%
Applied egg-rr76.6%
if 5e3 < c Initial program 70.3%
associate-/r*70.3%
remove-double-neg70.3%
distribute-lft-neg-out70.3%
distribute-lft-neg-out70.3%
distribute-rgt-neg-out70.3%
associate-/l/70.3%
distribute-rgt-neg-out70.3%
distribute-lft-neg-out70.3%
associate-*l*71.9%
distribute-lft-neg-in71.9%
distribute-lft-neg-out71.9%
remove-double-neg71.9%
associate-*r*70.5%
*-commutative70.5%
associate-*r*67.4%
Simplified75.1%
Taylor expanded in x around 0 70.6%
associate-*r*64.6%
swap-sqr71.3%
associate-*r*61.2%
unswap-sqr85.2%
pow285.2%
Applied egg-rr85.2%
*-commutative85.2%
*-commutative85.2%
associate-*r*88.3%
pow288.3%
associate-*r*85.1%
associate-*r*85.2%
*-commutative85.2%
associate-*r*85.2%
*-commutative85.2%
associate-*r*78.3%
*-commutative78.3%
associate-*l*78.5%
Applied egg-rr78.5%
Final simplification77.1%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (* (/ 1.0 (* s (* c x))) (/ 1.0 (* c (* s x)))))
assert(c < s);
double code(double x, double c, double s) {
return (1.0 / (s * (c * x))) * (1.0 / (c * (s * x)));
}
NOTE: c and s should be sorted in increasing order before calling this function.
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 / (s * (c * x))) * (1.0d0 / (c * (s * x)))
end function
assert c < s;
public static double code(double x, double c, double s) {
return (1.0 / (s * (c * x))) * (1.0 / (c * (s * x)));
}
[c, s] = sort([c, s]) def code(x, c, s): return (1.0 / (s * (c * x))) * (1.0 / (c * (s * x)))
c, s = sort([c, s]) function code(x, c, s) return Float64(Float64(1.0 / Float64(s * Float64(c * x))) * Float64(1.0 / Float64(c * Float64(s * x)))) end
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = (1.0 / (s * (c * x))) * (1.0 / (c * (s * x)));
end
NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[(N[(1.0 / N[(s * N[(c * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(c * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{s \cdot \left(c \cdot x\right)} \cdot \frac{1}{c \cdot \left(s \cdot x\right)}
\end{array}
Initial program 64.8%
associate-/r*64.9%
remove-double-neg64.9%
distribute-lft-neg-out64.9%
distribute-lft-neg-out64.9%
distribute-rgt-neg-out64.9%
associate-/l/64.8%
distribute-rgt-neg-out64.8%
distribute-lft-neg-out64.8%
associate-*l*66.6%
distribute-lft-neg-in66.6%
distribute-lft-neg-out66.6%
remove-double-neg66.6%
associate-*r*66.5%
*-commutative66.5%
associate-*r*65.6%
Simplified71.7%
Taylor expanded in x around 0 57.9%
unpow257.9%
associate-*r*57.9%
unpow257.9%
unpow257.9%
swap-sqr71.6%
swap-sqr95.2%
*-commutative95.2%
*-commutative95.2%
unpow295.2%
*-commutative95.2%
*-commutative95.2%
associate-*l*97.0%
Simplified97.0%
*-un-lft-identity97.0%
unpow297.0%
times-frac97.0%
*-commutative97.0%
Applied egg-rr97.0%
Taylor expanded in x around 0 82.7%
associate-*r*80.2%
*-commutative80.2%
associate-*r*82.4%
Simplified82.4%
Final simplification82.4%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ 1.0 (* x (* x (* c (* c (* s s)))))))
assert(c < s);
double code(double x, double c, double s) {
return 1.0 / (x * (x * (c * (c * (s * s)))));
}
NOTE: c and s should be sorted in increasing order before calling this function.
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = 1.0d0 / (x * (x * (c * (c * (s * s)))))
end function
assert c < s;
public static double code(double x, double c, double s) {
return 1.0 / (x * (x * (c * (c * (s * s)))));
}
[c, s] = sort([c, s]) def code(x, c, s): return 1.0 / (x * (x * (c * (c * (s * s)))))
c, s = sort([c, s]) function code(x, c, s) return Float64(1.0 / Float64(x * Float64(x * Float64(c * Float64(c * Float64(s * s)))))) end
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = 1.0 / (x * (x * (c * (c * (s * s)))));
end
NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[(1.0 / N[(x * N[(x * N[(c * N[(c * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{x \cdot \left(x \cdot \left(c \cdot \left(c \cdot \left(s \cdot s\right)\right)\right)\right)}
\end{array}
Initial program 64.8%
associate-/r*64.9%
remove-double-neg64.9%
distribute-lft-neg-out64.9%
distribute-lft-neg-out64.9%
distribute-rgt-neg-out64.9%
associate-/l/64.8%
distribute-rgt-neg-out64.8%
distribute-lft-neg-out64.8%
associate-*l*66.6%
distribute-lft-neg-in66.6%
distribute-lft-neg-out66.6%
remove-double-neg66.6%
associate-*r*66.5%
*-commutative66.5%
associate-*r*65.6%
Simplified71.7%
Taylor expanded in x around 0 64.8%
Final simplification64.8%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ 1.0 (* (* c x) (* c (* s (* s x))))))
assert(c < s);
double code(double x, double c, double s) {
return 1.0 / ((c * x) * (c * (s * (s * x))));
}
NOTE: c and s should be sorted in increasing order before calling this function.
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) * (c * (s * (s * x))))
end function
assert c < s;
public static double code(double x, double c, double s) {
return 1.0 / ((c * x) * (c * (s * (s * x))));
}
[c, s] = sort([c, s]) def code(x, c, s): return 1.0 / ((c * x) * (c * (s * (s * x))))
c, s = sort([c, s]) function code(x, c, s) return Float64(1.0 / Float64(Float64(c * x) * Float64(c * Float64(s * Float64(s * x))))) end
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = 1.0 / ((c * x) * (c * (s * (s * x))));
end
NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[(1.0 / N[(N[(c * x), $MachinePrecision] * N[(c * N[(s * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{\left(c \cdot x\right) \cdot \left(c \cdot \left(s \cdot \left(s \cdot x\right)\right)\right)}
\end{array}
Initial program 64.8%
associate-/r*64.9%
remove-double-neg64.9%
distribute-lft-neg-out64.9%
distribute-lft-neg-out64.9%
distribute-rgt-neg-out64.9%
associate-/l/64.8%
distribute-rgt-neg-out64.8%
distribute-lft-neg-out64.8%
associate-*l*66.6%
distribute-lft-neg-in66.6%
distribute-lft-neg-out66.6%
remove-double-neg66.6%
associate-*r*66.5%
*-commutative66.5%
associate-*r*65.6%
Simplified71.7%
Taylor expanded in x around 0 57.9%
unpow257.9%
associate-*r*57.9%
unpow257.9%
unpow257.9%
swap-sqr71.6%
swap-sqr95.2%
*-commutative95.2%
*-commutative95.2%
unpow295.2%
*-commutative95.2%
*-commutative95.2%
associate-*l*97.0%
Simplified97.0%
unpow297.0%
swap-sqr73.3%
*-commutative73.3%
associate-*r*71.2%
*-commutative71.2%
associate-*r*64.6%
associate-*r*66.6%
*-commutative66.6%
associate-*r*66.1%
associate-*l*73.7%
associate-*r*76.7%
*-commutative76.7%
associate-*l*84.0%
Applied egg-rr84.0%
Taylor expanded in x around 0 73.2%
Final simplification73.2%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ 1.0 (* (* s c) (* (* c x) (* s x)))))
assert(c < s);
double code(double x, double c, double s) {
return 1.0 / ((s * c) * ((c * x) * (s * x)));
}
NOTE: c and s should be sorted in increasing order before calling this function.
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 / ((s * c) * ((c * x) * (s * x)))
end function
assert c < s;
public static double code(double x, double c, double s) {
return 1.0 / ((s * c) * ((c * x) * (s * x)));
}
[c, s] = sort([c, s]) def code(x, c, s): return 1.0 / ((s * c) * ((c * x) * (s * x)))
c, s = sort([c, s]) function code(x, c, s) return Float64(1.0 / Float64(Float64(s * c) * Float64(Float64(c * x) * Float64(s * x)))) end
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = 1.0 / ((s * c) * ((c * x) * (s * x)));
end
NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[(1.0 / N[(N[(s * c), $MachinePrecision] * N[(N[(c * x), $MachinePrecision] * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{\left(s \cdot c\right) \cdot \left(\left(c \cdot x\right) \cdot \left(s \cdot x\right)\right)}
\end{array}
Initial program 64.8%
associate-/r*64.9%
remove-double-neg64.9%
distribute-lft-neg-out64.9%
distribute-lft-neg-out64.9%
distribute-rgt-neg-out64.9%
associate-/l/64.8%
distribute-rgt-neg-out64.8%
distribute-lft-neg-out64.8%
associate-*l*66.6%
distribute-lft-neg-in66.6%
distribute-lft-neg-out66.6%
remove-double-neg66.6%
associate-*r*66.5%
*-commutative66.5%
associate-*r*65.6%
Simplified71.7%
Taylor expanded in x around 0 64.8%
associate-*r*60.2%
swap-sqr72.6%
associate-*r*64.2%
unswap-sqr81.2%
pow281.2%
Applied egg-rr81.2%
*-commutative81.2%
*-commutative81.2%
associate-*r*82.7%
pow282.7%
associate-*r*78.4%
associate-*r*77.6%
*-commutative77.6%
associate-*r*77.3%
*-commutative77.3%
associate-*l*77.8%
*-commutative77.8%
Applied egg-rr77.8%
Final simplification77.8%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ (/ (/ 1.0 s) (* c x)) (* s (* c x))))
assert(c < s);
double code(double x, double c, double s) {
return ((1.0 / s) / (c * x)) / (s * (c * x));
}
NOTE: c and s should be sorted in increasing order before calling this function.
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 / s) / (c * x)) / (s * (c * x))
end function
assert c < s;
public static double code(double x, double c, double s) {
return ((1.0 / s) / (c * x)) / (s * (c * x));
}
[c, s] = sort([c, s]) def code(x, c, s): return ((1.0 / s) / (c * x)) / (s * (c * x))
c, s = sort([c, s]) function code(x, c, s) return Float64(Float64(Float64(1.0 / s) / Float64(c * x)) / Float64(s * Float64(c * x))) end
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = ((1.0 / s) / (c * x)) / (s * (c * x));
end
NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[(N[(N[(1.0 / s), $MachinePrecision] / N[(c * x), $MachinePrecision]), $MachinePrecision] / N[(s * N[(c * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{\frac{\frac{1}{s}}{c \cdot x}}{s \cdot \left(c \cdot x\right)}
\end{array}
Initial program 64.8%
associate-/r*64.9%
remove-double-neg64.9%
distribute-lft-neg-out64.9%
distribute-lft-neg-out64.9%
distribute-rgt-neg-out64.9%
associate-/l/64.8%
distribute-rgt-neg-out64.8%
distribute-lft-neg-out64.8%
associate-*l*66.6%
distribute-lft-neg-in66.6%
distribute-lft-neg-out66.6%
remove-double-neg66.6%
associate-*r*66.5%
*-commutative66.5%
associate-*r*65.6%
Simplified71.7%
Taylor expanded in x around 0 57.9%
unpow257.9%
associate-*r*57.9%
unpow257.9%
unpow257.9%
swap-sqr71.6%
swap-sqr95.2%
*-commutative95.2%
*-commutative95.2%
unpow295.2%
*-commutative95.2%
*-commutative95.2%
associate-*l*97.0%
Simplified97.0%
*-un-lft-identity97.0%
unpow297.0%
times-frac97.0%
*-commutative97.0%
Applied egg-rr97.0%
Taylor expanded in x around 0 82.7%
un-div-inv82.7%
associate-/r*82.8%
Applied egg-rr82.8%
Final simplification82.8%
herbie shell --seed 2023275
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))