
(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 10 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))))
(if (<= x_m 5e-25)
(pow (* c_m (* x_m s_m)) -2.0)
(/ (/ (cos (* x_m 2.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 <= 5e-25) {
tmp = pow((c_m * (x_m * s_m)), -2.0);
} else {
tmp = (cos((x_m * 2.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 <= 5d-25) then
tmp = (c_m * (x_m * s_m)) ** (-2.0d0)
else
tmp = (cos((x_m * 2.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 <= 5e-25) {
tmp = Math.pow((c_m * (x_m * s_m)), -2.0);
} else {
tmp = (Math.cos((x_m * 2.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 <= 5e-25: tmp = math.pow((c_m * (x_m * s_m)), -2.0) else: tmp = (math.cos((x_m * 2.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 <= 5e-25) tmp = Float64(c_m * Float64(x_m * s_m)) ^ -2.0; else tmp = Float64(Float64(cos(Float64(x_m * 2.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 <= 5e-25)
tmp = (c_m * (x_m * s_m)) ^ -2.0;
else
tmp = (cos((x_m * 2.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, 5e-25], 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] / 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)\\
\mathbf{if}\;x\_m \leq 5 \cdot 10^{-25}:\\
\;\;\;\;{\left(c\_m \cdot \left(x\_m \cdot s\_m\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cos \left(x\_m \cdot 2\right)}{t\_0}}{t\_0}\\
\end{array}
\end{array}
if x < 4.99999999999999962e-25Initial program 65.7%
associate-/r*65.1%
*-commutative65.1%
unpow265.1%
sqr-neg65.1%
unpow265.1%
cos-neg65.1%
*-commutative65.1%
distribute-rgt-neg-in65.1%
metadata-eval65.1%
unpow265.1%
sqr-neg65.1%
unpow265.1%
associate-*r*55.7%
unpow255.7%
*-commutative55.7%
Simplified55.7%
Taylor expanded in x around 0 53.3%
associate-/r*52.7%
*-commutative52.7%
unpow252.7%
unpow252.7%
swap-sqr66.1%
unpow266.1%
associate-/r*66.6%
unpow266.6%
unpow266.6%
swap-sqr84.5%
unpow284.5%
Simplified84.5%
Taylor expanded in c around 0 53.3%
associate-*r*54.0%
unpow254.0%
unpow254.0%
swap-sqr68.1%
unpow268.1%
swap-sqr83.4%
*-commutative83.4%
*-commutative83.4%
associate-/l/83.4%
*-lft-identity83.4%
associate-*l/83.3%
unpow-183.3%
unpow-183.3%
pow-sqr83.3%
metadata-eval83.3%
*-commutative83.3%
associate-*r*84.6%
Simplified84.6%
if 4.99999999999999962e-25 < x Initial program 72.8%
associate-/r*73.5%
*-commutative73.5%
unpow273.5%
sqr-neg73.5%
unpow273.5%
cos-neg73.5%
*-commutative73.5%
distribute-rgt-neg-in73.5%
metadata-eval73.5%
unpow273.5%
sqr-neg73.5%
unpow273.5%
associate-*r*65.9%
unpow265.9%
*-commutative65.9%
Simplified65.9%
Applied egg-rr98.3%
associate-/r*98.2%
div-inv98.3%
*-commutative98.3%
Applied egg-rr98.3%
associate-*l/98.4%
*-un-lft-identity98.4%
*-commutative98.4%
frac-times98.3%
*-commutative98.3%
*-rgt-identity98.3%
*-commutative98.3%
associate-*l*93.6%
*-commutative93.6%
*-commutative93.6%
associate-*l*94.9%
*-commutative94.9%
Applied egg-rr94.9%
Final simplification87.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 (/ (/ (cos (* x_m 2.0)) (* (* x_m s_m) (* c_m (* x_m s_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) {
return (cos((x_m * 2.0)) / ((x_m * s_m) * (c_m * (x_m * s_m)))) / c_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 = (cos((x_m * 2.0d0)) / ((x_m * s_m) * (c_m * (x_m * s_m)))) / c_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 (Math.cos((x_m * 2.0)) / ((x_m * s_m) * (c_m * (x_m * s_m)))) / c_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 (math.cos((x_m * 2.0)) / ((x_m * s_m) * (c_m * (x_m * s_m)))) / c_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(cos(Float64(x_m * 2.0)) / Float64(Float64(x_m * s_m) * Float64(c_m * Float64(x_m * s_m)))) / c_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 = (cos((x_m * 2.0)) / ((x_m * s_m) * (c_m * (x_m * s_m)))) / c_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[(N[Cos[N[(x$95$m * 2.0), $MachinePrecision]], $MachinePrecision] / N[(N[(x$95$m * s$95$m), $MachinePrecision] * N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c$95$m), $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{\cos \left(x\_m \cdot 2\right)}{\left(x\_m \cdot s\_m\right) \cdot \left(c\_m \cdot \left(x\_m \cdot s\_m\right)\right)}}{c\_m}
\end{array}
Initial program 67.5%
associate-/r*67.3%
*-commutative67.3%
unpow267.3%
sqr-neg67.3%
unpow267.3%
cos-neg67.3%
*-commutative67.3%
distribute-rgt-neg-in67.3%
metadata-eval67.3%
unpow267.3%
sqr-neg67.3%
unpow267.3%
associate-*r*58.3%
unpow258.3%
*-commutative58.3%
Simplified58.3%
Applied egg-rr96.2%
associate-*l/96.2%
*-un-lft-identity96.2%
unpow296.2%
associate-/r*96.9%
associate-/r*96.9%
associate-/l/91.3%
*-commutative91.3%
*-commutative91.3%
associate-*l*88.0%
*-commutative88.0%
Applied egg-rr88.0%
*-un-lft-identity88.0%
frac-times93.6%
associate-*r*95.7%
*-commutative95.7%
associate-*r*96.9%
un-div-inv96.7%
associate-*l/96.8%
times-frac91.4%
frac-times91.5%
*-commutative91.5%
*-rgt-identity91.5%
*-commutative91.5%
associate-*l*90.3%
*-commutative90.3%
Applied egg-rr90.3%
associate-*l/90.3%
*-lft-identity90.3%
associate-/l/90.1%
*-commutative90.1%
associate-*r*88.1%
*-commutative88.1%
associate-*r*91.3%
*-commutative91.3%
Simplified91.3%
Final simplification91.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 (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 67.5%
associate-/r*67.3%
*-commutative67.3%
unpow267.3%
sqr-neg67.3%
unpow267.3%
cos-neg67.3%
*-commutative67.3%
distribute-rgt-neg-in67.3%
metadata-eval67.3%
unpow267.3%
sqr-neg67.3%
unpow267.3%
associate-*r*58.3%
unpow258.3%
*-commutative58.3%
Simplified58.3%
Taylor expanded in x around 0 54.0%
associate-/r*53.6%
*-commutative53.6%
unpow253.6%
unpow253.6%
swap-sqr65.5%
unpow265.5%
associate-/r*65.9%
unpow265.9%
unpow265.9%
swap-sqr79.9%
unpow279.9%
Simplified79.9%
Taylor expanded in c around 0 54.0%
associate-*r*54.6%
unpow254.6%
unpow254.6%
swap-sqr67.0%
unpow267.0%
swap-sqr79.0%
*-commutative79.0%
*-commutative79.0%
associate-/l/79.0%
*-lft-identity79.0%
associate-*l/79.0%
unpow-179.0%
unpow-179.0%
pow-sqr79.0%
metadata-eval79.0%
*-commutative79.0%
associate-*r*80.0%
Simplified80.0%
Final simplification80.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 (* x_m (* c_m s_m))))
(if (<= c_m 1.4e-38)
(/ 1.0 (* t_0 t_0))
(/ (/ 1.0 (* c_m (* x_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 = x_m * (c_m * s_m);
double tmp;
if (c_m <= 1.4e-38) {
tmp = 1.0 / (t_0 * t_0);
} else {
tmp = (1.0 / (c_m * (x_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 = x_m * (c_m * s_m)
if (c_m <= 1.4d-38) then
tmp = 1.0d0 / (t_0 * t_0)
else
tmp = (1.0d0 / (c_m * (x_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 = x_m * (c_m * s_m);
double tmp;
if (c_m <= 1.4e-38) {
tmp = 1.0 / (t_0 * t_0);
} else {
tmp = (1.0 / (c_m * (x_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 = x_m * (c_m * s_m) tmp = 0 if c_m <= 1.4e-38: tmp = 1.0 / (t_0 * t_0) else: tmp = (1.0 / (c_m * (x_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 = Float64(x_m * Float64(c_m * s_m)) tmp = 0.0 if (c_m <= 1.4e-38) tmp = Float64(1.0 / Float64(t_0 * t_0)); else tmp = Float64(Float64(1.0 / Float64(c_m * Float64(x_m * 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 = x_m * (c_m * s_m);
tmp = 0.0;
if (c_m <= 1.4e-38)
tmp = 1.0 / (t_0 * t_0);
else
tmp = (1.0 / (c_m * (x_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[(x$95$m * N[(c$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c$95$m, 1.4e-38], N[(1.0 / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(s$95$m * N[(x$95$m * c$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])\\
\\
\begin{array}{l}
t_0 := x\_m \cdot \left(c\_m \cdot s\_m\right)\\
\mathbf{if}\;c\_m \leq 1.4 \cdot 10^{-38}:\\
\;\;\;\;\frac{1}{t\_0 \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{c\_m \cdot \left(x\_m \cdot s\_m\right)}}{s\_m \cdot \left(x\_m \cdot c\_m\right)}\\
\end{array}
\end{array}
if c < 1.4e-38Initial program 69.4%
associate-/r*68.9%
*-commutative68.9%
unpow268.9%
sqr-neg68.9%
unpow268.9%
cos-neg68.9%
*-commutative68.9%
distribute-rgt-neg-in68.9%
metadata-eval68.9%
unpow268.9%
sqr-neg68.9%
unpow268.9%
associate-*r*61.4%
unpow261.4%
*-commutative61.4%
Simplified61.4%
Taylor expanded in x around 0 56.2%
associate-/r*55.6%
*-commutative55.6%
unpow255.6%
unpow255.6%
swap-sqr65.4%
unpow265.4%
associate-/r*65.9%
unpow265.9%
unpow265.9%
swap-sqr78.5%
unpow278.5%
Simplified78.5%
unpow278.5%
*-commutative78.5%
associate-*l*76.1%
*-commutative76.1%
*-commutative76.1%
associate-*l*77.5%
*-commutative77.5%
Applied egg-rr77.5%
if 1.4e-38 < c Initial program 62.1%
associate-/r*62.5%
*-commutative62.5%
unpow262.5%
sqr-neg62.5%
unpow262.5%
cos-neg62.5%
*-commutative62.5%
distribute-rgt-neg-in62.5%
metadata-eval62.5%
unpow262.5%
sqr-neg62.5%
unpow262.5%
associate-*r*49.4%
unpow249.4%
*-commutative49.4%
Simplified49.4%
Applied egg-rr96.0%
associate-/r*96.1%
div-inv95.3%
*-commutative95.3%
Applied egg-rr95.3%
associate-*l/95.4%
*-un-lft-identity95.4%
*-commutative95.4%
frac-times96.1%
*-commutative96.1%
*-rgt-identity96.1%
*-commutative96.1%
associate-*l*94.7%
*-commutative94.7%
*-commutative94.7%
associate-*l*98.1%
*-commutative98.1%
Applied egg-rr98.1%
Taylor expanded in x around 0 83.5%
Final simplification79.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 (* x_m s_m))) (* (/ 1.0 c_m) (/ 1.0 (* 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 * (x_m * s_m))) * ((1.0 / c_m) * (1.0 / (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 * (x_m * s_m))) * ((1.0d0 / c_m) * (1.0d0 / (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 * (x_m * s_m))) * ((1.0 / c_m) * (1.0 / (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 * (x_m * s_m))) * ((1.0 / c_m) * (1.0 / (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 / Float64(c_m * Float64(x_m * s_m))) * Float64(Float64(1.0 / c_m) * Float64(1.0 / 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 * (x_m * s_m))) * ((1.0 / c_m) * (1.0 / (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 / N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / c$95$m), $MachinePrecision] * N[(1.0 / 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])\\
\\
\frac{1}{c\_m \cdot \left(x\_m \cdot s\_m\right)} \cdot \left(\frac{1}{c\_m} \cdot \frac{1}{x\_m \cdot s\_m}\right)
\end{array}
Initial program 67.5%
associate-/r*67.3%
*-commutative67.3%
unpow267.3%
sqr-neg67.3%
unpow267.3%
cos-neg67.3%
*-commutative67.3%
distribute-rgt-neg-in67.3%
metadata-eval67.3%
unpow267.3%
sqr-neg67.3%
unpow267.3%
associate-*r*58.3%
unpow258.3%
*-commutative58.3%
Simplified58.3%
Applied egg-rr96.8%
associate-/r*96.9%
div-inv96.7%
*-commutative96.7%
Applied egg-rr96.7%
Taylor expanded in x around 0 79.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 (let* ((t_0 (/ 1.0 (* c_m (* x_m s_m))))) (* 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 = 1.0 / (c_m * (x_m * s_m));
return 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 = 1.0d0 / (c_m * (x_m * s_m))
code = 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 = 1.0 / (c_m * (x_m * s_m));
return 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 = 1.0 / (c_m * (x_m * s_m)) return 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(1.0 / Float64(c_m * Float64(x_m * s_m))) return Float64(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 = 1.0 / (c_m * (x_m * s_m));
tmp = 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[(1.0 / N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * 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 := \frac{1}{c\_m \cdot \left(x\_m \cdot s\_m\right)}\\
t\_0 \cdot t\_0
\end{array}
\end{array}
Initial program 67.5%
associate-/r*67.3%
*-commutative67.3%
unpow267.3%
sqr-neg67.3%
unpow267.3%
cos-neg67.3%
*-commutative67.3%
distribute-rgt-neg-in67.3%
metadata-eval67.3%
unpow267.3%
sqr-neg67.3%
unpow267.3%
associate-*r*58.3%
unpow258.3%
*-commutative58.3%
Simplified58.3%
Applied egg-rr96.8%
associate-/r*96.9%
div-inv96.7%
*-commutative96.7%
Applied egg-rr96.7%
Taylor expanded in x around 0 79.9%
*-commutative79.9%
Simplified79.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 (/ (/ 1.0 (* (* x_m s_m) (* c_m (* x_m s_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) {
return (1.0 / ((x_m * s_m) * (c_m * (x_m * s_m)))) / c_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 / ((x_m * s_m) * (c_m * (x_m * s_m)))) / c_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 / ((x_m * s_m) * (c_m * (x_m * s_m)))) / c_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 / ((x_m * s_m) * (c_m * (x_m * s_m)))) / c_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 / Float64(Float64(x_m * s_m) * Float64(c_m * Float64(x_m * s_m)))) / c_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 / ((x_m * s_m) * (c_m * (x_m * s_m)))) / c_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 / N[(N[(x$95$m * s$95$m), $MachinePrecision] * N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c$95$m), $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}{\left(x\_m \cdot s\_m\right) \cdot \left(c\_m \cdot \left(x\_m \cdot s\_m\right)\right)}}{c\_m}
\end{array}
Initial program 67.5%
associate-/r*67.3%
*-commutative67.3%
unpow267.3%
sqr-neg67.3%
unpow267.3%
cos-neg67.3%
*-commutative67.3%
distribute-rgt-neg-in67.3%
metadata-eval67.3%
unpow267.3%
sqr-neg67.3%
unpow267.3%
associate-*r*58.3%
unpow258.3%
*-commutative58.3%
Simplified58.3%
Taylor expanded in x around 0 54.0%
associate-/r*53.6%
*-commutative53.6%
unpow253.6%
unpow253.6%
swap-sqr65.5%
unpow265.5%
associate-/r*65.9%
unpow265.9%
unpow265.9%
swap-sqr79.9%
unpow279.9%
Simplified79.9%
unpow279.9%
associate-*r*79.8%
associate-*l*76.8%
*-commutative76.8%
associate-*l*76.3%
*-commutative76.3%
Applied egg-rr76.3%
metadata-eval76.3%
associate-*r*78.9%
*-commutative78.9%
associate-*r*79.0%
frac-times79.0%
un-div-inv79.0%
associate-*r*79.0%
*-commutative79.0%
associate-*r*77.0%
*-un-lft-identity77.0%
*-commutative77.0%
associate-*r*79.9%
times-frac78.3%
*-commutative78.3%
*-commutative78.3%
associate-*l*78.2%
*-commutative78.2%
Applied egg-rr78.2%
*-commutative78.2%
associate-*l/76.3%
associate-*r/76.3%
*-rgt-identity76.3%
associate-/l/76.3%
associate-*r*73.5%
*-commutative73.5%
associate-*r*76.4%
*-commutative76.4%
Simplified76.4%
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)))) (/ 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 = x_m * (c_m * s_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 = x_m * (c_m * s_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 = x_m * (c_m * s_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 = x_m * (c_m * s_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(x_m * Float64(c_m * s_m)) return Float64(1.0 / Float64(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 = x_m * (c_m * s_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[(x$95$m * N[(c$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]}, N[(1.0 / N[(t$95$0 * 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)\\
\frac{1}{t\_0 \cdot t\_0}
\end{array}
\end{array}
Initial program 67.5%
associate-/r*67.3%
*-commutative67.3%
unpow267.3%
sqr-neg67.3%
unpow267.3%
cos-neg67.3%
*-commutative67.3%
distribute-rgt-neg-in67.3%
metadata-eval67.3%
unpow267.3%
sqr-neg67.3%
unpow267.3%
associate-*r*58.3%
unpow258.3%
*-commutative58.3%
Simplified58.3%
Taylor expanded in x around 0 54.0%
associate-/r*53.6%
*-commutative53.6%
unpow253.6%
unpow253.6%
swap-sqr65.5%
unpow265.5%
associate-/r*65.9%
unpow265.9%
unpow265.9%
swap-sqr79.9%
unpow279.9%
Simplified79.9%
unpow279.9%
*-commutative79.9%
associate-*l*77.0%
*-commutative77.0%
*-commutative77.0%
associate-*l*79.0%
*-commutative79.0%
Applied egg-rr79.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 (/ 1.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) {
return 1.0 / ((x_m * c_m) * (s_m * (s_m * (x_m * c_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 / ((x_m * c_m) * (s_m * (s_m * (x_m * c_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 / ((x_m * c_m) * (s_m * (s_m * (x_m * c_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 / ((x_m * c_m) * (s_m * (s_m * (x_m * c_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(1.0 / Float64(Float64(x_m * c_m) * Float64(s_m * Float64(s_m * Float64(x_m * c_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 / ((x_m * c_m) * (s_m * (s_m * (x_m * c_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[(1.0 / N[(N[(x$95$m * c$95$m), $MachinePrecision] * N[(s$95$m * N[(s$95$m * N[(x$95$m * c$95$m), $MachinePrecision]), $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])\\
\\
\frac{1}{\left(x\_m \cdot c\_m\right) \cdot \left(s\_m \cdot \left(s\_m \cdot \left(x\_m \cdot c\_m\right)\right)\right)}
\end{array}
Initial program 67.5%
associate-/r*67.3%
*-commutative67.3%
unpow267.3%
sqr-neg67.3%
unpow267.3%
cos-neg67.3%
*-commutative67.3%
distribute-rgt-neg-in67.3%
metadata-eval67.3%
unpow267.3%
sqr-neg67.3%
unpow267.3%
associate-*r*58.3%
unpow258.3%
*-commutative58.3%
Simplified58.3%
Taylor expanded in x around 0 54.0%
associate-/r*53.6%
*-commutative53.6%
unpow253.6%
unpow253.6%
swap-sqr65.5%
unpow265.5%
associate-/r*65.9%
unpow265.9%
unpow265.9%
swap-sqr79.9%
unpow279.9%
Simplified79.9%
unpow279.9%
associate-*r*79.8%
associate-*l*76.8%
*-commutative76.8%
associate-*l*76.3%
*-commutative76.3%
Applied egg-rr76.3%
/-rgt-identity76.3%
*-commutative76.3%
*-commutative76.3%
associate-*l*77.7%
Applied egg-rr77.7%
/-rgt-identity77.7%
*-commutative77.7%
*-commutative77.7%
Applied egg-rr77.7%
Final simplification77.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 (/ 1.0 (* (* x_m c_m) (* s_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 / ((x_m * c_m) * (s_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 / ((x_m * c_m) * (s_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 / ((x_m * c_m) * (s_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 / ((x_m * c_m) * (s_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(1.0 / Float64(Float64(x_m * c_m) * Float64(s_m * Float64(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 / ((x_m * c_m) * (s_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[(1.0 / N[(N[(x$95$m * c$95$m), $MachinePrecision] * N[(s$95$m * N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $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])\\
\\
\frac{1}{\left(x\_m \cdot c\_m\right) \cdot \left(s\_m \cdot \left(c\_m \cdot \left(x\_m \cdot s\_m\right)\right)\right)}
\end{array}
Initial program 67.5%
associate-/r*67.3%
*-commutative67.3%
unpow267.3%
sqr-neg67.3%
unpow267.3%
cos-neg67.3%
*-commutative67.3%
distribute-rgt-neg-in67.3%
metadata-eval67.3%
unpow267.3%
sqr-neg67.3%
unpow267.3%
associate-*r*58.3%
unpow258.3%
*-commutative58.3%
Simplified58.3%
Taylor expanded in x around 0 54.0%
associate-/r*53.6%
*-commutative53.6%
unpow253.6%
unpow253.6%
swap-sqr65.5%
unpow265.5%
associate-/r*65.9%
unpow265.9%
unpow265.9%
swap-sqr79.9%
unpow279.9%
Simplified79.9%
unpow279.9%
associate-*r*79.8%
associate-*l*76.8%
*-commutative76.8%
associate-*l*76.3%
*-commutative76.3%
Applied egg-rr76.3%
Taylor expanded in x around 0 76.8%
*-commutative76.8%
Simplified76.8%
Final simplification76.8%
herbie shell --seed 2024181
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))