
(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 9 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 2.8e+41)
(* (pow (* c_m (* x_m s_m)) -2.0) t_1)
(/ 1.0 (/ (* t_0 t_0) t_1)))))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 <= 2.8e+41) {
tmp = pow((c_m * (x_m * s_m)), -2.0) * t_1;
} else {
tmp = 1.0 / ((t_0 * t_0) / t_1);
}
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 <= 2.8d+41) then
tmp = ((c_m * (x_m * s_m)) ** (-2.0d0)) * t_1
else
tmp = 1.0d0 / ((t_0 * t_0) / t_1)
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 <= 2.8e+41) {
tmp = Math.pow((c_m * (x_m * s_m)), -2.0) * t_1;
} else {
tmp = 1.0 / ((t_0 * t_0) / t_1);
}
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 <= 2.8e+41: tmp = math.pow((c_m * (x_m * s_m)), -2.0) * t_1 else: tmp = 1.0 / ((t_0 * t_0) / t_1) 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 <= 2.8e+41) tmp = Float64((Float64(c_m * Float64(x_m * s_m)) ^ -2.0) * t_1); else tmp = Float64(1.0 / Float64(Float64(t_0 * t_0) / t_1)); 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 <= 2.8e+41)
tmp = ((c_m * (x_m * s_m)) ^ -2.0) * t_1;
else
tmp = 1.0 / ((t_0 * t_0) / t_1);
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, 2.8e+41], N[(N[Power[N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] * t$95$1), $MachinePrecision], N[(1.0 / N[(N[(t$95$0 * t$95$0), $MachinePrecision] / t$95$1), $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)\\
t_1 := \cos \left(x_m \cdot 2\right)\\
\mathbf{if}\;x_m \leq 2.8 \cdot 10^{+41}:\\
\;\;\;\;{\left(c_m \cdot \left(x_m \cdot s_m\right)\right)}^{-2} \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{t_0 \cdot t_0}{t_1}}\\
\end{array}
\end{array}
if x < 2.7999999999999999e41Initial program 66.4%
*-un-lft-identity66.4%
associate-*r*67.5%
times-frac67.4%
*-commutative67.4%
associate-*r*66.5%
pow-prod-down85.9%
Applied egg-rr85.9%
Taylor expanded in c around 0 60.5%
unpow260.5%
unpow260.5%
swap-sqr75.8%
unpow275.8%
*-commutative75.8%
*-lft-identity75.8%
unpow275.8%
unpow275.8%
swap-sqr98.2%
associate-*r*94.1%
*-commutative94.1%
associate-*r*95.0%
associate-*r*92.3%
*-commutative92.3%
associate-*r*96.3%
unpow296.3%
associate-*l/96.3%
Simplified98.2%
if 2.7999999999999999e41 < x Initial program 56.6%
*-un-lft-identity56.6%
associate-*r*56.7%
times-frac56.7%
*-commutative56.7%
associate-*r*51.8%
pow-prod-down76.0%
Applied egg-rr76.0%
Applied egg-rr93.0%
unpow293.0%
Applied egg-rr93.0%
Final simplification97.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 (* c_m (* x_m s_m))))
(if (<= x_m 1.6e+33)
(* (/ 1.0 t_0) (/ (cos (* x_m 2.0)) t_0))
(/ (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 t_0 = c_m * (x_m * s_m);
double tmp;
if (x_m <= 1.6e+33) {
tmp = (1.0 / t_0) * (cos((x_m * 2.0)) / t_0);
} 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) :: t_0
real(8) :: tmp
t_0 = c_m * (x_m * s_m)
if (x_m <= 1.6d+33) then
tmp = (1.0d0 / t_0) * (cos((x_m * 2.0d0)) / t_0)
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 t_0 = c_m * (x_m * s_m);
double tmp;
if (x_m <= 1.6e+33) {
tmp = (1.0 / t_0) * (Math.cos((x_m * 2.0)) / t_0);
} 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): t_0 = c_m * (x_m * s_m) tmp = 0 if x_m <= 1.6e+33: tmp = (1.0 / t_0) * (math.cos((x_m * 2.0)) / t_0) 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) t_0 = Float64(c_m * Float64(x_m * s_m)) tmp = 0.0 if (x_m <= 1.6e+33) tmp = Float64(Float64(1.0 / t_0) * Float64(cos(Float64(x_m * 2.0)) / t_0)); else tmp = Float64(cos(Float64(x_m * -2.0)) / Float64(s_m * Float64(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)
t_0 = c_m * (x_m * s_m);
tmp = 0.0;
if (x_m <= 1.6e+33)
tmp = (1.0 / t_0) * (cos((x_m * 2.0)) / t_0);
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_] := Block[{t$95$0 = N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$95$m, 1.6e+33], N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(N[Cos[N[(x$95$m * 2.0), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(x$95$m * -2.0), $MachinePrecision]], $MachinePrecision] / N[(s$95$m * N[(N[(x$95$m * c$95$m), $MachinePrecision] * 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}
t_0 := c_m \cdot \left(x_m \cdot s_m\right)\\
\mathbf{if}\;x_m \leq 1.6 \cdot 10^{+33}:\\
\;\;\;\;\frac{1}{t_0} \cdot \frac{\cos \left(x_m \cdot 2\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x_m \cdot -2\right)}{s_m \cdot \left(\left(x_m \cdot c_m\right) \cdot \left(s_m \cdot \left(x_m \cdot c_m\right)\right)\right)}\\
\end{array}
\end{array}
if x < 1.60000000000000009e33Initial program 66.3%
*-un-lft-identity66.3%
add-sqr-sqrt66.2%
times-frac66.2%
Applied egg-rr98.2%
if 1.60000000000000009e33 < x Initial program 57.4%
associate-/r*57.4%
associate-*l*57.4%
unpow257.4%
sqr-neg57.4%
unpow257.4%
*-commutative57.4%
*-commutative57.4%
associate-/r*57.4%
cos-neg57.4%
*-commutative57.4%
distribute-rgt-neg-in57.4%
metadata-eval57.4%
associate-*r*57.4%
*-commutative57.4%
unpow257.4%
sqr-neg57.4%
associate-*l*71.6%
associate-*r*73.1%
Simplified50.3%
Taylor expanded in x around inf 50.3%
associate-/r*50.3%
*-commutative50.3%
unpow250.3%
unpow250.3%
swap-sqr77.7%
unpow277.7%
associate-/r*77.6%
*-commutative77.6%
unpow277.6%
unpow277.6%
swap-sqr96.3%
unpow296.3%
associate-*r*93.1%
*-commutative93.1%
Simplified93.1%
unpow293.1%
associate-*r*91.6%
*-commutative91.6%
associate-*r*90.0%
*-commutative90.0%
associate-*r*88.4%
associate-*r*90.1%
*-commutative90.1%
associate-*r*91.6%
Applied egg-rr91.6%
Final simplification96.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 (* c_m (* x_m s_m))))
(if (<= x_m 4e-25)
(pow t_0 -2.0)
(/ (cos (* x_m -2.0)) (* x_m (* t_0 (* 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 t_0 = c_m * (x_m * s_m);
double tmp;
if (x_m <= 4e-25) {
tmp = pow(t_0, -2.0);
} else {
tmp = cos((x_m * -2.0)) / (x_m * (t_0 * (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) :: t_0
real(8) :: tmp
t_0 = c_m * (x_m * s_m)
if (x_m <= 4d-25) then
tmp = t_0 ** (-2.0d0)
else
tmp = cos((x_m * (-2.0d0))) / (x_m * (t_0 * (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 t_0 = c_m * (x_m * s_m);
double tmp;
if (x_m <= 4e-25) {
tmp = Math.pow(t_0, -2.0);
} else {
tmp = Math.cos((x_m * -2.0)) / (x_m * (t_0 * (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): t_0 = c_m * (x_m * s_m) tmp = 0 if x_m <= 4e-25: tmp = math.pow(t_0, -2.0) else: tmp = math.cos((x_m * -2.0)) / (x_m * (t_0 * (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) t_0 = Float64(c_m * Float64(x_m * s_m)) tmp = 0.0 if (x_m <= 4e-25) tmp = t_0 ^ -2.0; else tmp = Float64(cos(Float64(x_m * -2.0)) / Float64(x_m * Float64(t_0 * 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)
t_0 = c_m * (x_m * s_m);
tmp = 0.0;
if (x_m <= 4e-25)
tmp = t_0 ^ -2.0;
else
tmp = cos((x_m * -2.0)) / (x_m * (t_0 * (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_] := Block[{t$95$0 = N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$95$m, 4e-25], N[Power[t$95$0, -2.0], $MachinePrecision], N[(N[Cos[N[(x$95$m * -2.0), $MachinePrecision]], $MachinePrecision] / N[(x$95$m * N[(t$95$0 * 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}
t_0 := c_m \cdot \left(x_m \cdot s_m\right)\\
\mathbf{if}\;x_m \leq 4 \cdot 10^{-25}:\\
\;\;\;\;{t_0}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x_m \cdot -2\right)}{x_m \cdot \left(t_0 \cdot \left(c_m \cdot s_m\right)\right)}\\
\end{array}
\end{array}
if x < 4.00000000000000015e-25Initial program 67.1%
associate-/r*66.9%
associate-*l*66.9%
unpow266.9%
sqr-neg66.9%
unpow266.9%
*-commutative66.9%
*-commutative66.9%
associate-/r*67.1%
cos-neg67.1%
*-commutative67.1%
distribute-rgt-neg-in67.1%
metadata-eval67.1%
associate-*r*68.1%
*-commutative68.1%
unpow268.1%
sqr-neg68.1%
associate-*l*72.8%
associate-*r*76.0%
Simplified60.9%
Taylor expanded in x around inf 60.9%
associate-/r*60.7%
*-commutative60.7%
unpow260.7%
unpow260.7%
swap-sqr76.6%
unpow276.6%
associate-/r*76.8%
*-commutative76.8%
unpow276.8%
unpow276.8%
swap-sqr98.2%
unpow298.2%
associate-*r*96.2%
*-commutative96.2%
Simplified96.2%
Taylor expanded in x around 0 55.6%
unpow255.6%
unpow255.6%
swap-sqr67.6%
unpow267.6%
unpow267.6%
unpow267.6%
swap-sqr82.3%
associate-*r*78.9%
*-commutative78.9%
associate-*r*80.6%
associate-*r*78.6%
*-commutative78.6%
associate-*r*82.0%
unpow282.0%
/-rgt-identity82.0%
unpow282.0%
associate-/l*82.0%
associate-/l*82.1%
associate-*l/82.1%
unpow-182.1%
Simplified82.3%
if 4.00000000000000015e-25 < x Initial program 55.9%
associate-/r*55.9%
associate-*l*55.9%
unpow255.9%
sqr-neg55.9%
unpow255.9%
*-commutative55.9%
*-commutative55.9%
associate-/r*55.9%
cos-neg55.9%
*-commutative55.9%
distribute-rgt-neg-in55.9%
metadata-eval55.9%
associate-*r*56.0%
*-commutative56.0%
unpow256.0%
sqr-neg56.0%
associate-*l*68.6%
associate-*r*70.1%
Simplified49.6%
Taylor expanded in x around inf 49.6%
associate-/r*49.6%
*-commutative49.6%
unpow249.6%
unpow249.6%
swap-sqr74.0%
unpow274.0%
associate-/r*74.0%
*-commutative74.0%
unpow274.0%
unpow274.0%
swap-sqr96.5%
unpow296.5%
associate-*r*93.7%
*-commutative93.7%
Simplified93.7%
associate-*r*97.9%
*-commutative97.9%
associate-*r*96.5%
unpow296.5%
associate-*r*95.1%
associate-*r*93.8%
associate-*r*96.7%
*-commutative96.7%
associate-*r*91.1%
*-commutative91.1%
Applied egg-rr91.1%
Taylor expanded in s around 0 93.8%
Final simplification85.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 (if (<= x_m 3.3e-22) (pow (* c_m (* x_m s_m)) -2.0) (/ (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 <= 3.3e-22) {
tmp = pow((c_m * (x_m * s_m)), -2.0);
} 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 <= 3.3d-22) then
tmp = (c_m * (x_m * s_m)) ** (-2.0d0)
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 <= 3.3e-22) {
tmp = Math.pow((c_m * (x_m * s_m)), -2.0);
} 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 <= 3.3e-22: tmp = math.pow((c_m * (x_m * s_m)), -2.0) 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 <= 3.3e-22) 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(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 <= 3.3e-22)
tmp = (c_m * (x_m * s_m)) ^ -2.0;
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, 3.3e-22], 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[(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 3.3 \cdot 10^{-22}:\\
\;\;\;\;{\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(c_m \cdot \left(s_m \cdot \left(x_m \cdot c_m\right)\right)\right)}\\
\end{array}
\end{array}
if x < 3.3000000000000001e-22Initial program 67.1%
associate-/r*66.9%
associate-*l*66.9%
unpow266.9%
sqr-neg66.9%
unpow266.9%
*-commutative66.9%
*-commutative66.9%
associate-/r*67.1%
cos-neg67.1%
*-commutative67.1%
distribute-rgt-neg-in67.1%
metadata-eval67.1%
associate-*r*68.1%
*-commutative68.1%
unpow268.1%
sqr-neg68.1%
associate-*l*72.8%
associate-*r*76.0%
Simplified60.9%
Taylor expanded in x around inf 60.9%
associate-/r*60.7%
*-commutative60.7%
unpow260.7%
unpow260.7%
swap-sqr76.6%
unpow276.6%
associate-/r*76.8%
*-commutative76.8%
unpow276.8%
unpow276.8%
swap-sqr98.2%
unpow298.2%
associate-*r*96.2%
*-commutative96.2%
Simplified96.2%
Taylor expanded in x around 0 55.6%
unpow255.6%
unpow255.6%
swap-sqr67.6%
unpow267.6%
unpow267.6%
unpow267.6%
swap-sqr82.3%
associate-*r*78.9%
*-commutative78.9%
associate-*r*80.6%
associate-*r*78.6%
*-commutative78.6%
associate-*r*82.0%
unpow282.0%
/-rgt-identity82.0%
unpow282.0%
associate-/l*82.0%
associate-/l*82.1%
associate-*l/82.1%
unpow-182.1%
Simplified82.3%
if 3.3000000000000001e-22 < x Initial program 55.9%
associate-/r*55.9%
associate-*l*55.9%
unpow255.9%
sqr-neg55.9%
unpow255.9%
*-commutative55.9%
*-commutative55.9%
associate-/r*55.9%
cos-neg55.9%
*-commutative55.9%
distribute-rgt-neg-in55.9%
metadata-eval55.9%
associate-*r*56.0%
*-commutative56.0%
unpow256.0%
sqr-neg56.0%
associate-*l*68.6%
associate-*r*70.1%
Simplified49.6%
Taylor expanded in x around inf 49.6%
associate-/r*49.6%
*-commutative49.6%
unpow249.6%
unpow249.6%
swap-sqr74.0%
unpow274.0%
associate-/r*74.0%
*-commutative74.0%
unpow274.0%
unpow274.0%
swap-sqr96.5%
unpow296.5%
associate-*r*93.7%
*-commutative93.7%
Simplified93.7%
associate-*r*97.9%
*-commutative97.9%
associate-*r*96.5%
unpow296.5%
associate-*r*93.9%
associate-*r*92.5%
*-commutative92.5%
associate-*r*89.6%
Applied egg-rr89.6%
Final simplification84.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 (if (<= x_m 2.25e-23) (pow (* c_m (* x_m s_m)) -2.0) (/ (cos (* x_m -2.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 tmp;
if (x_m <= 2.25e-23) {
tmp = pow((c_m * (x_m * s_m)), -2.0);
} else {
tmp = cos((x_m * -2.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) :: tmp
if (x_m <= 2.25d-23) then
tmp = (c_m * (x_m * s_m)) ** (-2.0d0)
else
tmp = cos((x_m * (-2.0d0))) / ((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 tmp;
if (x_m <= 2.25e-23) {
tmp = Math.pow((c_m * (x_m * s_m)), -2.0);
} else {
tmp = Math.cos((x_m * -2.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): tmp = 0 if x_m <= 2.25e-23: tmp = math.pow((c_m * (x_m * s_m)), -2.0) else: tmp = math.cos((x_m * -2.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) tmp = 0.0 if (x_m <= 2.25e-23) tmp = Float64(c_m * Float64(x_m * s_m)) ^ -2.0; else tmp = Float64(cos(Float64(x_m * -2.0)) / Float64(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)
tmp = 0.0;
if (x_m <= 2.25e-23)
tmp = (c_m * (x_m * s_m)) ^ -2.0;
else
tmp = cos((x_m * -2.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_] := If[LessEqual[x$95$m, 2.25e-23], 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 * 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])\\
\\
\begin{array}{l}
\mathbf{if}\;x_m \leq 2.25 \cdot 10^{-23}:\\
\;\;\;\;{\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 c_m\right) \cdot \left(s_m \cdot \left(s_m \cdot \left(x_m \cdot c_m\right)\right)\right)}\\
\end{array}
\end{array}
if x < 2.24999999999999987e-23Initial program 67.1%
associate-/r*66.9%
associate-*l*66.9%
unpow266.9%
sqr-neg66.9%
unpow266.9%
*-commutative66.9%
*-commutative66.9%
associate-/r*67.1%
cos-neg67.1%
*-commutative67.1%
distribute-rgt-neg-in67.1%
metadata-eval67.1%
associate-*r*68.1%
*-commutative68.1%
unpow268.1%
sqr-neg68.1%
associate-*l*72.8%
associate-*r*76.0%
Simplified60.9%
Taylor expanded in x around inf 60.9%
associate-/r*60.7%
*-commutative60.7%
unpow260.7%
unpow260.7%
swap-sqr76.6%
unpow276.6%
associate-/r*76.8%
*-commutative76.8%
unpow276.8%
unpow276.8%
swap-sqr98.2%
unpow298.2%
associate-*r*96.2%
*-commutative96.2%
Simplified96.2%
Taylor expanded in x around 0 55.6%
unpow255.6%
unpow255.6%
swap-sqr67.6%
unpow267.6%
unpow267.6%
unpow267.6%
swap-sqr82.3%
associate-*r*78.9%
*-commutative78.9%
associate-*r*80.6%
associate-*r*78.6%
*-commutative78.6%
associate-*r*82.0%
unpow282.0%
/-rgt-identity82.0%
unpow282.0%
associate-/l*82.0%
associate-/l*82.1%
associate-*l/82.1%
unpow-182.1%
Simplified82.3%
if 2.24999999999999987e-23 < x Initial program 55.9%
associate-/r*55.9%
associate-*l*55.9%
unpow255.9%
sqr-neg55.9%
unpow255.9%
*-commutative55.9%
*-commutative55.9%
associate-/r*55.9%
cos-neg55.9%
*-commutative55.9%
distribute-rgt-neg-in55.9%
metadata-eval55.9%
associate-*r*56.0%
*-commutative56.0%
unpow256.0%
sqr-neg56.0%
associate-*l*68.6%
associate-*r*70.1%
Simplified49.6%
Taylor expanded in x around inf 49.6%
associate-/r*49.6%
*-commutative49.6%
unpow249.6%
unpow249.6%
swap-sqr74.0%
unpow274.0%
associate-/r*74.0%
*-commutative74.0%
unpow274.0%
unpow274.0%
swap-sqr96.5%
unpow296.5%
associate-*r*93.7%
*-commutative93.7%
Simplified93.7%
unpow293.7%
associate-*r*92.5%
*-commutative92.5%
associate-*r*91.0%
associate-*r*91.0%
associate-*r*91.0%
*-commutative91.0%
associate-*r*92.4%
Applied egg-rr92.4%
Final simplification84.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 4.8e-21) (pow (* c_m (* x_m s_m)) -2.0) (/ (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 <= 4.8e-21) {
tmp = pow((c_m * (x_m * s_m)), -2.0);
} 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 <= 4.8d-21) then
tmp = (c_m * (x_m * s_m)) ** (-2.0d0)
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 <= 4.8e-21) {
tmp = Math.pow((c_m * (x_m * s_m)), -2.0);
} 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 <= 4.8e-21: tmp = math.pow((c_m * (x_m * s_m)), -2.0) 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 <= 4.8e-21) tmp = Float64(c_m * Float64(x_m * s_m)) ^ -2.0; else tmp = Float64(cos(Float64(x_m * -2.0)) / Float64(s_m * Float64(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 <= 4.8e-21)
tmp = (c_m * (x_m * s_m)) ^ -2.0;
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, 4.8e-21], 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[(s$95$m * N[(N[(x$95$m * c$95$m), $MachinePrecision] * 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 4.8 \cdot 10^{-21}:\\
\;\;\;\;{\left(c_m \cdot \left(x_m \cdot s_m\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x_m \cdot -2\right)}{s_m \cdot \left(\left(x_m \cdot c_m\right) \cdot \left(s_m \cdot \left(x_m \cdot c_m\right)\right)\right)}\\
\end{array}
\end{array}
if x < 4.7999999999999999e-21Initial program 66.7%
associate-/r*66.5%
associate-*l*66.5%
unpow266.5%
sqr-neg66.5%
unpow266.5%
*-commutative66.5%
*-commutative66.5%
associate-/r*66.7%
cos-neg66.7%
*-commutative66.7%
distribute-rgt-neg-in66.7%
metadata-eval66.7%
associate-*r*67.8%
*-commutative67.8%
unpow267.8%
sqr-neg67.8%
associate-*l*72.4%
associate-*r*75.6%
Simplified60.6%
Taylor expanded in x around inf 60.6%
associate-/r*60.4%
*-commutative60.4%
unpow260.4%
unpow260.4%
swap-sqr76.2%
unpow276.2%
associate-/r*76.4%
*-commutative76.4%
unpow276.4%
unpow276.4%
swap-sqr98.2%
unpow298.2%
associate-*r*96.2%
*-commutative96.2%
Simplified96.2%
Taylor expanded in x around 0 55.3%
unpow255.3%
unpow255.3%
swap-sqr67.2%
unpow267.2%
unpow267.2%
unpow267.2%
swap-sqr82.4%
associate-*r*79.0%
*-commutative79.0%
associate-*r*80.7%
associate-*r*78.8%
*-commutative78.8%
associate-*r*82.1%
unpow282.1%
/-rgt-identity82.1%
unpow282.1%
associate-/l*82.1%
associate-/l*82.2%
associate-*l/82.2%
unpow-182.2%
Simplified82.4%
if 4.7999999999999999e-21 < x Initial program 56.8%
associate-/r*56.8%
associate-*l*56.8%
unpow256.8%
sqr-neg56.8%
unpow256.8%
*-commutative56.8%
*-commutative56.8%
associate-/r*56.8%
cos-neg56.8%
*-commutative56.8%
distribute-rgt-neg-in56.8%
metadata-eval56.8%
associate-*r*56.9%
*-commutative56.9%
unpow256.9%
sqr-neg56.9%
associate-*l*69.7%
associate-*r*71.1%
Simplified50.4%
Taylor expanded in x around inf 50.4%
associate-/r*50.4%
*-commutative50.4%
unpow250.4%
unpow250.4%
swap-sqr75.2%
unpow275.2%
associate-/r*75.2%
*-commutative75.2%
unpow275.2%
unpow275.2%
swap-sqr96.5%
unpow296.5%
associate-*r*93.7%
*-commutative93.7%
Simplified93.7%
unpow293.7%
associate-*r*92.4%
*-commutative92.4%
associate-*r*90.8%
*-commutative90.8%
associate-*r*89.5%
associate-*r*91.0%
*-commutative91.0%
associate-*r*92.3%
Applied egg-rr92.3%
Final simplification84.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 (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 64.2%
associate-/r*64.1%
associate-*l*64.1%
unpow264.1%
sqr-neg64.1%
unpow264.1%
*-commutative64.1%
*-commutative64.1%
associate-/r*64.2%
cos-neg64.2%
*-commutative64.2%
distribute-rgt-neg-in64.2%
metadata-eval64.2%
associate-*r*65.1%
*-commutative65.1%
unpow265.1%
sqr-neg65.1%
associate-*l*71.8%
associate-*r*74.5%
Simplified58.0%
Taylor expanded in x around inf 58.0%
associate-/r*57.9%
*-commutative57.9%
unpow257.9%
unpow257.9%
swap-sqr76.0%
unpow276.0%
associate-/r*76.1%
*-commutative76.1%
unpow276.1%
unpow276.1%
swap-sqr97.8%
unpow297.8%
associate-*r*95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in x around 0 51.8%
unpow251.8%
unpow251.8%
swap-sqr62.9%
unpow262.9%
unpow262.9%
unpow262.9%
swap-sqr76.7%
associate-*r*74.2%
*-commutative74.2%
associate-*r*75.3%
associate-*r*73.9%
*-commutative73.9%
associate-*r*76.5%
unpow276.5%
/-rgt-identity76.5%
unpow276.5%
associate-/l*76.4%
associate-/l*76.5%
associate-*l/76.5%
unpow-176.5%
Simplified76.8%
Final simplification76.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 (/ (/ 1.0 s_m) (* (* c_m (* x_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 / s_m) / ((c_m * (x_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 / s_m) / ((c_m * (x_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 / s_m) / ((c_m * (x_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 / s_m) / ((c_m * (x_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(Float64(1.0 / s_m) / Float64(Float64(c_m * Float64(x_m * 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 / s_m) / ((c_m * (x_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[(N[(1.0 / s$95$m), $MachinePrecision] / N[(N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision] * 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])\\
\\
\frac{\frac{1}{s_m}}{\left(c_m \cdot \left(x_m \cdot s_m\right)\right) \cdot \left(x_m \cdot c_m\right)}
\end{array}
Initial program 64.2%
Taylor expanded in x around 0 51.8%
associate-/r*51.8%
*-commutative51.8%
unpow251.8%
unpow251.8%
swap-sqr62.8%
unpow262.8%
associate-/r*62.9%
unpow262.9%
unpow262.9%
swap-sqr76.7%
unpow276.7%
*-commutative76.7%
Simplified76.7%
add-sqr-sqrt76.8%
sqrt-div76.8%
metadata-eval76.8%
unpow276.8%
sqrt-prod44.9%
add-sqr-sqrt56.5%
associate-*r*54.9%
*-commutative54.9%
associate-*r*56.0%
sqrt-div56.0%
metadata-eval56.0%
unpow256.0%
sqrt-prod36.6%
add-sqr-sqrt75.4%
associate-*r*73.9%
*-commutative73.9%
associate-*r*76.5%
Applied egg-rr76.5%
associate-/r*76.5%
frac-times75.2%
*-un-lft-identity75.2%
*-commutative75.2%
associate-*l*74.1%
*-commutative74.1%
Applied egg-rr74.1%
Final simplification74.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 (* c_m (* x_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 = c_m * (x_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 = c_m * (x_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 = c_m * (x_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 = c_m * (x_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(c_m * Float64(x_m * s_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 = c_m * (x_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[(c$95$m * N[(x$95$m * s$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 := c_m \cdot \left(x_m \cdot s_m\right)\\
\frac{\frac{1}{t_0}}{t_0}
\end{array}
\end{array}
Initial program 64.2%
Taylor expanded in x around 0 51.8%
associate-/r*51.8%
*-commutative51.8%
unpow251.8%
unpow251.8%
swap-sqr62.8%
unpow262.8%
associate-/r*62.9%
unpow262.9%
unpow262.9%
swap-sqr76.7%
unpow276.7%
*-commutative76.7%
Simplified76.7%
add-sqr-sqrt76.8%
sqrt-div76.8%
metadata-eval76.8%
unpow276.8%
sqrt-prod44.9%
add-sqr-sqrt56.5%
associate-*r*54.9%
*-commutative54.9%
associate-*r*56.0%
sqrt-div56.0%
metadata-eval56.0%
unpow256.0%
sqrt-prod36.6%
add-sqr-sqrt75.4%
associate-*r*73.9%
*-commutative73.9%
associate-*r*76.5%
Applied egg-rr76.5%
un-div-inv76.5%
*-commutative76.5%
associate-*l*75.4%
*-commutative75.4%
*-commutative75.4%
associate-*l*76.8%
*-commutative76.8%
Applied egg-rr76.8%
Final simplification76.8%
herbie shell --seed 2024021
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))