
(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 (if (<= x_m 7.2e-25) (* (/ 1.0 (* c_m (* x_m s_m))) (/ (/ (/ 1.0 s_m) x_m) c_m)) (/ (* (/ (/ 1.0 x_m) c_m) (/ (cos (* x_m 2.0)) 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 tmp;
if (x_m <= 7.2e-25) {
tmp = (1.0 / (c_m * (x_m * s_m))) * (((1.0 / s_m) / x_m) / c_m);
} else {
tmp = (((1.0 / x_m) / c_m) * (cos((x_m * 2.0)) / 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) :: tmp
if (x_m <= 7.2d-25) then
tmp = (1.0d0 / (c_m * (x_m * s_m))) * (((1.0d0 / s_m) / x_m) / c_m)
else
tmp = (((1.0d0 / x_m) / c_m) * (cos((x_m * 2.0d0)) / 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 tmp;
if (x_m <= 7.2e-25) {
tmp = (1.0 / (c_m * (x_m * s_m))) * (((1.0 / s_m) / x_m) / c_m);
} else {
tmp = (((1.0 / x_m) / c_m) * (Math.cos((x_m * 2.0)) / 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): tmp = 0 if x_m <= 7.2e-25: tmp = (1.0 / (c_m * (x_m * s_m))) * (((1.0 / s_m) / x_m) / c_m) else: tmp = (((1.0 / x_m) / c_m) * (math.cos((x_m * 2.0)) / 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) tmp = 0.0 if (x_m <= 7.2e-25) tmp = Float64(Float64(1.0 / Float64(c_m * Float64(x_m * s_m))) * Float64(Float64(Float64(1.0 / s_m) / x_m) / c_m)); else tmp = Float64(Float64(Float64(Float64(1.0 / x_m) / c_m) * Float64(cos(Float64(x_m * 2.0)) / 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)
tmp = 0.0;
if (x_m <= 7.2e-25)
tmp = (1.0 / (c_m * (x_m * s_m))) * (((1.0 / s_m) / x_m) / c_m);
else
tmp = (((1.0 / x_m) / c_m) * (cos((x_m * 2.0)) / 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_] := If[LessEqual[x$95$m, 7.2e-25], N[(N[(1.0 / N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1.0 / s$95$m), $MachinePrecision] / x$95$m), $MachinePrecision] / c$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(1.0 / x$95$m), $MachinePrecision] / c$95$m), $MachinePrecision] * N[(N[Cos[N[(x$95$m * 2.0), $MachinePrecision]], $MachinePrecision] / s$95$m), $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}
\mathbf{if}\;x\_m \leq 7.2 \cdot 10^{-25}:\\
\;\;\;\;\frac{1}{c\_m \cdot \left(x\_m \cdot s\_m\right)} \cdot \frac{\frac{\frac{1}{s\_m}}{x\_m}}{c\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{x\_m}}{c\_m} \cdot \frac{\cos \left(x\_m \cdot 2\right)}{s\_m}}{s\_m \cdot \left(x\_m \cdot c\_m\right)}\\
\end{array}
\end{array}
if x < 7.1999999999999998e-25Initial program 69.8%
associate-/r*69.8%
cos-neg69.8%
distribute-rgt-neg-out69.8%
distribute-rgt-neg-out69.8%
*-commutative69.8%
distribute-rgt-neg-in69.8%
metadata-eval69.8%
*-commutative69.8%
associate-*l*62.7%
unpow262.7%
Simplified62.7%
Applied egg-rr97.5%
Taylor expanded in x around 0 87.2%
associate-/r*87.2%
div-inv86.9%
Applied egg-rr86.9%
associate-*l/86.9%
*-un-lft-identity86.9%
*-commutative86.9%
associate-/r*86.9%
Applied egg-rr86.9%
if 7.1999999999999998e-25 < x Initial program 59.3%
associate-/r*59.3%
cos-neg59.3%
distribute-rgt-neg-out59.3%
distribute-rgt-neg-out59.3%
*-commutative59.3%
distribute-rgt-neg-in59.3%
metadata-eval59.3%
*-commutative59.3%
associate-*l*52.9%
unpow252.9%
Simplified52.9%
Applied egg-rr95.1%
associate-*l/95.0%
*-un-lft-identity95.0%
unpow295.0%
associate-/r*95.3%
*-commutative95.3%
associate-*r*94.1%
*-commutative94.1%
associate-*r*96.6%
*-commutative96.6%
Applied egg-rr96.6%
Taylor expanded in s around 0 94.1%
*-un-lft-identity94.1%
*-commutative94.1%
associate-*r*96.6%
times-frac96.6%
*-commutative96.6%
associate-/r*96.7%
Applied egg-rr96.7%
Final simplification89.6%
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.1e-24) (* (/ 1.0 (* c_m (* x_m s_m))) (/ (/ (/ 1.0 s_m) x_m) c_m)) (/ (/ (/ (cos (* x_m 2.0)) s_m) (* x_m c_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 tmp;
if (x_m <= 2.1e-24) {
tmp = (1.0 / (c_m * (x_m * s_m))) * (((1.0 / s_m) / x_m) / c_m);
} else {
tmp = ((cos((x_m * 2.0)) / s_m) / (x_m * c_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) :: tmp
if (x_m <= 2.1d-24) then
tmp = (1.0d0 / (c_m * (x_m * s_m))) * (((1.0d0 / s_m) / x_m) / c_m)
else
tmp = ((cos((x_m * 2.0d0)) / s_m) / (x_m * c_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 tmp;
if (x_m <= 2.1e-24) {
tmp = (1.0 / (c_m * (x_m * s_m))) * (((1.0 / s_m) / x_m) / c_m);
} else {
tmp = ((Math.cos((x_m * 2.0)) / s_m) / (x_m * c_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): tmp = 0 if x_m <= 2.1e-24: tmp = (1.0 / (c_m * (x_m * s_m))) * (((1.0 / s_m) / x_m) / c_m) else: tmp = ((math.cos((x_m * 2.0)) / s_m) / (x_m * c_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) tmp = 0.0 if (x_m <= 2.1e-24) tmp = Float64(Float64(1.0 / Float64(c_m * Float64(x_m * s_m))) * Float64(Float64(Float64(1.0 / s_m) / x_m) / c_m)); else tmp = Float64(Float64(Float64(cos(Float64(x_m * 2.0)) / s_m) / Float64(x_m * c_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)
tmp = 0.0;
if (x_m <= 2.1e-24)
tmp = (1.0 / (c_m * (x_m * s_m))) * (((1.0 / s_m) / x_m) / c_m);
else
tmp = ((cos((x_m * 2.0)) / s_m) / (x_m * c_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_] := If[LessEqual[x$95$m, 2.1e-24], N[(N[(1.0 / N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1.0 / s$95$m), $MachinePrecision] / x$95$m), $MachinePrecision] / c$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Cos[N[(x$95$m * 2.0), $MachinePrecision]], $MachinePrecision] / s$95$m), $MachinePrecision] / N[(x$95$m * c$95$m), $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}
\mathbf{if}\;x\_m \leq 2.1 \cdot 10^{-24}:\\
\;\;\;\;\frac{1}{c\_m \cdot \left(x\_m \cdot s\_m\right)} \cdot \frac{\frac{\frac{1}{s\_m}}{x\_m}}{c\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{\cos \left(x\_m \cdot 2\right)}{s\_m}}{x\_m \cdot c\_m}}{s\_m \cdot \left(x\_m \cdot c\_m\right)}\\
\end{array}
\end{array}
if x < 2.0999999999999999e-24Initial program 69.8%
associate-/r*69.8%
cos-neg69.8%
distribute-rgt-neg-out69.8%
distribute-rgt-neg-out69.8%
*-commutative69.8%
distribute-rgt-neg-in69.8%
metadata-eval69.8%
*-commutative69.8%
associate-*l*62.7%
unpow262.7%
Simplified62.7%
Applied egg-rr97.5%
Taylor expanded in x around 0 87.2%
associate-/r*87.2%
div-inv86.9%
Applied egg-rr86.9%
associate-*l/86.9%
*-un-lft-identity86.9%
*-commutative86.9%
associate-/r*86.9%
Applied egg-rr86.9%
if 2.0999999999999999e-24 < x Initial program 59.3%
associate-/r*59.3%
cos-neg59.3%
distribute-rgt-neg-out59.3%
distribute-rgt-neg-out59.3%
*-commutative59.3%
distribute-rgt-neg-in59.3%
metadata-eval59.3%
*-commutative59.3%
associate-*l*52.9%
unpow252.9%
Simplified52.9%
Applied egg-rr95.1%
associate-*l/95.0%
*-un-lft-identity95.0%
unpow295.0%
associate-/r*95.3%
*-commutative95.3%
associate-*r*94.1%
*-commutative94.1%
associate-*r*96.6%
*-commutative96.6%
Applied egg-rr96.6%
Taylor expanded in x around inf 94.1%
*-commutative94.1%
associate-*r*94.0%
*-commutative94.0%
associate-*r*96.6%
associate-/r*96.7%
*-commutative96.7%
*-commutative96.7%
Simplified96.7%
Final simplification89.6%
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 1.26e-24)
(* (/ 1.0 (* c_m (* x_m s_m))) (/ (/ (/ 1.0 s_m) x_m) c_m))
(/ (/ (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 <= 1.26e-24) {
tmp = (1.0 / (c_m * (x_m * s_m))) * (((1.0 / s_m) / x_m) / c_m);
} 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 <= 1.26d-24) then
tmp = (1.0d0 / (c_m * (x_m * s_m))) * (((1.0d0 / s_m) / x_m) / c_m)
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 <= 1.26e-24) {
tmp = (1.0 / (c_m * (x_m * s_m))) * (((1.0 / s_m) / x_m) / c_m);
} 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 <= 1.26e-24: tmp = (1.0 / (c_m * (x_m * s_m))) * (((1.0 / s_m) / x_m) / c_m) 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 <= 1.26e-24) tmp = Float64(Float64(1.0 / Float64(c_m * Float64(x_m * s_m))) * Float64(Float64(Float64(1.0 / s_m) / x_m) / c_m)); 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 <= 1.26e-24)
tmp = (1.0 / (c_m * (x_m * s_m))) * (((1.0 / s_m) / x_m) / c_m);
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, 1.26e-24], N[(N[(1.0 / N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1.0 / s$95$m), $MachinePrecision] / x$95$m), $MachinePrecision] / c$95$m), $MachinePrecision]), $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 1.26 \cdot 10^{-24}:\\
\;\;\;\;\frac{1}{c\_m \cdot \left(x\_m \cdot s\_m\right)} \cdot \frac{\frac{\frac{1}{s\_m}}{x\_m}}{c\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cos \left(x\_m \cdot 2\right)}{t\_0}}{t\_0}\\
\end{array}
\end{array}
if x < 1.25999999999999992e-24Initial program 69.8%
associate-/r*69.8%
cos-neg69.8%
distribute-rgt-neg-out69.8%
distribute-rgt-neg-out69.8%
*-commutative69.8%
distribute-rgt-neg-in69.8%
metadata-eval69.8%
*-commutative69.8%
associate-*l*62.7%
unpow262.7%
Simplified62.7%
Applied egg-rr97.5%
Taylor expanded in x around 0 87.2%
associate-/r*87.2%
div-inv86.9%
Applied egg-rr86.9%
associate-*l/86.9%
*-un-lft-identity86.9%
*-commutative86.9%
associate-/r*86.9%
Applied egg-rr86.9%
if 1.25999999999999992e-24 < x Initial program 59.3%
associate-/r*59.3%
cos-neg59.3%
distribute-rgt-neg-out59.3%
distribute-rgt-neg-out59.3%
*-commutative59.3%
distribute-rgt-neg-in59.3%
metadata-eval59.3%
*-commutative59.3%
associate-*l*52.9%
unpow252.9%
Simplified52.9%
Applied egg-rr95.1%
associate-*l/95.0%
*-un-lft-identity95.0%
unpow295.0%
associate-/r*95.3%
*-commutative95.3%
associate-*r*94.1%
*-commutative94.1%
associate-*r*96.6%
*-commutative96.6%
Applied egg-rr96.6%
Final simplification89.6%
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 (* c_m (* x_m s_m))))
(if (<= x_m 1.1e-25)
(* (/ 1.0 t_0) (/ (/ (/ 1.0 s_m) x_m) c_m))
(/ (/ (cos (* x_m 2.0)) t_0) (* 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 = c_m * (x_m * s_m);
double tmp;
if (x_m <= 1.1e-25) {
tmp = (1.0 / t_0) * (((1.0 / s_m) / x_m) / c_m);
} else {
tmp = (cos((x_m * 2.0)) / t_0) / (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 = c_m * (x_m * s_m)
if (x_m <= 1.1d-25) then
tmp = (1.0d0 / t_0) * (((1.0d0 / s_m) / x_m) / c_m)
else
tmp = (cos((x_m * 2.0d0)) / t_0) / (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 = c_m * (x_m * s_m);
double tmp;
if (x_m <= 1.1e-25) {
tmp = (1.0 / t_0) * (((1.0 / s_m) / x_m) / c_m);
} else {
tmp = (Math.cos((x_m * 2.0)) / t_0) / (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 = c_m * (x_m * s_m) tmp = 0 if x_m <= 1.1e-25: tmp = (1.0 / t_0) * (((1.0 / s_m) / x_m) / c_m) else: tmp = (math.cos((x_m * 2.0)) / t_0) / (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(c_m * Float64(x_m * s_m)) tmp = 0.0 if (x_m <= 1.1e-25) tmp = Float64(Float64(1.0 / t_0) * Float64(Float64(Float64(1.0 / s_m) / x_m) / c_m)); else tmp = Float64(Float64(cos(Float64(x_m * 2.0)) / t_0) / 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 = c_m * (x_m * s_m);
tmp = 0.0;
if (x_m <= 1.1e-25)
tmp = (1.0 / t_0) * (((1.0 / s_m) / x_m) / c_m);
else
tmp = (cos((x_m * 2.0)) / t_0) / (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[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$95$m, 1.1e-25], N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(N[(N[(1.0 / s$95$m), $MachinePrecision] / x$95$m), $MachinePrecision] / c$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[N[(x$95$m * 2.0), $MachinePrecision]], $MachinePrecision] / t$95$0), $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 := c\_m \cdot \left(x\_m \cdot s\_m\right)\\
\mathbf{if}\;x\_m \leq 1.1 \cdot 10^{-25}:\\
\;\;\;\;\frac{1}{t\_0} \cdot \frac{\frac{\frac{1}{s\_m}}{x\_m}}{c\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cos \left(x\_m \cdot 2\right)}{t\_0}}{s\_m \cdot \left(x\_m \cdot c\_m\right)}\\
\end{array}
\end{array}
if x < 1.1000000000000001e-25Initial program 69.8%
associate-/r*69.8%
cos-neg69.8%
distribute-rgt-neg-out69.8%
distribute-rgt-neg-out69.8%
*-commutative69.8%
distribute-rgt-neg-in69.8%
metadata-eval69.8%
*-commutative69.8%
associate-*l*62.7%
unpow262.7%
Simplified62.7%
Applied egg-rr97.5%
Taylor expanded in x around 0 87.2%
associate-/r*87.2%
div-inv86.9%
Applied egg-rr86.9%
associate-*l/86.9%
*-un-lft-identity86.9%
*-commutative86.9%
associate-/r*86.9%
Applied egg-rr86.9%
if 1.1000000000000001e-25 < x Initial program 59.3%
associate-/r*59.3%
cos-neg59.3%
distribute-rgt-neg-out59.3%
distribute-rgt-neg-out59.3%
*-commutative59.3%
distribute-rgt-neg-in59.3%
metadata-eval59.3%
*-commutative59.3%
associate-*l*52.9%
unpow252.9%
Simplified52.9%
Applied egg-rr95.1%
associate-*l/95.0%
*-un-lft-identity95.0%
unpow295.0%
associate-/r*95.3%
*-commutative95.3%
associate-*r*94.1%
*-commutative94.1%
associate-*r*96.6%
*-commutative96.6%
Applied egg-rr96.6%
Taylor expanded in s around 0 94.1%
Final simplification88.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 (if (<= x_m 2.3e-25) (* (/ 1.0 (* c_m (* x_m s_m))) (/ (/ (/ 1.0 s_m) x_m) c_m)) (/ (cos (* x_m 2.0)) (* (* x_m s_m) (* c_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 tmp;
if (x_m <= 2.3e-25) {
tmp = (1.0 / (c_m * (x_m * s_m))) * (((1.0 / s_m) / x_m) / c_m);
} else {
tmp = cos((x_m * 2.0)) / ((x_m * s_m) * (c_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) :: tmp
if (x_m <= 2.3d-25) then
tmp = (1.0d0 / (c_m * (x_m * s_m))) * (((1.0d0 / s_m) / x_m) / c_m)
else
tmp = cos((x_m * 2.0d0)) / ((x_m * s_m) * (c_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 tmp;
if (x_m <= 2.3e-25) {
tmp = (1.0 / (c_m * (x_m * s_m))) * (((1.0 / s_m) / x_m) / c_m);
} else {
tmp = Math.cos((x_m * 2.0)) / ((x_m * s_m) * (c_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): tmp = 0 if x_m <= 2.3e-25: tmp = (1.0 / (c_m * (x_m * s_m))) * (((1.0 / s_m) / x_m) / c_m) else: tmp = math.cos((x_m * 2.0)) / ((x_m * s_m) * (c_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) tmp = 0.0 if (x_m <= 2.3e-25) tmp = Float64(Float64(1.0 / Float64(c_m * Float64(x_m * s_m))) * Float64(Float64(Float64(1.0 / s_m) / x_m) / c_m)); else tmp = Float64(cos(Float64(x_m * 2.0)) / Float64(Float64(x_m * s_m) * Float64(c_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)
tmp = 0.0;
if (x_m <= 2.3e-25)
tmp = (1.0 / (c_m * (x_m * s_m))) * (((1.0 / s_m) / x_m) / c_m);
else
tmp = cos((x_m * 2.0)) / ((x_m * s_m) * (c_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_] := If[LessEqual[x$95$m, 2.3e-25], N[(N[(1.0 / N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1.0 / s$95$m), $MachinePrecision] / x$95$m), $MachinePrecision] / c$95$m), $MachinePrecision]), $MachinePrecision], 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[(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])\\
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 2.3 \cdot 10^{-25}:\\
\;\;\;\;\frac{1}{c\_m \cdot \left(x\_m \cdot s\_m\right)} \cdot \frac{\frac{\frac{1}{s\_m}}{x\_m}}{c\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x\_m \cdot 2\right)}{\left(x\_m \cdot s\_m\right) \cdot \left(c\_m \cdot \left(s\_m \cdot \left(x\_m \cdot c\_m\right)\right)\right)}\\
\end{array}
\end{array}
if x < 2.2999999999999999e-25Initial program 69.8%
associate-/r*69.8%
cos-neg69.8%
distribute-rgt-neg-out69.8%
distribute-rgt-neg-out69.8%
*-commutative69.8%
distribute-rgt-neg-in69.8%
metadata-eval69.8%
*-commutative69.8%
associate-*l*62.7%
unpow262.7%
Simplified62.7%
Applied egg-rr97.5%
Taylor expanded in x around 0 87.2%
associate-/r*87.2%
div-inv86.9%
Applied egg-rr86.9%
associate-*l/86.9%
*-un-lft-identity86.9%
*-commutative86.9%
associate-/r*86.9%
Applied egg-rr86.9%
if 2.2999999999999999e-25 < x Initial program 59.3%
Taylor expanded in x around inf 53.0%
associate-/r*52.9%
*-commutative52.9%
unpow252.9%
unpow252.9%
swap-sqr74.2%
unpow274.2%
associate-/r*74.2%
*-commutative74.2%
unpow274.2%
unpow274.2%
swap-sqr95.0%
unpow295.0%
*-commutative95.0%
associate-*l*95.0%
Simplified95.0%
associate-*r*95.0%
*-commutative95.0%
unpow295.0%
associate-*r*92.9%
associate-*r*91.6%
*-commutative91.6%
Applied egg-rr91.6%
Final simplification88.2%
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 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 / (c_m * (x_m * s_m))) * (((1.0 / 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 / (c_m * (x_m * s_m))) * (((1.0d0 / 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 / (c_m * (x_m * s_m))) * (((1.0 / 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 / (c_m * (x_m * s_m))) * (((1.0 / 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(Float64(1.0 / Float64(c_m * Float64(x_m * s_m))) * Float64(Float64(Float64(1.0 / s_m) / 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 / (c_m * (x_m * s_m))) * (((1.0 / 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[(N[(1.0 / N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1.0 / s$95$m), $MachinePrecision] / x$95$m), $MachinePrecision] / c$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])\\
\\
\frac{1}{c\_m \cdot \left(x\_m \cdot s\_m\right)} \cdot \frac{\frac{\frac{1}{s\_m}}{x\_m}}{c\_m}
\end{array}
Initial program 66.9%
associate-/r*66.9%
cos-neg66.9%
distribute-rgt-neg-out66.9%
distribute-rgt-neg-out66.9%
*-commutative66.9%
distribute-rgt-neg-in66.9%
metadata-eval66.9%
*-commutative66.9%
associate-*l*60.0%
unpow260.0%
Simplified60.0%
Applied egg-rr96.9%
Taylor expanded in x around 0 79.1%
associate-/r*79.1%
div-inv78.9%
Applied egg-rr78.9%
associate-*l/78.9%
*-un-lft-identity78.9%
*-commutative78.9%
associate-/r*78.9%
Applied egg-rr78.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 (/ 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 66.9%
associate-/r*66.9%
cos-neg66.9%
distribute-rgt-neg-out66.9%
distribute-rgt-neg-out66.9%
*-commutative66.9%
distribute-rgt-neg-in66.9%
metadata-eval66.9%
*-commutative66.9%
associate-*l*60.0%
unpow260.0%
Simplified60.0%
Applied egg-rr96.9%
Taylor expanded in x around 0 79.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))) (* 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 / (c_m * (x_m * s_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 / (c_m * (x_m * s_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 / (c_m * (x_m * s_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 / (c_m * (x_m * s_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(Float64(1.0 / Float64(c_m * Float64(x_m * s_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 / (c_m * (x_m * s_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[(1.0 / N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x$95$m * s$95$m), $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{\frac{1}{c\_m \cdot \left(x\_m \cdot s\_m\right)}}{x\_m \cdot s\_m}}{c\_m}
\end{array}
Initial program 66.9%
associate-/r*66.9%
cos-neg66.9%
distribute-rgt-neg-out66.9%
distribute-rgt-neg-out66.9%
*-commutative66.9%
distribute-rgt-neg-in66.9%
metadata-eval66.9%
*-commutative66.9%
associate-*l*60.0%
unpow260.0%
Simplified60.0%
Applied egg-rr96.9%
Taylor expanded in x around 0 79.1%
metadata-eval79.1%
frac-times78.9%
un-div-inv78.9%
*-commutative78.9%
associate-/r*77.1%
frac-times77.0%
metadata-eval77.0%
associate-*r*74.8%
*-commutative74.8%
Applied egg-rr74.8%
Taylor expanded in s around 0 77.0%
Final simplification77.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 66.9%
associate-/r*66.9%
cos-neg66.9%
distribute-rgt-neg-out66.9%
distribute-rgt-neg-out66.9%
*-commutative66.9%
distribute-rgt-neg-in66.9%
metadata-eval66.9%
*-commutative66.9%
associate-*l*60.0%
unpow260.0%
Simplified60.0%
Applied egg-rr96.6%
associate-*l/96.6%
*-un-lft-identity96.6%
unpow296.6%
associate-/r*96.9%
*-commutative96.9%
associate-*r*93.8%
*-commutative93.8%
associate-*r*96.0%
*-commutative96.0%
Applied egg-rr96.0%
Taylor expanded in x around 0 78.1%
Final simplification78.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)))) (/ 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(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 = 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[(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 := s\_m \cdot \left(x\_m \cdot c\_m\right)\\
\frac{1}{t\_0 \cdot t\_0}
\end{array}
\end{array}
Initial program 66.9%
associate-/r*66.9%
cos-neg66.9%
distribute-rgt-neg-out66.9%
distribute-rgt-neg-out66.9%
*-commutative66.9%
distribute-rgt-neg-in66.9%
metadata-eval66.9%
*-commutative66.9%
associate-*l*60.0%
unpow260.0%
Simplified60.0%
Taylor expanded in x around 0 55.4%
associate-/r*55.4%
*-commutative55.4%
unpow255.4%
unpow255.4%
swap-sqr65.4%
unpow265.4%
associate-/r*65.5%
unpow265.5%
unpow265.5%
swap-sqr79.1%
unpow279.1%
*-commutative79.1%
associate-*l*79.5%
Simplified79.5%
unpow279.5%
*-commutative79.5%
associate-*l*77.3%
*-commutative77.3%
associate-*l*78.1%
Applied egg-rr78.1%
Final simplification78.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 (* (* 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 66.9%
associate-/r*66.9%
cos-neg66.9%
distribute-rgt-neg-out66.9%
distribute-rgt-neg-out66.9%
*-commutative66.9%
distribute-rgt-neg-in66.9%
metadata-eval66.9%
*-commutative66.9%
associate-*l*60.0%
unpow260.0%
Simplified60.0%
Taylor expanded in x around 0 55.4%
associate-/r*55.4%
*-commutative55.4%
unpow255.4%
unpow255.4%
swap-sqr65.4%
unpow265.4%
associate-/r*65.5%
unpow265.5%
unpow265.5%
swap-sqr79.1%
unpow279.1%
*-commutative79.1%
associate-*l*79.5%
Simplified79.5%
associate-*r*79.1%
*-commutative79.1%
unpow279.1%
associate-*r*76.9%
associate-*l*76.0%
associate-*r*76.8%
*-commutative76.8%
Applied egg-rr76.8%
Final simplification76.8%
herbie shell --seed 2024139
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))