
(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 11 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}
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
:precision binary64
(let* ((t_0 (* s_m (* x_m c_m))) (t_1 (cos (* x_m -2.0))))
(if (<= x_m 50.0)
(* t_1 (pow (* c_m (* x_m s_m)) -2.0))
(/ (* t_1 (/ 1.0 t_0)) t_0))))x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
double t_0 = s_m * (x_m * c_m);
double t_1 = cos((x_m * -2.0));
double tmp;
if (x_m <= 50.0) {
tmp = t_1 * pow((c_m * (x_m * s_m)), -2.0);
} else {
tmp = (t_1 * (1.0 / t_0)) / t_0;
}
return tmp;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = s_m * (x_m * c_m)
t_1 = cos((x_m * (-2.0d0)))
if (x_m <= 50.0d0) then
tmp = t_1 * ((c_m * (x_m * s_m)) ** (-2.0d0))
else
tmp = (t_1 * (1.0d0 / t_0)) / t_0
end if
code = tmp
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
double t_0 = s_m * (x_m * c_m);
double t_1 = Math.cos((x_m * -2.0));
double tmp;
if (x_m <= 50.0) {
tmp = t_1 * Math.pow((c_m * (x_m * s_m)), -2.0);
} else {
tmp = (t_1 * (1.0 / t_0)) / t_0;
}
return tmp;
}
x_m = math.fabs(x) c_m = math.fabs(c) s_m = math.fabs(s) [x_m, c_m, s_m] = sort([x_m, c_m, s_m]) def code(x_m, c_m, s_m): t_0 = s_m * (x_m * c_m) t_1 = math.cos((x_m * -2.0)) tmp = 0 if x_m <= 50.0: tmp = t_1 * math.pow((c_m * (x_m * s_m)), -2.0) else: tmp = (t_1 * (1.0 / t_0)) / t_0 return tmp
x_m = abs(x) c_m = abs(c) s_m = abs(s) x_m, c_m, s_m = sort([x_m, c_m, s_m]) function code(x_m, c_m, s_m) t_0 = Float64(s_m * Float64(x_m * c_m)) t_1 = cos(Float64(x_m * -2.0)) tmp = 0.0 if (x_m <= 50.0) tmp = Float64(t_1 * (Float64(c_m * Float64(x_m * s_m)) ^ -2.0)); else tmp = Float64(Float64(t_1 * Float64(1.0 / t_0)) / t_0); end return tmp end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp_2 = code(x_m, c_m, s_m)
t_0 = s_m * (x_m * c_m);
t_1 = cos((x_m * -2.0));
tmp = 0.0;
if (x_m <= 50.0)
tmp = t_1 * ((c_m * (x_m * s_m)) ^ -2.0);
else
tmp = (t_1 * (1.0 / t_0)) / t_0;
end
tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[(s$95$m * N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(x$95$m * -2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$95$m, 50.0], N[(t$95$1 * N[Power[N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := s\_m \cdot \left(x\_m \cdot c\_m\right)\\
t_1 := \cos \left(x\_m \cdot -2\right)\\
\mathbf{if}\;x\_m \leq 50:\\
\;\;\;\;t\_1 \cdot {\left(c\_m \cdot \left(x\_m \cdot s\_m\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1 \cdot \frac{1}{t\_0}}{t\_0}\\
\end{array}
\end{array}
if x < 50Initial program 67.9%
associate-/r*67.9%
cos-neg67.9%
distribute-rgt-neg-out67.9%
distribute-rgt-neg-out67.9%
*-commutative67.9%
distribute-rgt-neg-in67.9%
metadata-eval67.9%
*-commutative67.9%
associate-*l*61.5%
unpow261.5%
Simplified61.5%
Taylor expanded in x around inf 61.5%
associate-/r*61.5%
*-commutative61.5%
*-commutative61.5%
unpow261.5%
unpow261.5%
swap-sqr77.1%
unpow277.1%
associate-/l/77.4%
unpow277.4%
unpow277.4%
swap-sqr96.7%
unpow296.7%
*-commutative96.7%
associate-*l*97.4%
Simplified97.4%
div-inv97.4%
pow-flip98.3%
*-commutative98.3%
associate-*l*95.6%
metadata-eval95.6%
Applied egg-rr95.6%
*-commutative95.6%
associate-*r*97.6%
Simplified97.6%
if 50 < x Initial program 57.1%
associate-/r*56.7%
cos-neg56.7%
distribute-rgt-neg-out56.7%
distribute-rgt-neg-out56.7%
*-commutative56.7%
distribute-rgt-neg-in56.7%
metadata-eval56.7%
*-commutative56.7%
associate-*l*50.6%
unpow250.6%
Simplified50.6%
div-inv50.5%
add-sqr-sqrt50.5%
times-frac50.5%
pow-prod-down50.6%
sqrt-pow144.4%
metadata-eval44.4%
pow144.4%
*-commutative44.4%
pow-flip44.3%
metadata-eval44.3%
pow-prod-down51.6%
sqrt-pow176.5%
metadata-eval76.5%
pow176.5%
*-commutative76.5%
Applied egg-rr76.5%
sqr-pow76.4%
associate-/l*84.9%
metadata-eval84.9%
unpow-185.0%
metadata-eval85.0%
unpow-185.0%
Applied egg-rr85.0%
*-commutative85.0%
associate-*l/85.0%
*-un-lft-identity85.0%
frac-times91.5%
associate-/l/91.4%
*-commutative91.4%
associate-*r*87.1%
associate-*r*95.1%
*-commutative95.1%
*-commutative95.1%
Applied egg-rr95.1%
Final simplification96.9%
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
:precision binary64
(let* ((t_0 (cos (* x_m -2.0))) (t_1 (* x_m (* c_m s_m))))
(if (<= (pow c_m 2.0) 0.0)
(* (/ 1.0 t_1) (/ t_0 t_1))
(* (/ t_0 (* x_m s_m)) (/ (/ 1.0 c_m) (* c_m (* x_m s_m)))))))x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
double t_0 = cos((x_m * -2.0));
double t_1 = x_m * (c_m * s_m);
double tmp;
if (pow(c_m, 2.0) <= 0.0) {
tmp = (1.0 / t_1) * (t_0 / t_1);
} else {
tmp = (t_0 / (x_m * s_m)) * ((1.0 / c_m) / (c_m * (x_m * s_m)));
}
return tmp;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((x_m * (-2.0d0)))
t_1 = x_m * (c_m * s_m)
if ((c_m ** 2.0d0) <= 0.0d0) then
tmp = (1.0d0 / t_1) * (t_0 / t_1)
else
tmp = (t_0 / (x_m * s_m)) * ((1.0d0 / c_m) / (c_m * (x_m * s_m)))
end if
code = tmp
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
double t_0 = Math.cos((x_m * -2.0));
double t_1 = x_m * (c_m * s_m);
double tmp;
if (Math.pow(c_m, 2.0) <= 0.0) {
tmp = (1.0 / t_1) * (t_0 / t_1);
} else {
tmp = (t_0 / (x_m * s_m)) * ((1.0 / c_m) / (c_m * (x_m * s_m)));
}
return tmp;
}
x_m = math.fabs(x) c_m = math.fabs(c) s_m = math.fabs(s) [x_m, c_m, s_m] = sort([x_m, c_m, s_m]) def code(x_m, c_m, s_m): t_0 = math.cos((x_m * -2.0)) t_1 = x_m * (c_m * s_m) tmp = 0 if math.pow(c_m, 2.0) <= 0.0: tmp = (1.0 / t_1) * (t_0 / t_1) else: tmp = (t_0 / (x_m * s_m)) * ((1.0 / c_m) / (c_m * (x_m * s_m))) return tmp
x_m = abs(x) c_m = abs(c) s_m = abs(s) x_m, c_m, s_m = sort([x_m, c_m, s_m]) function code(x_m, c_m, s_m) t_0 = cos(Float64(x_m * -2.0)) t_1 = Float64(x_m * Float64(c_m * s_m)) tmp = 0.0 if ((c_m ^ 2.0) <= 0.0) tmp = Float64(Float64(1.0 / t_1) * Float64(t_0 / t_1)); else tmp = Float64(Float64(t_0 / Float64(x_m * s_m)) * Float64(Float64(1.0 / c_m) / Float64(c_m * Float64(x_m * s_m)))); end return tmp end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp_2 = code(x_m, c_m, s_m)
t_0 = cos((x_m * -2.0));
t_1 = x_m * (c_m * s_m);
tmp = 0.0;
if ((c_m ^ 2.0) <= 0.0)
tmp = (1.0 / t_1) * (t_0 / t_1);
else
tmp = (t_0 / (x_m * s_m)) * ((1.0 / c_m) / (c_m * (x_m * s_m)));
end
tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[Cos[N[(x$95$m * -2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(x$95$m * N[(c$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[c$95$m, 2.0], $MachinePrecision], 0.0], N[(N[(1.0 / t$95$1), $MachinePrecision] * N[(t$95$0 / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / c$95$m), $MachinePrecision] / N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := \cos \left(x\_m \cdot -2\right)\\
t_1 := x\_m \cdot \left(c\_m \cdot s\_m\right)\\
\mathbf{if}\;{c\_m}^{2} \leq 0:\\
\;\;\;\;\frac{1}{t\_1} \cdot \frac{t\_0}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{x\_m \cdot s\_m} \cdot \frac{\frac{1}{c\_m}}{c\_m \cdot \left(x\_m \cdot s\_m\right)}\\
\end{array}
\end{array}
if (pow.f64 c #s(literal 2 binary64)) < 0.0Initial program 57.3%
associate-/r*57.3%
cos-neg57.3%
distribute-rgt-neg-out57.3%
distribute-rgt-neg-out57.3%
*-commutative57.3%
distribute-rgt-neg-in57.3%
metadata-eval57.3%
*-commutative57.3%
associate-*l*51.0%
unpow251.0%
Simplified51.0%
Taylor expanded in x around inf 51.0%
associate-/r*51.0%
*-commutative51.0%
*-commutative51.0%
unpow251.0%
unpow251.0%
swap-sqr69.3%
unpow269.3%
associate-/l/69.3%
unpow269.3%
unpow269.3%
swap-sqr90.5%
unpow290.5%
*-commutative90.5%
associate-*l*97.4%
Simplified97.4%
*-un-lft-identity97.4%
unpow297.4%
times-frac98.4%
*-commutative98.4%
associate-*l*97.4%
*-commutative97.4%
associate-*l*98.7%
Applied egg-rr98.7%
if 0.0 < (pow.f64 c #s(literal 2 binary64)) Initial program 67.7%
associate-/r*67.6%
cos-neg67.6%
distribute-rgt-neg-out67.6%
distribute-rgt-neg-out67.6%
*-commutative67.6%
distribute-rgt-neg-in67.6%
metadata-eval67.6%
*-commutative67.6%
associate-*l*61.3%
unpow261.3%
Simplified61.3%
div-inv61.3%
add-sqr-sqrt61.2%
times-frac61.2%
pow-prod-down61.2%
sqrt-pow149.0%
metadata-eval49.0%
pow149.0%
*-commutative49.0%
pow-flip49.0%
metadata-eval49.0%
pow-prod-down57.9%
sqrt-pow183.7%
metadata-eval83.7%
pow183.7%
*-commutative83.7%
Applied egg-rr83.7%
sqr-pow83.6%
times-frac91.4%
metadata-eval91.4%
unpow-191.4%
metadata-eval91.4%
unpow-191.5%
Applied egg-rr91.5%
associate-/l/91.4%
frac-times92.7%
*-un-lft-identity92.7%
*-commutative92.7%
associate-*l*95.0%
Applied egg-rr95.0%
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
:precision binary64
(let* ((t_0 (cos (* x_m -2.0))))
(if (<= x_m 2.8e-16)
(pow (* c_m (* x_m s_m)) -2.0)
(if (<= x_m 5.4e+130)
(/ (/ t_0 x_m) (* s_m (* (* x_m c_m) (* c_m s_m))))
(/ (/ t_0 (* x_m c_m)) (* s_m (* s_m (* x_m c_m))))))))x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
double t_0 = cos((x_m * -2.0));
double tmp;
if (x_m <= 2.8e-16) {
tmp = pow((c_m * (x_m * s_m)), -2.0);
} else if (x_m <= 5.4e+130) {
tmp = (t_0 / x_m) / (s_m * ((x_m * c_m) * (c_m * s_m)));
} else {
tmp = (t_0 / (x_m * c_m)) / (s_m * (s_m * (x_m * c_m)));
}
return tmp;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
real(8) :: t_0
real(8) :: tmp
t_0 = cos((x_m * (-2.0d0)))
if (x_m <= 2.8d-16) then
tmp = (c_m * (x_m * s_m)) ** (-2.0d0)
else if (x_m <= 5.4d+130) then
tmp = (t_0 / x_m) / (s_m * ((x_m * c_m) * (c_m * s_m)))
else
tmp = (t_0 / (x_m * c_m)) / (s_m * (s_m * (x_m * c_m)))
end if
code = tmp
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
double t_0 = Math.cos((x_m * -2.0));
double tmp;
if (x_m <= 2.8e-16) {
tmp = Math.pow((c_m * (x_m * s_m)), -2.0);
} else if (x_m <= 5.4e+130) {
tmp = (t_0 / x_m) / (s_m * ((x_m * c_m) * (c_m * s_m)));
} else {
tmp = (t_0 / (x_m * c_m)) / (s_m * (s_m * (x_m * c_m)));
}
return tmp;
}
x_m = math.fabs(x) c_m = math.fabs(c) s_m = math.fabs(s) [x_m, c_m, s_m] = sort([x_m, c_m, s_m]) def code(x_m, c_m, s_m): t_0 = math.cos((x_m * -2.0)) tmp = 0 if x_m <= 2.8e-16: tmp = math.pow((c_m * (x_m * s_m)), -2.0) elif x_m <= 5.4e+130: tmp = (t_0 / x_m) / (s_m * ((x_m * c_m) * (c_m * s_m))) else: tmp = (t_0 / (x_m * c_m)) / (s_m * (s_m * (x_m * c_m))) return tmp
x_m = abs(x) c_m = abs(c) s_m = abs(s) x_m, c_m, s_m = sort([x_m, c_m, s_m]) function code(x_m, c_m, s_m) t_0 = cos(Float64(x_m * -2.0)) tmp = 0.0 if (x_m <= 2.8e-16) tmp = Float64(c_m * Float64(x_m * s_m)) ^ -2.0; elseif (x_m <= 5.4e+130) tmp = Float64(Float64(t_0 / x_m) / Float64(s_m * Float64(Float64(x_m * c_m) * Float64(c_m * s_m)))); else tmp = Float64(Float64(t_0 / Float64(x_m * c_m)) / Float64(s_m * Float64(s_m * Float64(x_m * c_m)))); end return tmp end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp_2 = code(x_m, c_m, s_m)
t_0 = cos((x_m * -2.0));
tmp = 0.0;
if (x_m <= 2.8e-16)
tmp = (c_m * (x_m * s_m)) ^ -2.0;
elseif (x_m <= 5.4e+130)
tmp = (t_0 / x_m) / (s_m * ((x_m * c_m) * (c_m * s_m)));
else
tmp = (t_0 / (x_m * c_m)) / (s_m * (s_m * (x_m * c_m)));
end
tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[Cos[N[(x$95$m * -2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$95$m, 2.8e-16], N[Power[N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], If[LessEqual[x$95$m, 5.4e+130], N[(N[(t$95$0 / x$95$m), $MachinePrecision] / N[(s$95$m * N[(N[(x$95$m * c$95$m), $MachinePrecision] * N[(c$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision] / N[(s$95$m * N[(s$95$m * N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := \cos \left(x\_m \cdot -2\right)\\
\mathbf{if}\;x\_m \leq 2.8 \cdot 10^{-16}:\\
\;\;\;\;{\left(c\_m \cdot \left(x\_m \cdot s\_m\right)\right)}^{-2}\\
\mathbf{elif}\;x\_m \leq 5.4 \cdot 10^{+130}:\\
\;\;\;\;\frac{\frac{t\_0}{x\_m}}{s\_m \cdot \left(\left(x\_m \cdot c\_m\right) \cdot \left(c\_m \cdot s\_m\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{x\_m \cdot c\_m}}{s\_m \cdot \left(s\_m \cdot \left(x\_m \cdot c\_m\right)\right)}\\
\end{array}
\end{array}
if x < 2.8000000000000001e-16Initial program 67.0%
associate-/r*67.0%
cos-neg67.0%
distribute-rgt-neg-out67.0%
distribute-rgt-neg-out67.0%
*-commutative67.0%
distribute-rgt-neg-in67.0%
metadata-eval67.0%
*-commutative67.0%
associate-*l*60.5%
unpow260.5%
Simplified60.5%
div-inv60.5%
add-sqr-sqrt60.4%
times-frac60.4%
pow-prod-down60.4%
sqrt-pow142.4%
metadata-eval42.4%
pow142.4%
*-commutative42.4%
pow-flip42.4%
metadata-eval42.4%
pow-prod-down52.3%
sqrt-pow180.8%
metadata-eval80.8%
pow180.8%
*-commutative80.8%
Applied egg-rr80.8%
Taylor expanded in x around 0 71.9%
Taylor expanded in x around 0 55.9%
*-commutative55.9%
*-commutative55.9%
unpow255.9%
unpow255.9%
swap-sqr69.1%
unpow269.1%
swap-sqr84.7%
*-commutative84.7%
associate-*r*84.3%
*-commutative84.3%
associate-*r*85.9%
unpow285.9%
exp-to-pow55.1%
*-commutative55.1%
exp-neg55.2%
*-commutative55.2%
distribute-rgt-neg-in55.2%
metadata-eval55.2%
exp-to-pow86.5%
Simplified85.3%
if 2.8000000000000001e-16 < x < 5.3999999999999997e130Initial program 55.7%
associate-/r*55.7%
cos-neg55.7%
distribute-rgt-neg-out55.7%
distribute-rgt-neg-out55.7%
*-commutative55.7%
distribute-rgt-neg-in55.7%
metadata-eval55.7%
*-commutative55.7%
associate-*l*55.8%
unpow255.8%
Simplified55.8%
div-inv55.7%
add-sqr-sqrt55.7%
times-frac55.7%
pow-prod-down55.8%
sqrt-pow137.8%
metadata-eval37.8%
pow137.8%
*-commutative37.8%
pow-flip37.8%
metadata-eval37.8%
pow-prod-down37.8%
sqrt-pow171.6%
metadata-eval71.6%
pow171.6%
*-commutative71.6%
Applied egg-rr71.6%
sqr-pow71.7%
associate-/l*78.3%
metadata-eval78.3%
unpow-178.4%
metadata-eval78.4%
unpow-178.4%
Applied egg-rr78.4%
Applied egg-rr86.4%
if 5.3999999999999997e130 < x Initial program 63.9%
associate-/r*63.2%
cos-neg63.2%
distribute-rgt-neg-out63.2%
distribute-rgt-neg-out63.2%
*-commutative63.2%
distribute-rgt-neg-in63.2%
metadata-eval63.2%
*-commutative63.2%
associate-*l*52.2%
unpow252.2%
Simplified52.2%
div-inv52.2%
add-sqr-sqrt52.2%
times-frac52.2%
pow-prod-down52.2%
sqrt-pow152.2%
metadata-eval52.2%
pow152.2%
*-commutative52.2%
pow-flip52.2%
metadata-eval52.2%
pow-prod-down65.0%
sqrt-pow183.8%
metadata-eval83.8%
pow183.8%
*-commutative83.8%
Applied egg-rr83.8%
sqr-pow83.7%
associate-/l*92.8%
metadata-eval92.8%
unpow-192.8%
metadata-eval92.8%
unpow-192.8%
Applied egg-rr92.8%
associate-/r*92.8%
frac-times92.8%
*-un-lft-identity92.8%
frac-times89.6%
div-inv89.6%
associate-*r*89.6%
div-inv89.6%
associate-/l/89.6%
*-commutative89.6%
un-div-inv89.6%
associate-*r*89.6%
*-commutative89.6%
*-commutative89.6%
Applied egg-rr89.6%
Final simplification86.1%
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
:precision binary64
(let* ((t_0 (* s_m (* x_m c_m))))
(if (<= x_m 2.8e-16)
(pow (* c_m (* x_m s_m)) -2.0)
(/ (* (cos (* x_m -2.0)) (/ 1.0 t_0)) t_0))))x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
double t_0 = s_m * (x_m * c_m);
double tmp;
if (x_m <= 2.8e-16) {
tmp = pow((c_m * (x_m * s_m)), -2.0);
} else {
tmp = (cos((x_m * -2.0)) * (1.0 / t_0)) / t_0;
}
return tmp;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
real(8) :: t_0
real(8) :: tmp
t_0 = s_m * (x_m * c_m)
if (x_m <= 2.8d-16) then
tmp = (c_m * (x_m * s_m)) ** (-2.0d0)
else
tmp = (cos((x_m * (-2.0d0))) * (1.0d0 / t_0)) / t_0
end if
code = tmp
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
double t_0 = s_m * (x_m * c_m);
double tmp;
if (x_m <= 2.8e-16) {
tmp = Math.pow((c_m * (x_m * s_m)), -2.0);
} else {
tmp = (Math.cos((x_m * -2.0)) * (1.0 / t_0)) / t_0;
}
return tmp;
}
x_m = math.fabs(x) c_m = math.fabs(c) s_m = math.fabs(s) [x_m, c_m, s_m] = sort([x_m, c_m, s_m]) def code(x_m, c_m, s_m): t_0 = s_m * (x_m * c_m) tmp = 0 if x_m <= 2.8e-16: tmp = math.pow((c_m * (x_m * s_m)), -2.0) else: tmp = (math.cos((x_m * -2.0)) * (1.0 / t_0)) / t_0 return tmp
x_m = abs(x) c_m = abs(c) s_m = abs(s) x_m, c_m, s_m = sort([x_m, c_m, s_m]) function code(x_m, c_m, s_m) t_0 = Float64(s_m * Float64(x_m * c_m)) tmp = 0.0 if (x_m <= 2.8e-16) tmp = Float64(c_m * Float64(x_m * s_m)) ^ -2.0; else tmp = Float64(Float64(cos(Float64(x_m * -2.0)) * Float64(1.0 / t_0)) / t_0); end return tmp end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp_2 = code(x_m, c_m, s_m)
t_0 = s_m * (x_m * c_m);
tmp = 0.0;
if (x_m <= 2.8e-16)
tmp = (c_m * (x_m * s_m)) ^ -2.0;
else
tmp = (cos((x_m * -2.0)) * (1.0 / t_0)) / t_0;
end
tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[(s$95$m * N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$95$m, 2.8e-16], N[Power[N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], N[(N[(N[Cos[N[(x$95$m * -2.0), $MachinePrecision]], $MachinePrecision] * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := s\_m \cdot \left(x\_m \cdot c\_m\right)\\
\mathbf{if}\;x\_m \leq 2.8 \cdot 10^{-16}:\\
\;\;\;\;{\left(c\_m \cdot \left(x\_m \cdot s\_m\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x\_m \cdot -2\right) \cdot \frac{1}{t\_0}}{t\_0}\\
\end{array}
\end{array}
if x < 2.8000000000000001e-16Initial program 67.0%
associate-/r*67.0%
cos-neg67.0%
distribute-rgt-neg-out67.0%
distribute-rgt-neg-out67.0%
*-commutative67.0%
distribute-rgt-neg-in67.0%
metadata-eval67.0%
*-commutative67.0%
associate-*l*60.5%
unpow260.5%
Simplified60.5%
div-inv60.5%
add-sqr-sqrt60.4%
times-frac60.4%
pow-prod-down60.4%
sqrt-pow142.4%
metadata-eval42.4%
pow142.4%
*-commutative42.4%
pow-flip42.4%
metadata-eval42.4%
pow-prod-down52.3%
sqrt-pow180.8%
metadata-eval80.8%
pow180.8%
*-commutative80.8%
Applied egg-rr80.8%
Taylor expanded in x around 0 71.9%
Taylor expanded in x around 0 55.9%
*-commutative55.9%
*-commutative55.9%
unpow255.9%
unpow255.9%
swap-sqr69.1%
unpow269.1%
swap-sqr84.7%
*-commutative84.7%
associate-*r*84.3%
*-commutative84.3%
associate-*r*85.9%
unpow285.9%
exp-to-pow55.1%
*-commutative55.1%
exp-neg55.2%
*-commutative55.2%
distribute-rgt-neg-in55.2%
metadata-eval55.2%
exp-to-pow86.5%
Simplified85.3%
if 2.8000000000000001e-16 < x Initial program 60.0%
associate-/r*59.6%
cos-neg59.6%
distribute-rgt-neg-out59.6%
distribute-rgt-neg-out59.6%
*-commutative59.6%
distribute-rgt-neg-in59.6%
metadata-eval59.6%
*-commutative59.6%
associate-*l*53.9%
unpow253.9%
Simplified53.9%
div-inv53.9%
add-sqr-sqrt53.9%
times-frac53.9%
pow-prod-down53.9%
sqrt-pow145.4%
metadata-eval45.4%
pow145.4%
*-commutative45.4%
pow-flip45.4%
metadata-eval45.4%
pow-prod-down52.2%
sqrt-pow178.0%
metadata-eval78.0%
pow178.0%
*-commutative78.0%
Applied egg-rr78.0%
sqr-pow78.0%
associate-/l*86.0%
metadata-eval86.0%
unpow-186.0%
metadata-eval86.0%
unpow-186.0%
Applied egg-rr86.0%
*-commutative86.0%
associate-*l/86.0%
*-un-lft-identity86.0%
frac-times92.1%
associate-/l/91.9%
*-commutative91.9%
associate-*r*88.0%
associate-*r*95.5%
*-commutative95.5%
*-commutative95.5%
Applied egg-rr95.5%
Final simplification88.3%
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
:precision binary64
(let* ((t_0 (* x_m (* c_m s_m))))
(if (<= x_m 2.5e-16)
(pow (* c_m (* x_m s_m)) -2.0)
(* (/ 1.0 t_0) (/ (cos (* x_m -2.0)) t_0)))))x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
double t_0 = x_m * (c_m * s_m);
double tmp;
if (x_m <= 2.5e-16) {
tmp = pow((c_m * (x_m * s_m)), -2.0);
} else {
tmp = (1.0 / t_0) * (cos((x_m * -2.0)) / t_0);
}
return tmp;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
real(8) :: t_0
real(8) :: tmp
t_0 = x_m * (c_m * s_m)
if (x_m <= 2.5d-16) then
tmp = (c_m * (x_m * s_m)) ** (-2.0d0)
else
tmp = (1.0d0 / t_0) * (cos((x_m * (-2.0d0))) / t_0)
end if
code = tmp
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
double t_0 = x_m * (c_m * s_m);
double tmp;
if (x_m <= 2.5e-16) {
tmp = Math.pow((c_m * (x_m * s_m)), -2.0);
} else {
tmp = (1.0 / t_0) * (Math.cos((x_m * -2.0)) / t_0);
}
return tmp;
}
x_m = math.fabs(x) c_m = math.fabs(c) s_m = math.fabs(s) [x_m, c_m, s_m] = sort([x_m, c_m, s_m]) def code(x_m, c_m, s_m): t_0 = x_m * (c_m * s_m) tmp = 0 if x_m <= 2.5e-16: tmp = math.pow((c_m * (x_m * s_m)), -2.0) else: tmp = (1.0 / t_0) * (math.cos((x_m * -2.0)) / t_0) return tmp
x_m = abs(x) c_m = abs(c) s_m = abs(s) x_m, c_m, s_m = sort([x_m, c_m, s_m]) function code(x_m, c_m, s_m) t_0 = Float64(x_m * Float64(c_m * s_m)) tmp = 0.0 if (x_m <= 2.5e-16) tmp = Float64(c_m * Float64(x_m * s_m)) ^ -2.0; else tmp = Float64(Float64(1.0 / t_0) * Float64(cos(Float64(x_m * -2.0)) / t_0)); end return tmp end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp_2 = code(x_m, c_m, s_m)
t_0 = x_m * (c_m * s_m);
tmp = 0.0;
if (x_m <= 2.5e-16)
tmp = (c_m * (x_m * s_m)) ^ -2.0;
else
tmp = (1.0 / t_0) * (cos((x_m * -2.0)) / t_0);
end
tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[(x$95$m * N[(c$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$95$m, 2.5e-16], N[Power[N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(N[Cos[N[(x$95$m * -2.0), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := x\_m \cdot \left(c\_m \cdot s\_m\right)\\
\mathbf{if}\;x\_m \leq 2.5 \cdot 10^{-16}:\\
\;\;\;\;{\left(c\_m \cdot \left(x\_m \cdot s\_m\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_0} \cdot \frac{\cos \left(x\_m \cdot -2\right)}{t\_0}\\
\end{array}
\end{array}
if x < 2.5000000000000002e-16Initial program 67.0%
associate-/r*67.0%
cos-neg67.0%
distribute-rgt-neg-out67.0%
distribute-rgt-neg-out67.0%
*-commutative67.0%
distribute-rgt-neg-in67.0%
metadata-eval67.0%
*-commutative67.0%
associate-*l*60.5%
unpow260.5%
Simplified60.5%
div-inv60.5%
add-sqr-sqrt60.4%
times-frac60.4%
pow-prod-down60.4%
sqrt-pow142.4%
metadata-eval42.4%
pow142.4%
*-commutative42.4%
pow-flip42.4%
metadata-eval42.4%
pow-prod-down52.3%
sqrt-pow180.8%
metadata-eval80.8%
pow180.8%
*-commutative80.8%
Applied egg-rr80.8%
Taylor expanded in x around 0 71.9%
Taylor expanded in x around 0 55.9%
*-commutative55.9%
*-commutative55.9%
unpow255.9%
unpow255.9%
swap-sqr69.1%
unpow269.1%
swap-sqr84.7%
*-commutative84.7%
associate-*r*84.3%
*-commutative84.3%
associate-*r*85.9%
unpow285.9%
exp-to-pow55.1%
*-commutative55.1%
exp-neg55.2%
*-commutative55.2%
distribute-rgt-neg-in55.2%
metadata-eval55.2%
exp-to-pow86.5%
Simplified85.3%
if 2.5000000000000002e-16 < x Initial program 60.0%
associate-/r*59.6%
cos-neg59.6%
distribute-rgt-neg-out59.6%
distribute-rgt-neg-out59.6%
*-commutative59.6%
distribute-rgt-neg-in59.6%
metadata-eval59.6%
*-commutative59.6%
associate-*l*53.9%
unpow253.9%
Simplified53.9%
Taylor expanded in x around inf 54.0%
associate-/r*53.9%
*-commutative53.9%
*-commutative53.9%
unpow253.9%
unpow253.9%
swap-sqr67.8%
unpow267.8%
associate-/l/68.2%
unpow268.2%
unpow268.2%
swap-sqr91.7%
unpow291.7%
*-commutative91.7%
associate-*l*95.4%
Simplified95.4%
*-un-lft-identity95.4%
unpow295.4%
times-frac95.5%
*-commutative95.5%
associate-*l*93.3%
*-commutative93.3%
associate-*l*97.3%
Applied egg-rr97.3%
Final simplification88.8%
x_m = (fabs.f64 x) c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x_m c_m s_m) :precision binary64 (if (<= x_m 2.8e-16) (pow (* c_m (* x_m s_m)) -2.0) (/ (/ (cos (* x_m -2.0)) x_m) (* s_m (* (* x_m c_m) (* c_m s_m))))))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
double tmp;
if (x_m <= 2.8e-16) {
tmp = pow((c_m * (x_m * s_m)), -2.0);
} else {
tmp = (cos((x_m * -2.0)) / x_m) / (s_m * ((x_m * c_m) * (c_m * s_m)));
}
return tmp;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
real(8) :: tmp
if (x_m <= 2.8d-16) then
tmp = (c_m * (x_m * s_m)) ** (-2.0d0)
else
tmp = (cos((x_m * (-2.0d0))) / x_m) / (s_m * ((x_m * c_m) * (c_m * s_m)))
end if
code = tmp
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
double tmp;
if (x_m <= 2.8e-16) {
tmp = Math.pow((c_m * (x_m * s_m)), -2.0);
} else {
tmp = (Math.cos((x_m * -2.0)) / x_m) / (s_m * ((x_m * c_m) * (c_m * s_m)));
}
return tmp;
}
x_m = math.fabs(x) c_m = math.fabs(c) s_m = math.fabs(s) [x_m, c_m, s_m] = sort([x_m, c_m, s_m]) def code(x_m, c_m, s_m): tmp = 0 if x_m <= 2.8e-16: tmp = math.pow((c_m * (x_m * s_m)), -2.0) else: tmp = (math.cos((x_m * -2.0)) / x_m) / (s_m * ((x_m * c_m) * (c_m * s_m))) return tmp
x_m = abs(x) c_m = abs(c) s_m = abs(s) x_m, c_m, s_m = sort([x_m, c_m, s_m]) function code(x_m, c_m, s_m) tmp = 0.0 if (x_m <= 2.8e-16) tmp = Float64(c_m * Float64(x_m * s_m)) ^ -2.0; else tmp = Float64(Float64(cos(Float64(x_m * -2.0)) / x_m) / Float64(s_m * Float64(Float64(x_m * c_m) * Float64(c_m * s_m)))); end return tmp end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp_2 = code(x_m, c_m, s_m)
tmp = 0.0;
if (x_m <= 2.8e-16)
tmp = (c_m * (x_m * s_m)) ^ -2.0;
else
tmp = (cos((x_m * -2.0)) / x_m) / (s_m * ((x_m * c_m) * (c_m * s_m)));
end
tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision] c_m = N[Abs[c], $MachinePrecision] s_m = N[Abs[s], $MachinePrecision] NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function. code[x$95$m_, c$95$m_, s$95$m_] := If[LessEqual[x$95$m, 2.8e-16], N[Power[N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], N[(N[(N[Cos[N[(x$95$m * -2.0), $MachinePrecision]], $MachinePrecision] / x$95$m), $MachinePrecision] / N[(s$95$m * N[(N[(x$95$m * c$95$m), $MachinePrecision] * N[(c$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 2.8 \cdot 10^{-16}:\\
\;\;\;\;{\left(c\_m \cdot \left(x\_m \cdot s\_m\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cos \left(x\_m \cdot -2\right)}{x\_m}}{s\_m \cdot \left(\left(x\_m \cdot c\_m\right) \cdot \left(c\_m \cdot s\_m\right)\right)}\\
\end{array}
\end{array}
if x < 2.8000000000000001e-16Initial program 67.0%
associate-/r*67.0%
cos-neg67.0%
distribute-rgt-neg-out67.0%
distribute-rgt-neg-out67.0%
*-commutative67.0%
distribute-rgt-neg-in67.0%
metadata-eval67.0%
*-commutative67.0%
associate-*l*60.5%
unpow260.5%
Simplified60.5%
div-inv60.5%
add-sqr-sqrt60.4%
times-frac60.4%
pow-prod-down60.4%
sqrt-pow142.4%
metadata-eval42.4%
pow142.4%
*-commutative42.4%
pow-flip42.4%
metadata-eval42.4%
pow-prod-down52.3%
sqrt-pow180.8%
metadata-eval80.8%
pow180.8%
*-commutative80.8%
Applied egg-rr80.8%
Taylor expanded in x around 0 71.9%
Taylor expanded in x around 0 55.9%
*-commutative55.9%
*-commutative55.9%
unpow255.9%
unpow255.9%
swap-sqr69.1%
unpow269.1%
swap-sqr84.7%
*-commutative84.7%
associate-*r*84.3%
*-commutative84.3%
associate-*r*85.9%
unpow285.9%
exp-to-pow55.1%
*-commutative55.1%
exp-neg55.2%
*-commutative55.2%
distribute-rgt-neg-in55.2%
metadata-eval55.2%
exp-to-pow86.5%
Simplified85.3%
if 2.8000000000000001e-16 < x Initial program 60.0%
associate-/r*59.6%
cos-neg59.6%
distribute-rgt-neg-out59.6%
distribute-rgt-neg-out59.6%
*-commutative59.6%
distribute-rgt-neg-in59.6%
metadata-eval59.6%
*-commutative59.6%
associate-*l*53.9%
unpow253.9%
Simplified53.9%
div-inv53.9%
add-sqr-sqrt53.9%
times-frac53.9%
pow-prod-down53.9%
sqrt-pow145.4%
metadata-eval45.4%
pow145.4%
*-commutative45.4%
pow-flip45.4%
metadata-eval45.4%
pow-prod-down52.2%
sqrt-pow178.0%
metadata-eval78.0%
pow178.0%
*-commutative78.0%
Applied egg-rr78.0%
sqr-pow78.0%
associate-/l*86.0%
metadata-eval86.0%
unpow-186.0%
metadata-eval86.0%
unpow-186.0%
Applied egg-rr86.0%
Applied egg-rr83.2%
Final simplification84.7%
x_m = (fabs.f64 x) c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x_m c_m s_m) :precision binary64 (if (<= x_m 3.5e-102) (pow (* c_m (* x_m s_m)) -2.0) (/ (/ (cos (* x_m -2.0)) (* (* x_m c_m) (* x_m s_m))) (* c_m s_m))))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
double tmp;
if (x_m <= 3.5e-102) {
tmp = pow((c_m * (x_m * s_m)), -2.0);
} else {
tmp = (cos((x_m * -2.0)) / ((x_m * c_m) * (x_m * s_m))) / (c_m * s_m);
}
return tmp;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
real(8) :: tmp
if (x_m <= 3.5d-102) then
tmp = (c_m * (x_m * s_m)) ** (-2.0d0)
else
tmp = (cos((x_m * (-2.0d0))) / ((x_m * c_m) * (x_m * s_m))) / (c_m * s_m)
end if
code = tmp
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
double tmp;
if (x_m <= 3.5e-102) {
tmp = Math.pow((c_m * (x_m * s_m)), -2.0);
} else {
tmp = (Math.cos((x_m * -2.0)) / ((x_m * c_m) * (x_m * s_m))) / (c_m * s_m);
}
return tmp;
}
x_m = math.fabs(x) c_m = math.fabs(c) s_m = math.fabs(s) [x_m, c_m, s_m] = sort([x_m, c_m, s_m]) def code(x_m, c_m, s_m): tmp = 0 if x_m <= 3.5e-102: tmp = math.pow((c_m * (x_m * s_m)), -2.0) else: tmp = (math.cos((x_m * -2.0)) / ((x_m * c_m) * (x_m * s_m))) / (c_m * s_m) return tmp
x_m = abs(x) c_m = abs(c) s_m = abs(s) x_m, c_m, s_m = sort([x_m, c_m, s_m]) function code(x_m, c_m, s_m) tmp = 0.0 if (x_m <= 3.5e-102) tmp = Float64(c_m * Float64(x_m * s_m)) ^ -2.0; else tmp = Float64(Float64(cos(Float64(x_m * -2.0)) / Float64(Float64(x_m * c_m) * Float64(x_m * s_m))) / Float64(c_m * s_m)); end return tmp end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp_2 = code(x_m, c_m, s_m)
tmp = 0.0;
if (x_m <= 3.5e-102)
tmp = (c_m * (x_m * s_m)) ^ -2.0;
else
tmp = (cos((x_m * -2.0)) / ((x_m * c_m) * (x_m * s_m))) / (c_m * s_m);
end
tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision] c_m = N[Abs[c], $MachinePrecision] s_m = N[Abs[s], $MachinePrecision] NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function. code[x$95$m_, c$95$m_, s$95$m_] := If[LessEqual[x$95$m, 3.5e-102], N[Power[N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], N[(N[(N[Cos[N[(x$95$m * -2.0), $MachinePrecision]], $MachinePrecision] / N[(N[(x$95$m * c$95$m), $MachinePrecision] * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(c$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 3.5 \cdot 10^{-102}:\\
\;\;\;\;{\left(c\_m \cdot \left(x\_m \cdot s\_m\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cos \left(x\_m \cdot -2\right)}{\left(x\_m \cdot c\_m\right) \cdot \left(x\_m \cdot s\_m\right)}}{c\_m \cdot s\_m}\\
\end{array}
\end{array}
if x < 3.49999999999999986e-102Initial program 67.0%
associate-/r*67.0%
cos-neg67.0%
distribute-rgt-neg-out67.0%
distribute-rgt-neg-out67.0%
*-commutative67.0%
distribute-rgt-neg-in67.0%
metadata-eval67.0%
*-commutative67.0%
associate-*l*59.9%
unpow259.9%
Simplified59.9%
div-inv59.9%
add-sqr-sqrt59.8%
times-frac59.8%
pow-prod-down59.8%
sqrt-pow144.3%
metadata-eval44.3%
pow144.3%
*-commutative44.3%
pow-flip44.3%
metadata-eval44.3%
pow-prod-down55.1%
sqrt-pow180.9%
metadata-eval80.9%
pow180.9%
*-commutative80.9%
Applied egg-rr80.9%
Taylor expanded in x around 0 71.2%
Taylor expanded in x around 0 54.9%
*-commutative54.9%
*-commutative54.9%
unpow254.9%
unpow254.9%
swap-sqr69.3%
unpow269.3%
swap-sqr83.4%
*-commutative83.4%
associate-*r*82.9%
*-commutative82.9%
associate-*r*84.7%
unpow284.7%
exp-to-pow54.3%
*-commutative54.3%
exp-neg54.4%
*-commutative54.4%
distribute-rgt-neg-in54.4%
metadata-eval54.4%
exp-to-pow85.3%
Simplified84.0%
if 3.49999999999999986e-102 < x Initial program 61.2%
associate-/r*60.9%
cos-neg60.9%
distribute-rgt-neg-out60.9%
distribute-rgt-neg-out60.9%
*-commutative60.9%
distribute-rgt-neg-in60.9%
metadata-eval60.9%
*-commutative60.9%
associate-*l*56.1%
unpow256.1%
Simplified56.1%
div-inv56.1%
add-sqr-sqrt56.1%
times-frac56.1%
pow-prod-down56.1%
sqrt-pow141.3%
metadata-eval41.3%
pow141.3%
*-commutative41.3%
pow-flip41.3%
metadata-eval41.3%
pow-prod-down46.9%
sqrt-pow178.4%
metadata-eval78.4%
pow178.4%
*-commutative78.4%
Applied egg-rr78.4%
sqr-pow78.4%
times-frac83.8%
metadata-eval83.8%
unpow-183.8%
metadata-eval83.8%
unpow-183.8%
Applied egg-rr83.8%
associate-*r*84.8%
associate-/l/84.7%
un-div-inv85.9%
associate-/l/86.1%
frac-times86.1%
*-commutative86.1%
*-un-lft-identity86.1%
*-commutative86.1%
*-commutative86.1%
*-commutative86.1%
Applied egg-rr86.1%
Final simplification84.8%
x_m = (fabs.f64 x) c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x_m c_m s_m) :precision binary64 (if (<= x_m 2.8e-16) (pow (* c_m (* x_m s_m)) -2.0) (/ (cos (* x_m -2.0)) (* (* x_m s_m) (* (* x_m c_m) (* c_m s_m))))))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
double tmp;
if (x_m <= 2.8e-16) {
tmp = pow((c_m * (x_m * s_m)), -2.0);
} else {
tmp = cos((x_m * -2.0)) / ((x_m * s_m) * ((x_m * c_m) * (c_m * s_m)));
}
return tmp;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
real(8) :: tmp
if (x_m <= 2.8d-16) then
tmp = (c_m * (x_m * s_m)) ** (-2.0d0)
else
tmp = cos((x_m * (-2.0d0))) / ((x_m * s_m) * ((x_m * c_m) * (c_m * s_m)))
end if
code = tmp
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
double tmp;
if (x_m <= 2.8e-16) {
tmp = Math.pow((c_m * (x_m * s_m)), -2.0);
} else {
tmp = Math.cos((x_m * -2.0)) / ((x_m * s_m) * ((x_m * c_m) * (c_m * s_m)));
}
return tmp;
}
x_m = math.fabs(x) c_m = math.fabs(c) s_m = math.fabs(s) [x_m, c_m, s_m] = sort([x_m, c_m, s_m]) def code(x_m, c_m, s_m): tmp = 0 if x_m <= 2.8e-16: tmp = math.pow((c_m * (x_m * s_m)), -2.0) else: tmp = math.cos((x_m * -2.0)) / ((x_m * s_m) * ((x_m * c_m) * (c_m * s_m))) return tmp
x_m = abs(x) c_m = abs(c) s_m = abs(s) x_m, c_m, s_m = sort([x_m, c_m, s_m]) function code(x_m, c_m, s_m) tmp = 0.0 if (x_m <= 2.8e-16) tmp = Float64(c_m * Float64(x_m * s_m)) ^ -2.0; else tmp = Float64(cos(Float64(x_m * -2.0)) / Float64(Float64(x_m * s_m) * Float64(Float64(x_m * c_m) * Float64(c_m * s_m)))); end return tmp end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp_2 = code(x_m, c_m, s_m)
tmp = 0.0;
if (x_m <= 2.8e-16)
tmp = (c_m * (x_m * s_m)) ^ -2.0;
else
tmp = cos((x_m * -2.0)) / ((x_m * s_m) * ((x_m * c_m) * (c_m * s_m)));
end
tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision] c_m = N[Abs[c], $MachinePrecision] s_m = N[Abs[s], $MachinePrecision] NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function. code[x$95$m_, c$95$m_, s$95$m_] := If[LessEqual[x$95$m, 2.8e-16], N[Power[N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], N[(N[Cos[N[(x$95$m * -2.0), $MachinePrecision]], $MachinePrecision] / N[(N[(x$95$m * s$95$m), $MachinePrecision] * N[(N[(x$95$m * c$95$m), $MachinePrecision] * N[(c$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 2.8 \cdot 10^{-16}:\\
\;\;\;\;{\left(c\_m \cdot \left(x\_m \cdot s\_m\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x\_m \cdot -2\right)}{\left(x\_m \cdot s\_m\right) \cdot \left(\left(x\_m \cdot c\_m\right) \cdot \left(c\_m \cdot s\_m\right)\right)}\\
\end{array}
\end{array}
if x < 2.8000000000000001e-16Initial program 67.0%
associate-/r*67.0%
cos-neg67.0%
distribute-rgt-neg-out67.0%
distribute-rgt-neg-out67.0%
*-commutative67.0%
distribute-rgt-neg-in67.0%
metadata-eval67.0%
*-commutative67.0%
associate-*l*60.5%
unpow260.5%
Simplified60.5%
div-inv60.5%
add-sqr-sqrt60.4%
times-frac60.4%
pow-prod-down60.4%
sqrt-pow142.4%
metadata-eval42.4%
pow142.4%
*-commutative42.4%
pow-flip42.4%
metadata-eval42.4%
pow-prod-down52.3%
sqrt-pow180.8%
metadata-eval80.8%
pow180.8%
*-commutative80.8%
Applied egg-rr80.8%
Taylor expanded in x around 0 71.9%
Taylor expanded in x around 0 55.9%
*-commutative55.9%
*-commutative55.9%
unpow255.9%
unpow255.9%
swap-sqr69.1%
unpow269.1%
swap-sqr84.7%
*-commutative84.7%
associate-*r*84.3%
*-commutative84.3%
associate-*r*85.9%
unpow285.9%
exp-to-pow55.1%
*-commutative55.1%
exp-neg55.2%
*-commutative55.2%
distribute-rgt-neg-in55.2%
metadata-eval55.2%
exp-to-pow86.5%
Simplified85.3%
if 2.8000000000000001e-16 < x Initial program 60.0%
associate-/r*59.6%
cos-neg59.6%
distribute-rgt-neg-out59.6%
distribute-rgt-neg-out59.6%
*-commutative59.6%
distribute-rgt-neg-in59.6%
metadata-eval59.6%
*-commutative59.6%
associate-*l*53.9%
unpow253.9%
Simplified53.9%
div-inv53.9%
add-sqr-sqrt53.9%
times-frac53.9%
pow-prod-down53.9%
sqrt-pow145.4%
metadata-eval45.4%
pow145.4%
*-commutative45.4%
pow-flip45.4%
metadata-eval45.4%
pow-prod-down52.2%
sqrt-pow178.0%
metadata-eval78.0%
pow178.0%
*-commutative78.0%
Applied egg-rr78.0%
sqr-pow78.0%
associate-/l*86.0%
metadata-eval86.0%
unpow-186.0%
metadata-eval86.0%
unpow-186.0%
Applied egg-rr86.0%
Applied egg-rr80.7%
Final simplification84.0%
x_m = (fabs.f64 x) c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x_m c_m s_m) :precision binary64 (pow (* c_m (* x_m s_m)) -2.0))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
return pow((c_m * (x_m * s_m)), -2.0);
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
code = (c_m * (x_m * s_m)) ** (-2.0d0)
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
return Math.pow((c_m * (x_m * s_m)), -2.0);
}
x_m = math.fabs(x) c_m = math.fabs(c) s_m = math.fabs(s) [x_m, c_m, s_m] = sort([x_m, c_m, s_m]) def code(x_m, c_m, s_m): return math.pow((c_m * (x_m * s_m)), -2.0)
x_m = abs(x) c_m = abs(c) s_m = abs(s) x_m, c_m, s_m = sort([x_m, c_m, s_m]) function code(x_m, c_m, s_m) return Float64(c_m * Float64(x_m * s_m)) ^ -2.0 end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp = code(x_m, c_m, s_m)
tmp = (c_m * (x_m * s_m)) ^ -2.0;
end
x_m = N[Abs[x], $MachinePrecision] c_m = N[Abs[c], $MachinePrecision] s_m = N[Abs[s], $MachinePrecision] NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function. code[x$95$m_, c$95$m_, s$95$m_] := N[Power[N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
{\left(c\_m \cdot \left(x\_m \cdot s\_m\right)\right)}^{-2}
\end{array}
Initial program 65.0%
associate-/r*64.9%
cos-neg64.9%
distribute-rgt-neg-out64.9%
distribute-rgt-neg-out64.9%
*-commutative64.9%
distribute-rgt-neg-in64.9%
metadata-eval64.9%
*-commutative64.9%
associate-*l*58.6%
unpow258.6%
Simplified58.6%
div-inv58.6%
add-sqr-sqrt58.5%
times-frac58.5%
pow-prod-down58.5%
sqrt-pow143.2%
metadata-eval43.2%
pow143.2%
*-commutative43.2%
pow-flip43.3%
metadata-eval43.3%
pow-prod-down52.3%
sqrt-pow180.0%
metadata-eval80.0%
pow180.0%
*-commutative80.0%
Applied egg-rr80.0%
Taylor expanded in x around 0 65.9%
Taylor expanded in x around 0 53.2%
*-commutative53.2%
*-commutative53.2%
unpow253.2%
unpow253.2%
swap-sqr63.6%
unpow263.6%
swap-sqr75.6%
*-commutative75.6%
associate-*r*75.2%
*-commutative75.2%
associate-*r*76.7%
unpow276.7%
exp-to-pow47.5%
*-commutative47.5%
exp-neg47.6%
*-commutative47.6%
distribute-rgt-neg-in47.6%
metadata-eval47.6%
exp-to-pow77.1%
Simplified76.0%
Final simplification76.0%
x_m = (fabs.f64 x) c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x_m c_m s_m) :precision binary64 (let* ((t_0 (* s_m (* x_m c_m)))) (/ (/ 1.0 t_0) t_0)))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
double t_0 = s_m * (x_m * c_m);
return (1.0 / t_0) / t_0;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
real(8) :: t_0
t_0 = s_m * (x_m * c_m)
code = (1.0d0 / t_0) / t_0
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
double t_0 = s_m * (x_m * c_m);
return (1.0 / t_0) / t_0;
}
x_m = math.fabs(x) c_m = math.fabs(c) s_m = math.fabs(s) [x_m, c_m, s_m] = sort([x_m, c_m, s_m]) def code(x_m, c_m, s_m): t_0 = s_m * (x_m * c_m) return (1.0 / t_0) / t_0
x_m = abs(x) c_m = abs(c) s_m = abs(s) x_m, c_m, s_m = sort([x_m, c_m, s_m]) function code(x_m, c_m, s_m) t_0 = Float64(s_m * Float64(x_m * c_m)) return Float64(Float64(1.0 / t_0) / t_0) end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp = code(x_m, c_m, s_m)
t_0 = s_m * (x_m * c_m);
tmp = (1.0 / t_0) / t_0;
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[(s$95$m * N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := s\_m \cdot \left(x\_m \cdot c\_m\right)\\
\frac{\frac{1}{t\_0}}{t\_0}
\end{array}
\end{array}
Initial program 65.0%
associate-/r*64.9%
cos-neg64.9%
distribute-rgt-neg-out64.9%
distribute-rgt-neg-out64.9%
*-commutative64.9%
distribute-rgt-neg-in64.9%
metadata-eval64.9%
*-commutative64.9%
associate-*l*58.6%
unpow258.6%
Simplified58.6%
div-inv58.6%
add-sqr-sqrt58.5%
times-frac58.5%
pow-prod-down58.5%
sqrt-pow143.2%
metadata-eval43.2%
pow143.2%
*-commutative43.2%
pow-flip43.3%
metadata-eval43.3%
pow-prod-down52.3%
sqrt-pow180.0%
metadata-eval80.0%
pow180.0%
*-commutative80.0%
Applied egg-rr80.0%
Taylor expanded in x around 0 65.9%
metadata-eval65.9%
pow-prod-up65.8%
inv-pow65.8%
inv-pow65.8%
associate-*r/74.0%
associate-*l/74.0%
*-un-lft-identity74.0%
frac-times76.0%
*-un-lft-identity76.0%
associate-/l/76.0%
*-commutative76.0%
associate-*r*75.6%
*-commutative75.6%
associate-*r*77.1%
Applied egg-rr77.1%
x_m = (fabs.f64 x) c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x_m c_m s_m) :precision binary64 (/ (/ 1.0 c_m) (* (* s_m (* x_m c_m)) (* x_m s_m))))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
return (1.0 / c_m) / ((s_m * (x_m * c_m)) * (x_m * s_m));
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
code = (1.0d0 / c_m) / ((s_m * (x_m * c_m)) * (x_m * s_m))
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
return (1.0 / c_m) / ((s_m * (x_m * c_m)) * (x_m * s_m));
}
x_m = math.fabs(x) c_m = math.fabs(c) s_m = math.fabs(s) [x_m, c_m, s_m] = sort([x_m, c_m, s_m]) def code(x_m, c_m, s_m): return (1.0 / c_m) / ((s_m * (x_m * c_m)) * (x_m * s_m))
x_m = abs(x) c_m = abs(c) s_m = abs(s) x_m, c_m, s_m = sort([x_m, c_m, s_m]) function code(x_m, c_m, s_m) return Float64(Float64(1.0 / c_m) / Float64(Float64(s_m * Float64(x_m * c_m)) * Float64(x_m * s_m))) end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp = code(x_m, c_m, s_m)
tmp = (1.0 / c_m) / ((s_m * (x_m * c_m)) * (x_m * s_m));
end
x_m = N[Abs[x], $MachinePrecision] c_m = N[Abs[c], $MachinePrecision] s_m = N[Abs[s], $MachinePrecision] NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function. code[x$95$m_, c$95$m_, s$95$m_] := N[(N[(1.0 / c$95$m), $MachinePrecision] / N[(N[(s$95$m * N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision] * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\frac{\frac{1}{c\_m}}{\left(s\_m \cdot \left(x\_m \cdot c\_m\right)\right) \cdot \left(x\_m \cdot s\_m\right)}
\end{array}
Initial program 65.0%
associate-/r*64.9%
cos-neg64.9%
distribute-rgt-neg-out64.9%
distribute-rgt-neg-out64.9%
*-commutative64.9%
distribute-rgt-neg-in64.9%
metadata-eval64.9%
*-commutative64.9%
associate-*l*58.6%
unpow258.6%
Simplified58.6%
div-inv58.6%
add-sqr-sqrt58.5%
times-frac58.5%
pow-prod-down58.5%
sqrt-pow143.2%
metadata-eval43.2%
pow143.2%
*-commutative43.2%
pow-flip43.3%
metadata-eval43.3%
pow-prod-down52.3%
sqrt-pow180.0%
metadata-eval80.0%
pow180.0%
*-commutative80.0%
Applied egg-rr80.0%
Taylor expanded in x around 0 65.9%
metadata-eval65.9%
pow-prod-up65.8%
inv-pow65.8%
inv-pow65.8%
associate-*r/74.0%
frac-times74.0%
*-un-lft-identity74.0%
frac-times72.9%
*-un-lft-identity72.9%
associate-*r*72.5%
*-commutative72.5%
*-commutative72.5%
Applied egg-rr72.5%
Final simplification72.5%
herbie shell --seed 2024111
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))