
(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 14 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
(let* ((t_0 (cos (* x 2.0))) (t_1 (* c (* s x))))
(if (<= s 5.8e-174)
(/ (/ t_0 t_1) t_1)
(/ t_0 (pow (* (sqrt s) (* x (* c (sqrt s)))) 2.0)))))assert(c < s);
double code(double x, double c, double s) {
double t_0 = cos((x * 2.0));
double t_1 = c * (s * x);
double tmp;
if (s <= 5.8e-174) {
tmp = (t_0 / t_1) / t_1;
} else {
tmp = t_0 / pow((sqrt(s) * (x * (c * sqrt(s)))), 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((x * 2.0d0))
t_1 = c * (s * x)
if (s <= 5.8d-174) then
tmp = (t_0 / t_1) / t_1
else
tmp = t_0 / ((sqrt(s) * (x * (c * sqrt(s)))) ** 2.0d0)
end if
code = tmp
end function
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = Math.cos((x * 2.0));
double t_1 = c * (s * x);
double tmp;
if (s <= 5.8e-174) {
tmp = (t_0 / t_1) / t_1;
} else {
tmp = t_0 / Math.pow((Math.sqrt(s) * (x * (c * Math.sqrt(s)))), 2.0);
}
return tmp;
}
[c, s] = sort([c, s]) def code(x, c, s): t_0 = math.cos((x * 2.0)) t_1 = c * (s * x) tmp = 0 if s <= 5.8e-174: tmp = (t_0 / t_1) / t_1 else: tmp = t_0 / math.pow((math.sqrt(s) * (x * (c * math.sqrt(s)))), 2.0) return tmp
c, s = sort([c, s]) function code(x, c, s) t_0 = cos(Float64(x * 2.0)) t_1 = Float64(c * Float64(s * x)) tmp = 0.0 if (s <= 5.8e-174) tmp = Float64(Float64(t_0 / t_1) / t_1); else tmp = Float64(t_0 / (Float64(sqrt(s) * Float64(x * Float64(c * sqrt(s)))) ^ 2.0)); end return tmp end
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
t_0 = cos((x * 2.0));
t_1 = c * (s * x);
tmp = 0.0;
if (s <= 5.8e-174)
tmp = (t_0 / t_1) / t_1;
else
tmp = t_0 / ((sqrt(s) * (x * (c * sqrt(s)))) ^ 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_] := Block[{t$95$0 = N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(c * N[(s * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[s, 5.8e-174], N[(N[(t$95$0 / t$95$1), $MachinePrecision] / t$95$1), $MachinePrecision], N[(t$95$0 / N[Power[N[(N[Sqrt[s], $MachinePrecision] * N[(x * N[(c * N[Sqrt[s], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := \cos \left(x \cdot 2\right)\\
t_1 := c \cdot \left(s \cdot x\right)\\
\mathbf{if}\;s \leq 5.8 \cdot 10^{-174}:\\
\;\;\;\;\frac{\frac{t_0}{t_1}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{{\left(\sqrt{s} \cdot \left(x \cdot \left(c \cdot \sqrt{s}\right)\right)\right)}^{2}}\\
\end{array}
\end{array}
if s < 5.8000000000000002e-174Initial program 58.8%
*-commutative58.8%
associate-*r*55.8%
associate-*r*56.9%
unpow256.9%
unswap-sqr68.2%
unpow268.2%
swap-sqr94.8%
*-commutative94.8%
*-commutative94.8%
*-commutative94.8%
*-commutative94.8%
Simplified94.8%
associate-/r*95.1%
div-inv95.1%
*-commutative95.1%
Applied egg-rr95.1%
un-div-inv95.1%
Applied egg-rr95.1%
Taylor expanded in s around 0 93.6%
Taylor expanded in s around 0 97.9%
if 5.8000000000000002e-174 < s Initial program 63.1%
*-commutative63.1%
associate-*l*55.4%
associate-*r*56.3%
*-commutative56.3%
unpow256.3%
associate-*r*58.0%
associate-*r*59.9%
*-commutative59.9%
unpow259.9%
Simplified59.9%
add-sqr-sqrt59.8%
pow259.8%
*-commutative59.8%
sqrt-prod59.8%
sqrt-prod60.6%
sqrt-prod33.5%
add-sqr-sqrt73.3%
sqrt-prod77.6%
sqrt-prod50.9%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
Final simplification98.1%
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
:precision binary64
(let* ((t_0 (cos (* x 2.0))))
(if (<= x -5.2e+156)
(/ t_0 (* x (* c (* c (* s (* s x))))))
(if (<= x -1.25e-11)
(/ t_0 (* s (* (* x x) (* c (* s c)))))
(if (<= x 5.4e-5)
(/ (/ (/ 1.0 s) (* x c)) (* s (* x c)))
(/ t_0 (* s (* s (* x (* c (* x c)))))))))))assert(c < s);
double code(double x, double c, double s) {
double t_0 = cos((x * 2.0));
double tmp;
if (x <= -5.2e+156) {
tmp = t_0 / (x * (c * (c * (s * (s * x)))));
} else if (x <= -1.25e-11) {
tmp = t_0 / (s * ((x * x) * (c * (s * c))));
} else if (x <= 5.4e-5) {
tmp = ((1.0 / s) / (x * c)) / (s * (x * c));
} else {
tmp = t_0 / (s * (s * (x * (c * (x * c)))));
}
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) :: t_0
real(8) :: tmp
t_0 = cos((x * 2.0d0))
if (x <= (-5.2d+156)) then
tmp = t_0 / (x * (c * (c * (s * (s * x)))))
else if (x <= (-1.25d-11)) then
tmp = t_0 / (s * ((x * x) * (c * (s * c))))
else if (x <= 5.4d-5) then
tmp = ((1.0d0 / s) / (x * c)) / (s * (x * c))
else
tmp = t_0 / (s * (s * (x * (c * (x * c)))))
end if
code = tmp
end function
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = Math.cos((x * 2.0));
double tmp;
if (x <= -5.2e+156) {
tmp = t_0 / (x * (c * (c * (s * (s * x)))));
} else if (x <= -1.25e-11) {
tmp = t_0 / (s * ((x * x) * (c * (s * c))));
} else if (x <= 5.4e-5) {
tmp = ((1.0 / s) / (x * c)) / (s * (x * c));
} else {
tmp = t_0 / (s * (s * (x * (c * (x * c)))));
}
return tmp;
}
[c, s] = sort([c, s]) def code(x, c, s): t_0 = math.cos((x * 2.0)) tmp = 0 if x <= -5.2e+156: tmp = t_0 / (x * (c * (c * (s * (s * x))))) elif x <= -1.25e-11: tmp = t_0 / (s * ((x * x) * (c * (s * c)))) elif x <= 5.4e-5: tmp = ((1.0 / s) / (x * c)) / (s * (x * c)) else: tmp = t_0 / (s * (s * (x * (c * (x * c))))) return tmp
c, s = sort([c, s]) function code(x, c, s) t_0 = cos(Float64(x * 2.0)) tmp = 0.0 if (x <= -5.2e+156) tmp = Float64(t_0 / Float64(x * Float64(c * Float64(c * Float64(s * Float64(s * x)))))); elseif (x <= -1.25e-11) tmp = Float64(t_0 / Float64(s * Float64(Float64(x * x) * Float64(c * Float64(s * c))))); elseif (x <= 5.4e-5) tmp = Float64(Float64(Float64(1.0 / s) / Float64(x * c)) / Float64(s * Float64(x * c))); else tmp = Float64(t_0 / Float64(s * Float64(s * Float64(x * Float64(c * Float64(x * c)))))); end return tmp end
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
t_0 = cos((x * 2.0));
tmp = 0.0;
if (x <= -5.2e+156)
tmp = t_0 / (x * (c * (c * (s * (s * x)))));
elseif (x <= -1.25e-11)
tmp = t_0 / (s * ((x * x) * (c * (s * c))));
elseif (x <= 5.4e-5)
tmp = ((1.0 / s) / (x * c)) / (s * (x * c));
else
tmp = t_0 / (s * (s * (x * (c * (x * c)))));
end
tmp_2 = tmp;
end
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -5.2e+156], N[(t$95$0 / N[(x * N[(c * N[(c * N[(s * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.25e-11], N[(t$95$0 / N[(s * N[(N[(x * x), $MachinePrecision] * N[(c * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.4e-5], N[(N[(N[(1.0 / s), $MachinePrecision] / N[(x * c), $MachinePrecision]), $MachinePrecision] / N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(s * N[(s * N[(x * N[(c * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := \cos \left(x \cdot 2\right)\\
\mathbf{if}\;x \leq -5.2 \cdot 10^{+156}:\\
\;\;\;\;\frac{t_0}{x \cdot \left(c \cdot \left(c \cdot \left(s \cdot \left(s \cdot x\right)\right)\right)\right)}\\
\mathbf{elif}\;x \leq -1.25 \cdot 10^{-11}:\\
\;\;\;\;\frac{t_0}{s \cdot \left(\left(x \cdot x\right) \cdot \left(c \cdot \left(s \cdot c\right)\right)\right)}\\
\mathbf{elif}\;x \leq 5.4 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{\frac{1}{s}}{x \cdot c}}{s \cdot \left(x \cdot c\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{s \cdot \left(s \cdot \left(x \cdot \left(c \cdot \left(x \cdot c\right)\right)\right)\right)}\\
\end{array}
\end{array}
if x < -5.20000000000000037e156Initial program 59.9%
associate-*r*67.2%
*-commutative67.2%
associate-*r*66.9%
unpow266.9%
unpow266.9%
Simplified66.9%
Taylor expanded in c around 0 66.9%
unpow266.9%
*-commutative66.9%
*-commutative66.9%
*-commutative66.9%
associate-*r*67.2%
unpow267.2%
associate-*l*78.1%
*-commutative78.1%
associate-*l*92.5%
Simplified92.5%
if -5.20000000000000037e156 < x < -1.25000000000000005e-11Initial program 70.0%
*-commutative70.0%
associate-*l*70.0%
associate-*r*65.2%
*-commutative65.2%
unpow265.2%
associate-*r*76.3%
associate-*r*85.1%
*-commutative85.1%
unpow285.1%
Simplified85.1%
Taylor expanded in c around 0 85.1%
*-commutative85.1%
unpow285.1%
associate-*l*92.4%
Simplified92.4%
if -1.25000000000000005e-11 < x < 5.3999999999999998e-5Initial program 58.5%
*-commutative58.5%
associate-*r*52.2%
associate-*r*51.4%
unpow251.4%
unswap-sqr67.9%
unpow267.9%
swap-sqr94.8%
*-commutative94.8%
*-commutative94.8%
*-commutative94.8%
*-commutative94.8%
Simplified94.8%
associate-/r*95.3%
div-inv95.2%
*-commutative95.2%
Applied egg-rr95.2%
un-div-inv95.3%
Applied egg-rr95.3%
Taylor expanded in s around 0 93.8%
Taylor expanded in x around 0 93.7%
associate-*r*92.3%
*-commutative92.3%
associate-*r*95.1%
associate-/r*95.1%
Simplified95.1%
if 5.3999999999999998e-5 < x Initial program 59.3%
*-commutative59.3%
associate-*l*56.4%
associate-*r*60.8%
*-commutative60.8%
unpow260.8%
associate-*r*65.9%
associate-*r*69.1%
*-commutative69.1%
unpow269.1%
Simplified69.1%
Taylor expanded in x around 0 67.7%
*-commutative67.7%
unpow267.7%
associate-*r*73.8%
unpow273.8%
associate-*r*85.2%
*-commutative85.2%
Simplified85.2%
Final simplification92.0%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (if (or (<= x -0.02) (not (<= x 0.00175))) (/ (cos (* x 2.0)) (* s (* s (* x (* c (* x c)))))) (/ (/ (/ 1.0 s) (* x c)) (* s (* x c)))))
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if ((x <= -0.02) || !(x <= 0.00175)) {
tmp = cos((x * 2.0)) / (s * (s * (x * (c * (x * c)))));
} else {
tmp = ((1.0 / s) / (x * c)) / (s * (x * c));
}
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 <= (-0.02d0)) .or. (.not. (x <= 0.00175d0))) then
tmp = cos((x * 2.0d0)) / (s * (s * (x * (c * (x * c)))))
else
tmp = ((1.0d0 / s) / (x * c)) / (s * (x * c))
end if
code = tmp
end function
assert c < s;
public static double code(double x, double c, double s) {
double tmp;
if ((x <= -0.02) || !(x <= 0.00175)) {
tmp = Math.cos((x * 2.0)) / (s * (s * (x * (c * (x * c)))));
} else {
tmp = ((1.0 / s) / (x * c)) / (s * (x * c));
}
return tmp;
}
[c, s] = sort([c, s]) def code(x, c, s): tmp = 0 if (x <= -0.02) or not (x <= 0.00175): tmp = math.cos((x * 2.0)) / (s * (s * (x * (c * (x * c))))) else: tmp = ((1.0 / s) / (x * c)) / (s * (x * c)) return tmp
c, s = sort([c, s]) function code(x, c, s) tmp = 0.0 if ((x <= -0.02) || !(x <= 0.00175)) tmp = Float64(cos(Float64(x * 2.0)) / Float64(s * Float64(s * Float64(x * Float64(c * Float64(x * c)))))); else tmp = Float64(Float64(Float64(1.0 / s) / Float64(x * c)) / Float64(s * Float64(x * c))); end return tmp end
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
tmp = 0.0;
if ((x <= -0.02) || ~((x <= 0.00175)))
tmp = cos((x * 2.0)) / (s * (s * (x * (c * (x * c)))));
else
tmp = ((1.0 / s) / (x * c)) / (s * (x * c));
end
tmp_2 = tmp;
end
NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := If[Or[LessEqual[x, -0.02], N[Not[LessEqual[x, 0.00175]], $MachinePrecision]], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(s * N[(s * N[(x * N[(c * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / s), $MachinePrecision] / N[(x * c), $MachinePrecision]), $MachinePrecision] / N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.02 \lor \neg \left(x \leq 0.00175\right):\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{s \cdot \left(s \cdot \left(x \cdot \left(c \cdot \left(x \cdot c\right)\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{s}}{x \cdot c}}{s \cdot \left(x \cdot c\right)}\\
\end{array}
\end{array}
if x < -0.0200000000000000004 or 0.00175000000000000004 < x Initial program 63.6%
*-commutative63.6%
associate-*l*59.9%
associate-*r*60.6%
*-commutative60.6%
unpow260.6%
associate-*r*66.7%
associate-*r*71.0%
*-commutative71.0%
unpow271.0%
Simplified71.0%
Taylor expanded in x around 0 68.8%
*-commutative68.8%
unpow268.8%
associate-*r*74.2%
unpow274.2%
associate-*r*82.0%
*-commutative82.0%
Simplified82.0%
if -0.0200000000000000004 < x < 0.00175000000000000004Initial program 57.6%
*-commutative57.6%
associate-*r*51.4%
associate-*r*50.7%
unpow250.7%
unswap-sqr66.9%
unpow266.9%
swap-sqr94.9%
*-commutative94.9%
*-commutative94.9%
*-commutative94.9%
*-commutative94.9%
Simplified94.9%
associate-/r*95.3%
div-inv95.3%
*-commutative95.3%
Applied egg-rr95.3%
un-div-inv95.3%
Applied egg-rr95.3%
Taylor expanded in s around 0 93.9%
Taylor expanded in x around 0 93.2%
associate-*r*91.9%
*-commutative91.9%
associate-*r*94.7%
associate-/r*94.7%
Simplified94.7%
Final simplification88.4%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ (cos (* x 2.0)) (* (* c (* s x)) (* s (* x c)))))
assert(c < s);
double code(double x, double c, double s) {
return cos((x * 2.0)) / ((c * (s * x)) * (s * (x * c)));
}
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 = cos((x * 2.0d0)) / ((c * (s * x)) * (s * (x * c)))
end function
assert c < s;
public static double code(double x, double c, double s) {
return Math.cos((x * 2.0)) / ((c * (s * x)) * (s * (x * c)));
}
[c, s] = sort([c, s]) def code(x, c, s): return math.cos((x * 2.0)) / ((c * (s * x)) * (s * (x * c)))
c, s = sort([c, s]) function code(x, c, s) return Float64(cos(Float64(x * 2.0)) / Float64(Float64(c * Float64(s * x)) * Float64(s * Float64(x * c)))) end
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = cos((x * 2.0)) / ((c * (s * x)) * (s * (x * c)));
end
NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(N[(c * N[(s * x), $MachinePrecision]), $MachinePrecision] * N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{\cos \left(x \cdot 2\right)}{\left(c \cdot \left(s \cdot x\right)\right) \cdot \left(s \cdot \left(x \cdot c\right)\right)}
\end{array}
Initial program 60.6%
*-commutative60.6%
associate-*r*55.6%
associate-*r*56.7%
unpow256.7%
unswap-sqr71.5%
unpow271.5%
swap-sqr95.6%
*-commutative95.6%
*-commutative95.6%
*-commutative95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in s around 0 93.2%
Final simplification93.2%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (let* ((t_0 (* s (* x c)))) (/ (cos (* x 2.0)) (* t_0 t_0))))
assert(c < s);
double code(double x, double c, double s) {
double t_0 = s * (x * c);
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 * (x * c)
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 * (x * c);
return Math.cos((x * 2.0)) / (t_0 * t_0);
}
[c, s] = sort([c, s]) def code(x, c, s): t_0 = s * (x * c) 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(x * c)) 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 * (x * c);
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[(x * c), $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(x \cdot c\right)\\
\frac{\cos \left(x \cdot 2\right)}{t_0 \cdot t_0}
\end{array}
\end{array}
Initial program 60.6%
*-commutative60.6%
associate-*r*55.6%
associate-*r*56.7%
unpow256.7%
unswap-sqr71.5%
unpow271.5%
swap-sqr95.6%
*-commutative95.6%
*-commutative95.6%
*-commutative95.6%
*-commutative95.6%
Simplified95.6%
Final simplification95.6%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (let* ((t_0 (* s (* x c)))) (/ (/ (cos (* x 2.0)) t_0) t_0)))
assert(c < s);
double code(double x, double c, double s) {
double t_0 = s * (x * c);
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 * (x * c)
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 * (x * c);
return (Math.cos((x * 2.0)) / t_0) / t_0;
}
[c, s] = sort([c, s]) def code(x, c, s): t_0 = s * (x * c) 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(x * c)) return Float64(Float64(cos(Float64(x * 2.0)) / t_0) / t_0) end
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
t_0 = s * (x * c);
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[(x * c), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := s \cdot \left(x \cdot c\right)\\
\frac{\frac{\cos \left(x \cdot 2\right)}{t_0}}{t_0}
\end{array}
\end{array}
Initial program 60.6%
*-commutative60.6%
associate-*r*55.6%
associate-*r*56.7%
unpow256.7%
unswap-sqr71.5%
unpow271.5%
swap-sqr95.6%
*-commutative95.6%
*-commutative95.6%
*-commutative95.6%
*-commutative95.6%
Simplified95.6%
associate-/r*96.0%
div-inv96.0%
*-commutative96.0%
Applied egg-rr96.0%
un-div-inv96.0%
Applied egg-rr96.0%
Final simplification96.0%
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* x (* s c))))
(if (<= c -2e-30)
(/ 1.0 (* s (* (* x c) t_0)))
(/ 1.0 (* c (* t_0 (* s x)))))))assert(c < s);
double code(double x, double c, double s) {
double t_0 = x * (s * c);
double tmp;
if (c <= -2e-30) {
tmp = 1.0 / (s * ((x * c) * t_0));
} else {
tmp = 1.0 / (c * (t_0 * (s * 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) :: t_0
real(8) :: tmp
t_0 = x * (s * c)
if (c <= (-2d-30)) then
tmp = 1.0d0 / (s * ((x * c) * t_0))
else
tmp = 1.0d0 / (c * (t_0 * (s * x)))
end if
code = tmp
end function
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = x * (s * c);
double tmp;
if (c <= -2e-30) {
tmp = 1.0 / (s * ((x * c) * t_0));
} else {
tmp = 1.0 / (c * (t_0 * (s * x)));
}
return tmp;
}
[c, s] = sort([c, s]) def code(x, c, s): t_0 = x * (s * c) tmp = 0 if c <= -2e-30: tmp = 1.0 / (s * ((x * c) * t_0)) else: tmp = 1.0 / (c * (t_0 * (s * x))) return tmp
c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(x * Float64(s * c)) tmp = 0.0 if (c <= -2e-30) tmp = Float64(1.0 / Float64(s * Float64(Float64(x * c) * t_0))); else tmp = Float64(1.0 / Float64(c * Float64(t_0 * Float64(s * x)))); end return tmp end
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
t_0 = x * (s * c);
tmp = 0.0;
if (c <= -2e-30)
tmp = 1.0 / (s * ((x * c) * t_0));
else
tmp = 1.0 / (c * (t_0 * (s * x)));
end
tmp_2 = tmp;
end
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(x * N[(s * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -2e-30], N[(1.0 / N[(s * N[(N[(x * c), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(c * N[(t$95$0 * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := x \cdot \left(s \cdot c\right)\\
\mathbf{if}\;c \leq -2 \cdot 10^{-30}:\\
\;\;\;\;\frac{1}{s \cdot \left(\left(x \cdot c\right) \cdot t_0\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{c \cdot \left(t_0 \cdot \left(s \cdot x\right)\right)}\\
\end{array}
\end{array}
if c < -2e-30Initial program 61.6%
*-commutative61.6%
associate-*r*55.6%
associate-*r*58.2%
unpow258.2%
unswap-sqr74.8%
unpow274.8%
swap-sqr96.1%
*-commutative96.1%
*-commutative96.1%
*-commutative96.1%
*-commutative96.1%
Simplified96.1%
Taylor expanded in x around 0 54.1%
unpow254.1%
associate-*r*54.3%
*-commutative54.3%
associate-*r*55.6%
*-commutative55.6%
unpow255.6%
unpow255.6%
swap-sqr72.2%
swap-sqr89.9%
unpow289.9%
associate-*r*88.5%
*-commutative88.5%
*-commutative88.5%
*-commutative88.5%
Simplified88.5%
unpow288.5%
*-commutative88.5%
associate-*r*88.4%
associate-*l*86.7%
*-commutative86.7%
associate-*r*88.3%
*-commutative88.3%
associate-*l*84.3%
Applied egg-rr84.3%
if -2e-30 < c Initial program 60.2%
*-commutative60.2%
associate-*r*55.6%
associate-*r*56.1%
unpow256.1%
unswap-sqr70.2%
unpow270.2%
swap-sqr95.4%
*-commutative95.4%
*-commutative95.4%
*-commutative95.4%
*-commutative95.4%
Simplified95.4%
Taylor expanded in x around 0 49.2%
unpow249.2%
associate-*r*49.9%
*-commutative49.9%
associate-*r*48.4%
*-commutative48.4%
unpow248.4%
unpow248.4%
swap-sqr56.4%
swap-sqr72.3%
unpow272.3%
associate-*r*74.6%
*-commutative74.6%
*-commutative74.6%
*-commutative74.6%
Simplified74.6%
unpow274.6%
associate-*l*73.2%
*-commutative73.2%
*-commutative73.2%
associate-*r*70.1%
*-commutative70.1%
associate-*l*72.6%
Applied egg-rr72.6%
Final simplification75.9%
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* x (* s c))))
(if (<= s 3e+167)
(/ 1.0 (* (* x c) (* s t_0)))
(/ 1.0 (* (* c t_0) (* s x))))))assert(c < s);
double code(double x, double c, double s) {
double t_0 = x * (s * c);
double tmp;
if (s <= 3e+167) {
tmp = 1.0 / ((x * c) * (s * t_0));
} else {
tmp = 1.0 / ((c * t_0) * (s * 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) :: t_0
real(8) :: tmp
t_0 = x * (s * c)
if (s <= 3d+167) then
tmp = 1.0d0 / ((x * c) * (s * t_0))
else
tmp = 1.0d0 / ((c * t_0) * (s * x))
end if
code = tmp
end function
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = x * (s * c);
double tmp;
if (s <= 3e+167) {
tmp = 1.0 / ((x * c) * (s * t_0));
} else {
tmp = 1.0 / ((c * t_0) * (s * x));
}
return tmp;
}
[c, s] = sort([c, s]) def code(x, c, s): t_0 = x * (s * c) tmp = 0 if s <= 3e+167: tmp = 1.0 / ((x * c) * (s * t_0)) else: tmp = 1.0 / ((c * t_0) * (s * x)) return tmp
c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(x * Float64(s * c)) tmp = 0.0 if (s <= 3e+167) tmp = Float64(1.0 / Float64(Float64(x * c) * Float64(s * t_0))); else tmp = Float64(1.0 / Float64(Float64(c * t_0) * Float64(s * x))); end return tmp end
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
t_0 = x * (s * c);
tmp = 0.0;
if (s <= 3e+167)
tmp = 1.0 / ((x * c) * (s * t_0));
else
tmp = 1.0 / ((c * t_0) * (s * x));
end
tmp_2 = tmp;
end
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(x * N[(s * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[s, 3e+167], N[(1.0 / N[(N[(x * c), $MachinePrecision] * N[(s * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(c * t$95$0), $MachinePrecision] * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := x \cdot \left(s \cdot c\right)\\
\mathbf{if}\;s \leq 3 \cdot 10^{+167}:\\
\;\;\;\;\frac{1}{\left(x \cdot c\right) \cdot \left(s \cdot t_0\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(c \cdot t_0\right) \cdot \left(s \cdot x\right)}\\
\end{array}
\end{array}
if s < 3.00000000000000012e167Initial program 62.3%
*-commutative62.3%
associate-*r*58.4%
associate-*r*59.6%
unpow259.6%
unswap-sqr74.3%
unpow274.3%
swap-sqr95.9%
*-commutative95.9%
*-commutative95.9%
*-commutative95.9%
*-commutative95.9%
Simplified95.9%
Taylor expanded in x around 0 52.4%
unpow252.4%
associate-*r*53.1%
*-commutative53.1%
associate-*r*52.2%
*-commutative52.2%
unpow252.2%
unpow252.2%
swap-sqr61.6%
swap-sqr76.1%
unpow276.1%
associate-*r*76.6%
*-commutative76.6%
*-commutative76.6%
*-commutative76.6%
Simplified76.6%
unpow276.6%
*-commutative76.6%
associate-*r*75.1%
associate-*r*74.2%
*-commutative74.2%
associate-*r*75.1%
*-commutative75.1%
associate-*l*73.7%
Applied egg-rr73.7%
if 3.00000000000000012e167 < s Initial program 51.3%
*-commutative51.3%
associate-*r*40.8%
associate-*r*40.6%
unpow240.6%
unswap-sqr56.4%
unpow256.4%
swap-sqr93.7%
*-commutative93.7%
*-commutative93.7%
*-commutative93.7%
*-commutative93.7%
Simplified93.7%
Taylor expanded in x around 0 40.8%
unpow240.8%
associate-*r*40.8%
*-commutative40.8%
associate-*r*40.6%
*-commutative40.6%
unpow240.6%
unpow240.6%
swap-sqr56.4%
swap-sqr83.6%
unpow283.6%
associate-*r*88.6%
*-commutative88.6%
*-commutative88.6%
*-commutative88.6%
Simplified88.6%
unpow288.6%
associate-*r*84.0%
*-commutative84.0%
associate-*r*83.0%
*-commutative83.0%
associate-*l*81.7%
*-commutative81.7%
Applied egg-rr81.7%
Final simplification75.0%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ 1.0 (* c (* (* c (* x x)) (* s s)))))
assert(c < s);
double code(double x, double c, double s) {
return 1.0 / (c * ((c * (x * x)) * (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 / (c * ((c * (x * x)) * (s * s)))
end function
assert c < s;
public static double code(double x, double c, double s) {
return 1.0 / (c * ((c * (x * x)) * (s * s)));
}
[c, s] = sort([c, s]) def code(x, c, s): return 1.0 / (c * ((c * (x * x)) * (s * s)))
c, s = sort([c, s]) function code(x, c, s) return Float64(1.0 / Float64(c * Float64(Float64(c * Float64(x * x)) * Float64(s * s)))) end
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = 1.0 / (c * ((c * (x * x)) * (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[(c * N[(N[(c * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{c \cdot \left(\left(c \cdot \left(x \cdot x\right)\right) \cdot \left(s \cdot s\right)\right)}
\end{array}
Initial program 60.6%
*-commutative60.6%
associate-*r*55.6%
associate-*r*56.7%
unpow256.7%
unswap-sqr71.5%
unpow271.5%
swap-sqr95.6%
*-commutative95.6%
*-commutative95.6%
*-commutative95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in x around 0 50.5%
unpow250.5%
associate-*r*51.1%
*-commutative51.1%
associate-*r*50.4%
*-commutative50.4%
unpow250.4%
unpow250.4%
swap-sqr60.8%
swap-sqr77.2%
unpow277.2%
associate-*r*78.5%
*-commutative78.5%
*-commutative78.5%
*-commutative78.5%
Simplified78.5%
unpow-prod-down63.0%
pow263.0%
*-commutative63.0%
unpow-prod-down50.5%
pow250.5%
pow250.5%
associate-*l*50.4%
associate-*l*54.1%
associate-*l*55.7%
Applied egg-rr55.7%
Final simplification55.7%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ 1.0 (* c (* (* x (* s c)) (* s x)))))
assert(c < s);
double code(double x, double c, double s) {
return 1.0 / (c * ((x * (s * 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 / (c * ((x * (s * c)) * (s * x)))
end function
assert c < s;
public static double code(double x, double c, double s) {
return 1.0 / (c * ((x * (s * c)) * (s * x)));
}
[c, s] = sort([c, s]) def code(x, c, s): return 1.0 / (c * ((x * (s * c)) * (s * x)))
c, s = sort([c, s]) function code(x, c, s) return Float64(1.0 / Float64(c * Float64(Float64(x * Float64(s * c)) * Float64(s * x)))) end
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = 1.0 / (c * ((x * (s * c)) * (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[(c * N[(N[(x * N[(s * c), $MachinePrecision]), $MachinePrecision] * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{c \cdot \left(\left(x \cdot \left(s \cdot c\right)\right) \cdot \left(s \cdot x\right)\right)}
\end{array}
Initial program 60.6%
*-commutative60.6%
associate-*r*55.6%
associate-*r*56.7%
unpow256.7%
unswap-sqr71.5%
unpow271.5%
swap-sqr95.6%
*-commutative95.6%
*-commutative95.6%
*-commutative95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in x around 0 50.5%
unpow250.5%
associate-*r*51.1%
*-commutative51.1%
associate-*r*50.4%
*-commutative50.4%
unpow250.4%
unpow250.4%
swap-sqr60.8%
swap-sqr77.2%
unpow277.2%
associate-*r*78.5%
*-commutative78.5%
*-commutative78.5%
*-commutative78.5%
Simplified78.5%
unpow278.5%
associate-*l*76.4%
*-commutative76.4%
*-commutative76.4%
associate-*r*74.1%
*-commutative74.1%
associate-*l*74.8%
Applied egg-rr74.8%
Final simplification74.8%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ 1.0 (* x (* (* s c) (* x (* s c))))))
assert(c < s);
double code(double x, double c, double s) {
return 1.0 / (x * ((s * c) * (x * (s * c))));
}
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 * ((s * c) * (x * (s * c))))
end function
assert c < s;
public static double code(double x, double c, double s) {
return 1.0 / (x * ((s * c) * (x * (s * c))));
}
[c, s] = sort([c, s]) def code(x, c, s): return 1.0 / (x * ((s * c) * (x * (s * c))))
c, s = sort([c, s]) function code(x, c, s) return Float64(1.0 / Float64(x * Float64(Float64(s * c) * Float64(x * Float64(s * c))))) end
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = 1.0 / (x * ((s * c) * (x * (s * c))));
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[(N[(s * c), $MachinePrecision] * N[(x * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{x \cdot \left(\left(s \cdot c\right) \cdot \left(x \cdot \left(s \cdot c\right)\right)\right)}
\end{array}
Initial program 60.6%
*-commutative60.6%
associate-*r*55.6%
associate-*r*56.7%
unpow256.7%
unswap-sqr71.5%
unpow271.5%
swap-sqr95.6%
*-commutative95.6%
*-commutative95.6%
*-commutative95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in x around 0 50.5%
unpow250.5%
associate-*r*51.1%
*-commutative51.1%
associate-*r*50.4%
*-commutative50.4%
unpow250.4%
unpow250.4%
swap-sqr60.8%
swap-sqr77.2%
unpow277.2%
associate-*r*78.5%
*-commutative78.5%
*-commutative78.5%
*-commutative78.5%
Simplified78.5%
unpow278.5%
associate-*r*77.0%
associate-*r*74.8%
*-commutative74.8%
associate-*r*73.5%
*-commutative73.5%
associate-*l*75.7%
Applied egg-rr75.7%
Final simplification75.7%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ (/ 1.0 (* c (* s x))) (* s (* x c))))
assert(c < s);
double code(double x, double c, double s) {
return (1.0 / (c * (s * x))) / (s * (x * c));
}
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))) / (s * (x * c))
end function
assert c < s;
public static double code(double x, double c, double s) {
return (1.0 / (c * (s * x))) / (s * (x * c));
}
[c, s] = sort([c, s]) def code(x, c, s): return (1.0 / (c * (s * x))) / (s * (x * c))
c, s = sort([c, s]) function code(x, c, s) return Float64(Float64(1.0 / Float64(c * Float64(s * x))) / Float64(s * Float64(x * c))) end
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = (1.0 / (c * (s * x))) / (s * (x * c));
end
NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[(N[(1.0 / N[(c * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{\frac{1}{c \cdot \left(s \cdot x\right)}}{s \cdot \left(x \cdot c\right)}
\end{array}
Initial program 60.6%
*-commutative60.6%
associate-*r*55.6%
associate-*r*56.7%
unpow256.7%
unswap-sqr71.5%
unpow271.5%
swap-sqr95.6%
*-commutative95.6%
*-commutative95.6%
*-commutative95.6%
*-commutative95.6%
Simplified95.6%
associate-/r*96.0%
div-inv96.0%
*-commutative96.0%
Applied egg-rr96.0%
un-div-inv96.0%
Applied egg-rr96.0%
Taylor expanded in s around 0 93.4%
Taylor expanded in x around 0 76.6%
Final simplification76.6%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ (/ (/ 1.0 s) (* x c)) (* s (* x c))))
assert(c < s);
double code(double x, double c, double s) {
return ((1.0 / s) / (x * c)) / (s * (x * c));
}
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) / (x * c)) / (s * (x * c))
end function
assert c < s;
public static double code(double x, double c, double s) {
return ((1.0 / s) / (x * c)) / (s * (x * c));
}
[c, s] = sort([c, s]) def code(x, c, s): return ((1.0 / s) / (x * c)) / (s * (x * c))
c, s = sort([c, s]) function code(x, c, s) return Float64(Float64(Float64(1.0 / s) / Float64(x * c)) / Float64(s * Float64(x * c))) end
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = ((1.0 / s) / (x * c)) / (s * (x * c));
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[(x * c), $MachinePrecision]), $MachinePrecision] / N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{\frac{\frac{1}{s}}{x \cdot c}}{s \cdot \left(x \cdot c\right)}
\end{array}
Initial program 60.6%
*-commutative60.6%
associate-*r*55.6%
associate-*r*56.7%
unpow256.7%
unswap-sqr71.5%
unpow271.5%
swap-sqr95.6%
*-commutative95.6%
*-commutative95.6%
*-commutative95.6%
*-commutative95.6%
Simplified95.6%
associate-/r*96.0%
div-inv96.0%
*-commutative96.0%
Applied egg-rr96.0%
un-div-inv96.0%
Applied egg-rr96.0%
Taylor expanded in s around 0 93.4%
Taylor expanded in x around 0 76.6%
associate-*r*76.0%
*-commutative76.0%
associate-*r*77.5%
associate-/r*77.5%
Simplified77.5%
Final simplification77.5%
NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ -2.0 (* (* s s) (* c c))))
assert(c < s);
double code(double x, double c, double s) {
return -2.0 / ((s * s) * (c * c));
}
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 = (-2.0d0) / ((s * s) * (c * c))
end function
assert c < s;
public static double code(double x, double c, double s) {
return -2.0 / ((s * s) * (c * c));
}
[c, s] = sort([c, s]) def code(x, c, s): return -2.0 / ((s * s) * (c * c))
c, s = sort([c, s]) function code(x, c, s) return Float64(-2.0 / Float64(Float64(s * s) * Float64(c * c))) end
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = -2.0 / ((s * s) * (c * c));
end
NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[(-2.0 / N[(N[(s * s), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{-2}{\left(s \cdot s\right) \cdot \left(c \cdot c\right)}
\end{array}
Initial program 60.6%
*-commutative60.6%
associate-*r*55.6%
associate-*r*56.7%
unpow256.7%
unswap-sqr71.5%
unpow271.5%
swap-sqr95.6%
*-commutative95.6%
*-commutative95.6%
*-commutative95.6%
*-commutative95.6%
Simplified95.6%
div-inv95.6%
*-commutative95.6%
pow295.6%
pow-flip95.9%
metadata-eval95.9%
Applied egg-rr95.9%
Taylor expanded in x around 0 28.7%
unpow228.7%
associate-*r*28.9%
*-commutative28.9%
associate-*r*28.3%
unpow228.3%
unpow228.3%
unpow228.3%
unpow228.3%
associate-*r/28.3%
metadata-eval28.3%
unpow228.3%
unpow228.3%
Simplified28.3%
Taylor expanded in x around inf 25.7%
*-commutative25.7%
unpow225.7%
unpow225.7%
Simplified25.7%
Final simplification25.7%
herbie shell --seed 2023187
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))