
(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 13 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}
c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x c_m s_m) :precision binary64 (if (<= (pow s_m 2.0) 1e+120) (/ (cos (* x -2.0)) (pow (* c_m (* s_m x)) 2.0)) (* (/ -1.0 (* x (- (* s_m c_m)))) (/ (/ (cos (* 2.0 x)) x) (* s_m c_m)))))
c_m = fabs(c);
s_m = fabs(s);
assert(x < c_m && c_m < s_m);
double code(double x, double c_m, double s_m) {
double tmp;
if (pow(s_m, 2.0) <= 1e+120) {
tmp = cos((x * -2.0)) / pow((c_m * (s_m * x)), 2.0);
} else {
tmp = (-1.0 / (x * -(s_m * c_m))) * ((cos((2.0 * x)) / x) / (s_m * c_m));
}
return tmp;
}
c_m = abs(c)
s_m = abs(s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s_m)
real(8), intent (in) :: x
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
real(8) :: tmp
if ((s_m ** 2.0d0) <= 1d+120) then
tmp = cos((x * (-2.0d0))) / ((c_m * (s_m * x)) ** 2.0d0)
else
tmp = ((-1.0d0) / (x * -(s_m * c_m))) * ((cos((2.0d0 * x)) / x) / (s_m * c_m))
end if
code = tmp
end function
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x < c_m && c_m < s_m;
public static double code(double x, double c_m, double s_m) {
double tmp;
if (Math.pow(s_m, 2.0) <= 1e+120) {
tmp = Math.cos((x * -2.0)) / Math.pow((c_m * (s_m * x)), 2.0);
} else {
tmp = (-1.0 / (x * -(s_m * c_m))) * ((Math.cos((2.0 * x)) / x) / (s_m * c_m));
}
return tmp;
}
c_m = math.fabs(c) s_m = math.fabs(s) [x, c_m, s_m] = sort([x, c_m, s_m]) def code(x, c_m, s_m): tmp = 0 if math.pow(s_m, 2.0) <= 1e+120: tmp = math.cos((x * -2.0)) / math.pow((c_m * (s_m * x)), 2.0) else: tmp = (-1.0 / (x * -(s_m * c_m))) * ((math.cos((2.0 * x)) / x) / (s_m * c_m)) return tmp
c_m = abs(c) s_m = abs(s) x, c_m, s_m = sort([x, c_m, s_m]) function code(x, c_m, s_m) tmp = 0.0 if ((s_m ^ 2.0) <= 1e+120) tmp = Float64(cos(Float64(x * -2.0)) / (Float64(c_m * Float64(s_m * x)) ^ 2.0)); else tmp = Float64(Float64(-1.0 / Float64(x * Float64(-Float64(s_m * c_m)))) * Float64(Float64(cos(Float64(2.0 * x)) / x) / Float64(s_m * c_m))); end return tmp end
c_m = abs(c);
s_m = abs(s);
x, c_m, s_m = num2cell(sort([x, c_m, s_m])){:}
function tmp_2 = code(x, c_m, s_m)
tmp = 0.0;
if ((s_m ^ 2.0) <= 1e+120)
tmp = cos((x * -2.0)) / ((c_m * (s_m * x)) ^ 2.0);
else
tmp = (-1.0 / (x * -(s_m * c_m))) * ((cos((2.0 * x)) / x) / (s_m * c_m));
end
tmp_2 = tmp;
end
c_m = N[Abs[c], $MachinePrecision] s_m = N[Abs[s], $MachinePrecision] NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. code[x_, c$95$m_, s$95$m_] := If[LessEqual[N[Power[s$95$m, 2.0], $MachinePrecision], 1e+120], N[(N[Cos[N[(x * -2.0), $MachinePrecision]], $MachinePrecision] / N[Power[N[(c$95$m * N[(s$95$m * x), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 / N[(x * (-N[(s$95$m * c$95$m), $MachinePrecision])), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision] / N[(s$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x, c_m, s_m] = \mathsf{sort}([x, c_m, s_m])\\
\\
\begin{array}{l}
\mathbf{if}\;{s_m}^{2} \leq 10^{+120}:\\
\;\;\;\;\frac{\cos \left(x \cdot -2\right)}{{\left(c_m \cdot \left(s_m \cdot x\right)\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{x \cdot \left(-s_m \cdot c_m\right)} \cdot \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{s_m \cdot c_m}\\
\end{array}
\end{array}
if (pow.f64 s 2) < 9.9999999999999998e119Initial program 68.2%
associate-/r*68.3%
unpow268.3%
sqr-neg68.3%
unpow268.3%
associate-/r*68.2%
cos-neg68.2%
*-commutative68.2%
distribute-rgt-neg-in68.2%
metadata-eval68.2%
associate-*r*70.3%
*-commutative70.3%
unpow270.3%
sqr-neg70.3%
associate-*l*75.3%
associate-*r*77.1%
associate-*r*74.7%
associate-*r*68.5%
unpow268.5%
Simplified62.0%
Taylor expanded in x around inf 62.0%
associate-/r*62.0%
*-commutative62.0%
unpow262.0%
unpow262.0%
swap-sqr78.1%
unpow278.1%
associate-/r*77.8%
*-commutative77.8%
unpow277.8%
unpow277.8%
swap-sqr98.3%
unpow298.3%
*-commutative98.3%
Simplified98.3%
if 9.9999999999999998e119 < (pow.f64 s 2) Initial program 60.9%
*-un-lft-identity60.9%
add-sqr-sqrt60.9%
times-frac60.9%
Applied egg-rr94.5%
frac-2neg94.5%
metadata-eval94.5%
div-inv94.5%
*-commutative94.5%
distribute-rgt-neg-in94.5%
Applied egg-rr94.5%
associate-*r/94.5%
metadata-eval94.5%
associate-*l*93.2%
Simplified93.2%
*-un-lft-identity93.2%
*-commutative93.2%
associate-*r*98.3%
times-frac98.3%
*-commutative98.3%
Applied egg-rr98.3%
associate-*l/98.3%
*-lft-identity98.3%
Simplified98.3%
Final simplification98.3%
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x c_m s_m)
:precision binary64
(let* ((t_0 (cos (* 2.0 x))))
(if (<= (pow s_m 2.0) 1e+76)
(/ 1.0 (* (* c_m (* s_m x)) (/ c_m (/ t_0 (* s_m x)))))
(* (/ -1.0 (* x (- (* s_m c_m)))) (/ (/ t_0 s_m) (* x c_m))))))c_m = fabs(c);
s_m = fabs(s);
assert(x < c_m && c_m < s_m);
double code(double x, double c_m, double s_m) {
double t_0 = cos((2.0 * x));
double tmp;
if (pow(s_m, 2.0) <= 1e+76) {
tmp = 1.0 / ((c_m * (s_m * x)) * (c_m / (t_0 / (s_m * x))));
} else {
tmp = (-1.0 / (x * -(s_m * c_m))) * ((t_0 / s_m) / (x * c_m));
}
return tmp;
}
c_m = abs(c)
s_m = abs(s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s_m)
real(8), intent (in) :: x
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
real(8) :: t_0
real(8) :: tmp
t_0 = cos((2.0d0 * x))
if ((s_m ** 2.0d0) <= 1d+76) then
tmp = 1.0d0 / ((c_m * (s_m * x)) * (c_m / (t_0 / (s_m * x))))
else
tmp = ((-1.0d0) / (x * -(s_m * c_m))) * ((t_0 / s_m) / (x * c_m))
end if
code = tmp
end function
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x < c_m && c_m < s_m;
public static double code(double x, double c_m, double s_m) {
double t_0 = Math.cos((2.0 * x));
double tmp;
if (Math.pow(s_m, 2.0) <= 1e+76) {
tmp = 1.0 / ((c_m * (s_m * x)) * (c_m / (t_0 / (s_m * x))));
} else {
tmp = (-1.0 / (x * -(s_m * c_m))) * ((t_0 / s_m) / (x * c_m));
}
return tmp;
}
c_m = math.fabs(c) s_m = math.fabs(s) [x, c_m, s_m] = sort([x, c_m, s_m]) def code(x, c_m, s_m): t_0 = math.cos((2.0 * x)) tmp = 0 if math.pow(s_m, 2.0) <= 1e+76: tmp = 1.0 / ((c_m * (s_m * x)) * (c_m / (t_0 / (s_m * x)))) else: tmp = (-1.0 / (x * -(s_m * c_m))) * ((t_0 / s_m) / (x * c_m)) return tmp
c_m = abs(c) s_m = abs(s) x, c_m, s_m = sort([x, c_m, s_m]) function code(x, c_m, s_m) t_0 = cos(Float64(2.0 * x)) tmp = 0.0 if ((s_m ^ 2.0) <= 1e+76) tmp = Float64(1.0 / Float64(Float64(c_m * Float64(s_m * x)) * Float64(c_m / Float64(t_0 / Float64(s_m * x))))); else tmp = Float64(Float64(-1.0 / Float64(x * Float64(-Float64(s_m * c_m)))) * Float64(Float64(t_0 / s_m) / Float64(x * c_m))); end return tmp end
c_m = abs(c);
s_m = abs(s);
x, c_m, s_m = num2cell(sort([x, c_m, s_m])){:}
function tmp_2 = code(x, c_m, s_m)
t_0 = cos((2.0 * x));
tmp = 0.0;
if ((s_m ^ 2.0) <= 1e+76)
tmp = 1.0 / ((c_m * (s_m * x)) * (c_m / (t_0 / (s_m * x))));
else
tmp = (-1.0 / (x * -(s_m * c_m))) * ((t_0 / s_m) / (x * c_m));
end
tmp_2 = tmp;
end
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
code[x_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Power[s$95$m, 2.0], $MachinePrecision], 1e+76], N[(1.0 / N[(N[(c$95$m * N[(s$95$m * x), $MachinePrecision]), $MachinePrecision] * N[(c$95$m / N[(t$95$0 / N[(s$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 / N[(x * (-N[(s$95$m * c$95$m), $MachinePrecision])), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 / s$95$m), $MachinePrecision] / N[(x * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x, c_m, s_m] = \mathsf{sort}([x, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := \cos \left(2 \cdot x\right)\\
\mathbf{if}\;{s_m}^{2} \leq 10^{+76}:\\
\;\;\;\;\frac{1}{\left(c_m \cdot \left(s_m \cdot x\right)\right) \cdot \frac{c_m}{\frac{t_0}{s_m \cdot x}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{x \cdot \left(-s_m \cdot c_m\right)} \cdot \frac{\frac{t_0}{s_m}}{x \cdot c_m}\\
\end{array}
\end{array}
if (pow.f64 s 2) < 1e76Initial program 67.6%
*-un-lft-identity67.6%
add-sqr-sqrt67.6%
times-frac67.5%
Applied egg-rr98.4%
*-commutative98.4%
clear-num98.5%
frac-times98.2%
metadata-eval98.2%
associate-/l*98.0%
*-commutative98.0%
Applied egg-rr98.0%
if 1e76 < (pow.f64 s 2) Initial program 62.1%
*-un-lft-identity62.1%
add-sqr-sqrt62.1%
times-frac62.0%
Applied egg-rr94.7%
frac-2neg94.7%
metadata-eval94.7%
div-inv94.7%
*-commutative94.7%
distribute-rgt-neg-in94.7%
Applied egg-rr94.7%
associate-*r/94.7%
metadata-eval94.7%
associate-*l*93.5%
Simplified93.5%
*-un-lft-identity93.5%
associate-*r*96.7%
times-frac96.7%
*-commutative96.7%
Applied egg-rr96.7%
associate-*l/96.8%
*-lft-identity96.8%
Simplified96.8%
Final simplification97.5%
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x c_m s_m)
:precision binary64
(let* ((t_0 (cos (* 2.0 x))) (t_1 (* c_m (* s_m x))))
(if (<= (pow s_m 2.0) 1e+120)
(/ (/ t_0 t_1) t_1)
(* (/ -1.0 (* x (- (* s_m c_m)))) (/ (/ t_0 x) (* s_m c_m))))))c_m = fabs(c);
s_m = fabs(s);
assert(x < c_m && c_m < s_m);
double code(double x, double c_m, double s_m) {
double t_0 = cos((2.0 * x));
double t_1 = c_m * (s_m * x);
double tmp;
if (pow(s_m, 2.0) <= 1e+120) {
tmp = (t_0 / t_1) / t_1;
} else {
tmp = (-1.0 / (x * -(s_m * c_m))) * ((t_0 / x) / (s_m * c_m));
}
return tmp;
}
c_m = abs(c)
s_m = abs(s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s_m)
real(8), intent (in) :: x
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((2.0d0 * x))
t_1 = c_m * (s_m * x)
if ((s_m ** 2.0d0) <= 1d+120) then
tmp = (t_0 / t_1) / t_1
else
tmp = ((-1.0d0) / (x * -(s_m * c_m))) * ((t_0 / x) / (s_m * c_m))
end if
code = tmp
end function
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x < c_m && c_m < s_m;
public static double code(double x, double c_m, double s_m) {
double t_0 = Math.cos((2.0 * x));
double t_1 = c_m * (s_m * x);
double tmp;
if (Math.pow(s_m, 2.0) <= 1e+120) {
tmp = (t_0 / t_1) / t_1;
} else {
tmp = (-1.0 / (x * -(s_m * c_m))) * ((t_0 / x) / (s_m * c_m));
}
return tmp;
}
c_m = math.fabs(c) s_m = math.fabs(s) [x, c_m, s_m] = sort([x, c_m, s_m]) def code(x, c_m, s_m): t_0 = math.cos((2.0 * x)) t_1 = c_m * (s_m * x) tmp = 0 if math.pow(s_m, 2.0) <= 1e+120: tmp = (t_0 / t_1) / t_1 else: tmp = (-1.0 / (x * -(s_m * c_m))) * ((t_0 / x) / (s_m * c_m)) return tmp
c_m = abs(c) s_m = abs(s) x, c_m, s_m = sort([x, c_m, s_m]) function code(x, c_m, s_m) t_0 = cos(Float64(2.0 * x)) t_1 = Float64(c_m * Float64(s_m * x)) tmp = 0.0 if ((s_m ^ 2.0) <= 1e+120) tmp = Float64(Float64(t_0 / t_1) / t_1); else tmp = Float64(Float64(-1.0 / Float64(x * Float64(-Float64(s_m * c_m)))) * Float64(Float64(t_0 / x) / Float64(s_m * c_m))); end return tmp end
c_m = abs(c);
s_m = abs(s);
x, c_m, s_m = num2cell(sort([x, c_m, s_m])){:}
function tmp_2 = code(x, c_m, s_m)
t_0 = cos((2.0 * x));
t_1 = c_m * (s_m * x);
tmp = 0.0;
if ((s_m ^ 2.0) <= 1e+120)
tmp = (t_0 / t_1) / t_1;
else
tmp = (-1.0 / (x * -(s_m * c_m))) * ((t_0 / x) / (s_m * c_m));
end
tmp_2 = tmp;
end
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
code[x_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(c$95$m * N[(s$95$m * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[s$95$m, 2.0], $MachinePrecision], 1e+120], N[(N[(t$95$0 / t$95$1), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(-1.0 / N[(x * (-N[(s$95$m * c$95$m), $MachinePrecision])), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 / x), $MachinePrecision] / N[(s$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x, c_m, s_m] = \mathsf{sort}([x, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := \cos \left(2 \cdot x\right)\\
t_1 := c_m \cdot \left(s_m \cdot x\right)\\
\mathbf{if}\;{s_m}^{2} \leq 10^{+120}:\\
\;\;\;\;\frac{\frac{t_0}{t_1}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{x \cdot \left(-s_m \cdot c_m\right)} \cdot \frac{\frac{t_0}{x}}{s_m \cdot c_m}\\
\end{array}
\end{array}
if (pow.f64 s 2) < 9.9999999999999998e119Initial program 68.2%
*-un-lft-identity68.2%
add-sqr-sqrt68.2%
times-frac68.2%
Applied egg-rr98.4%
*-commutative98.4%
associate-*l/98.5%
div-inv98.6%
*-commutative98.6%
Applied egg-rr98.6%
if 9.9999999999999998e119 < (pow.f64 s 2) Initial program 60.9%
*-un-lft-identity60.9%
add-sqr-sqrt60.9%
times-frac60.9%
Applied egg-rr94.5%
frac-2neg94.5%
metadata-eval94.5%
div-inv94.5%
*-commutative94.5%
distribute-rgt-neg-in94.5%
Applied egg-rr94.5%
associate-*r/94.5%
metadata-eval94.5%
associate-*l*93.2%
Simplified93.2%
*-un-lft-identity93.2%
*-commutative93.2%
associate-*r*98.3%
times-frac98.3%
*-commutative98.3%
Applied egg-rr98.3%
associate-*l/98.3%
*-lft-identity98.3%
Simplified98.3%
Final simplification98.5%
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x c_m s_m)
:precision binary64
(let* ((t_0 (* c_m (* s_m x))) (t_1 (cos (* 2.0 x))))
(if (<= c_m 8e-198)
(/ (/ t_1 c_m) (* (* s_m x) t_0))
(/ (/ t_1 (* c_m t_0)) (* s_m x)))))c_m = fabs(c);
s_m = fabs(s);
assert(x < c_m && c_m < s_m);
double code(double x, double c_m, double s_m) {
double t_0 = c_m * (s_m * x);
double t_1 = cos((2.0 * x));
double tmp;
if (c_m <= 8e-198) {
tmp = (t_1 / c_m) / ((s_m * x) * t_0);
} else {
tmp = (t_1 / (c_m * t_0)) / (s_m * x);
}
return tmp;
}
c_m = abs(c)
s_m = abs(s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s_m)
real(8), intent (in) :: x
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 = c_m * (s_m * x)
t_1 = cos((2.0d0 * x))
if (c_m <= 8d-198) then
tmp = (t_1 / c_m) / ((s_m * x) * t_0)
else
tmp = (t_1 / (c_m * t_0)) / (s_m * x)
end if
code = tmp
end function
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x < c_m && c_m < s_m;
public static double code(double x, double c_m, double s_m) {
double t_0 = c_m * (s_m * x);
double t_1 = Math.cos((2.0 * x));
double tmp;
if (c_m <= 8e-198) {
tmp = (t_1 / c_m) / ((s_m * x) * t_0);
} else {
tmp = (t_1 / (c_m * t_0)) / (s_m * x);
}
return tmp;
}
c_m = math.fabs(c) s_m = math.fabs(s) [x, c_m, s_m] = sort([x, c_m, s_m]) def code(x, c_m, s_m): t_0 = c_m * (s_m * x) t_1 = math.cos((2.0 * x)) tmp = 0 if c_m <= 8e-198: tmp = (t_1 / c_m) / ((s_m * x) * t_0) else: tmp = (t_1 / (c_m * t_0)) / (s_m * x) return tmp
c_m = abs(c) s_m = abs(s) x, c_m, s_m = sort([x, c_m, s_m]) function code(x, c_m, s_m) t_0 = Float64(c_m * Float64(s_m * x)) t_1 = cos(Float64(2.0 * x)) tmp = 0.0 if (c_m <= 8e-198) tmp = Float64(Float64(t_1 / c_m) / Float64(Float64(s_m * x) * t_0)); else tmp = Float64(Float64(t_1 / Float64(c_m * t_0)) / Float64(s_m * x)); end return tmp end
c_m = abs(c);
s_m = abs(s);
x, c_m, s_m = num2cell(sort([x, c_m, s_m])){:}
function tmp_2 = code(x, c_m, s_m)
t_0 = c_m * (s_m * x);
t_1 = cos((2.0 * x));
tmp = 0.0;
if (c_m <= 8e-198)
tmp = (t_1 / c_m) / ((s_m * x) * t_0);
else
tmp = (t_1 / (c_m * t_0)) / (s_m * x);
end
tmp_2 = tmp;
end
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
code[x_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[(c$95$m * N[(s$95$m * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[c$95$m, 8e-198], N[(N[(t$95$1 / c$95$m), $MachinePrecision] / N[(N[(s$95$m * x), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / N[(c$95$m * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(s$95$m * x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x, c_m, s_m] = \mathsf{sort}([x, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := c_m \cdot \left(s_m \cdot x\right)\\
t_1 := \cos \left(2 \cdot x\right)\\
\mathbf{if}\;c_m \leq 8 \cdot 10^{-198}:\\
\;\;\;\;\frac{\frac{t_1}{c_m}}{\left(s_m \cdot x\right) \cdot t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_1}{c_m \cdot t_0}}{s_m \cdot x}\\
\end{array}
\end{array}
if c < 7.9999999999999993e-198Initial program 60.7%
*-un-lft-identity60.7%
add-sqr-sqrt60.6%
times-frac60.6%
Applied egg-rr95.4%
associate-*l/95.5%
*-un-lft-identity95.5%
associate-/r*95.5%
associate-/l/94.5%
*-commutative94.5%
Applied egg-rr94.5%
if 7.9999999999999993e-198 < c Initial program 72.1%
add-cube-cbrt72.0%
pow372.0%
*-commutative72.0%
associate-*r*64.5%
unpow264.5%
*-commutative64.5%
pow-prod-down81.9%
pow-prod-down97.6%
*-commutative97.6%
Applied egg-rr97.6%
/-rgt-identity97.6%
associate-*r*95.4%
associate-/l*95.4%
Applied egg-rr95.4%
rem-cube-cbrt95.9%
*-commutative95.9%
associate-/r/95.9%
unpow-prod-down80.8%
/-rgt-identity80.8%
unpow-prod-down95.9%
associate-*r*98.1%
pow298.1%
*-commutative98.1%
associate-*r*95.8%
associate-/l/96.7%
associate-/r*97.9%
*-commutative97.9%
associate-*r*94.7%
*-commutative94.7%
associate-*l*96.1%
Applied egg-rr96.1%
expm1-log1p-u80.7%
expm1-udef61.7%
Applied egg-rr62.5%
expm1-def78.9%
expm1-log1p94.4%
*-commutative94.4%
associate-*r*97.7%
*-commutative97.7%
Simplified97.7%
Final simplification95.7%
c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x c_m s_m) :precision binary64 (/ (/ (cos (* 2.0 x)) c_m) (* s_m (* x (* c_m (* s_m x))))))
c_m = fabs(c);
s_m = fabs(s);
assert(x < c_m && c_m < s_m);
double code(double x, double c_m, double s_m) {
return (cos((2.0 * x)) / c_m) / (s_m * (x * (c_m * (s_m * x))));
}
c_m = abs(c)
s_m = abs(s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s_m)
real(8), intent (in) :: x
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
code = (cos((2.0d0 * x)) / c_m) / (s_m * (x * (c_m * (s_m * x))))
end function
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x < c_m && c_m < s_m;
public static double code(double x, double c_m, double s_m) {
return (Math.cos((2.0 * x)) / c_m) / (s_m * (x * (c_m * (s_m * x))));
}
c_m = math.fabs(c) s_m = math.fabs(s) [x, c_m, s_m] = sort([x, c_m, s_m]) def code(x, c_m, s_m): return (math.cos((2.0 * x)) / c_m) / (s_m * (x * (c_m * (s_m * x))))
c_m = abs(c) s_m = abs(s) x, c_m, s_m = sort([x, c_m, s_m]) function code(x, c_m, s_m) return Float64(Float64(cos(Float64(2.0 * x)) / c_m) / Float64(s_m * Float64(x * Float64(c_m * Float64(s_m * x))))) end
c_m = abs(c);
s_m = abs(s);
x, c_m, s_m = num2cell(sort([x, c_m, s_m])){:}
function tmp = code(x, c_m, s_m)
tmp = (cos((2.0 * x)) / c_m) / (s_m * (x * (c_m * (s_m * x))));
end
c_m = N[Abs[c], $MachinePrecision] s_m = N[Abs[s], $MachinePrecision] NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. code[x_, c$95$m_, s$95$m_] := N[(N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / c$95$m), $MachinePrecision] / N[(s$95$m * N[(x * N[(c$95$m * N[(s$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x, c_m, s_m] = \mathsf{sort}([x, c_m, s_m])\\
\\
\frac{\frac{\cos \left(2 \cdot x\right)}{c_m}}{s_m \cdot \left(x \cdot \left(c_m \cdot \left(s_m \cdot x\right)\right)\right)}
\end{array}
Initial program 65.1%
*-un-lft-identity65.1%
add-sqr-sqrt65.1%
times-frac65.1%
Applied egg-rr96.8%
associate-*l/96.9%
*-un-lft-identity96.9%
associate-/r*96.9%
associate-/l/95.4%
*-commutative95.4%
Applied egg-rr95.4%
*-commutative95.4%
*-commutative95.4%
associate-*r*92.6%
add-exp-log45.8%
add-exp-log23.0%
prod-exp22.9%
associate-*r*23.0%
Applied egg-rr23.0%
exp-sum23.0%
rem-exp-log47.5%
rem-exp-log91.2%
associate-*l*92.6%
*-commutative92.6%
Simplified92.6%
Final simplification92.6%
c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x c_m s_m) :precision binary64 (/ (/ (cos (* 2.0 x)) c_m) (* (* s_m x) (* c_m (* s_m x)))))
c_m = fabs(c);
s_m = fabs(s);
assert(x < c_m && c_m < s_m);
double code(double x, double c_m, double s_m) {
return (cos((2.0 * x)) / c_m) / ((s_m * x) * (c_m * (s_m * x)));
}
c_m = abs(c)
s_m = abs(s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s_m)
real(8), intent (in) :: x
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
code = (cos((2.0d0 * x)) / c_m) / ((s_m * x) * (c_m * (s_m * x)))
end function
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x < c_m && c_m < s_m;
public static double code(double x, double c_m, double s_m) {
return (Math.cos((2.0 * x)) / c_m) / ((s_m * x) * (c_m * (s_m * x)));
}
c_m = math.fabs(c) s_m = math.fabs(s) [x, c_m, s_m] = sort([x, c_m, s_m]) def code(x, c_m, s_m): return (math.cos((2.0 * x)) / c_m) / ((s_m * x) * (c_m * (s_m * x)))
c_m = abs(c) s_m = abs(s) x, c_m, s_m = sort([x, c_m, s_m]) function code(x, c_m, s_m) return Float64(Float64(cos(Float64(2.0 * x)) / c_m) / Float64(Float64(s_m * x) * Float64(c_m * Float64(s_m * x)))) end
c_m = abs(c);
s_m = abs(s);
x, c_m, s_m = num2cell(sort([x, c_m, s_m])){:}
function tmp = code(x, c_m, s_m)
tmp = (cos((2.0 * x)) / c_m) / ((s_m * x) * (c_m * (s_m * x)));
end
c_m = N[Abs[c], $MachinePrecision] s_m = N[Abs[s], $MachinePrecision] NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. code[x_, c$95$m_, s$95$m_] := N[(N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / c$95$m), $MachinePrecision] / N[(N[(s$95$m * x), $MachinePrecision] * N[(c$95$m * N[(s$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x, c_m, s_m] = \mathsf{sort}([x, c_m, s_m])\\
\\
\frac{\frac{\cos \left(2 \cdot x\right)}{c_m}}{\left(s_m \cdot x\right) \cdot \left(c_m \cdot \left(s_m \cdot x\right)\right)}
\end{array}
Initial program 65.1%
*-un-lft-identity65.1%
add-sqr-sqrt65.1%
times-frac65.1%
Applied egg-rr96.8%
associate-*l/96.9%
*-un-lft-identity96.9%
associate-/r*96.9%
associate-/l/95.4%
*-commutative95.4%
Applied egg-rr95.4%
Final simplification95.4%
c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x c_m s_m) :precision binary64 (let* ((t_0 (* c_m (* s_m x)))) (/ (/ (cos (* 2.0 x)) t_0) t_0)))
c_m = fabs(c);
s_m = fabs(s);
assert(x < c_m && c_m < s_m);
double code(double x, double c_m, double s_m) {
double t_0 = c_m * (s_m * x);
return (cos((2.0 * x)) / t_0) / t_0;
}
c_m = abs(c)
s_m = abs(s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s_m)
real(8), intent (in) :: x
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
real(8) :: t_0
t_0 = c_m * (s_m * x)
code = (cos((2.0d0 * x)) / t_0) / t_0
end function
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x < c_m && c_m < s_m;
public static double code(double x, double c_m, double s_m) {
double t_0 = c_m * (s_m * x);
return (Math.cos((2.0 * x)) / t_0) / t_0;
}
c_m = math.fabs(c) s_m = math.fabs(s) [x, c_m, s_m] = sort([x, c_m, s_m]) def code(x, c_m, s_m): t_0 = c_m * (s_m * x) return (math.cos((2.0 * x)) / t_0) / t_0
c_m = abs(c) s_m = abs(s) x, c_m, s_m = sort([x, c_m, s_m]) function code(x, c_m, s_m) t_0 = Float64(c_m * Float64(s_m * x)) return Float64(Float64(cos(Float64(2.0 * x)) / t_0) / t_0) end
c_m = abs(c);
s_m = abs(s);
x, c_m, s_m = num2cell(sort([x, c_m, s_m])){:}
function tmp = code(x, c_m, s_m)
t_0 = c_m * (s_m * x);
tmp = (cos((2.0 * x)) / t_0) / t_0;
end
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
code[x_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[(c$95$m * N[(s$95$m * x), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x, c_m, s_m] = \mathsf{sort}([x, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := c_m \cdot \left(s_m \cdot x\right)\\
\frac{\frac{\cos \left(2 \cdot x\right)}{t_0}}{t_0}
\end{array}
\end{array}
Initial program 65.1%
*-un-lft-identity65.1%
add-sqr-sqrt65.1%
times-frac65.1%
Applied egg-rr96.8%
*-commutative96.8%
associate-*l/96.8%
div-inv96.9%
*-commutative96.9%
Applied egg-rr96.9%
Final simplification96.9%
c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x c_m s_m) :precision binary64 (pow (/ c_m (/ (/ 1.0 x) s_m)) -2.0))
c_m = fabs(c);
s_m = fabs(s);
assert(x < c_m && c_m < s_m);
double code(double x, double c_m, double s_m) {
return pow((c_m / ((1.0 / x) / s_m)), -2.0);
}
c_m = abs(c)
s_m = abs(s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s_m)
real(8), intent (in) :: x
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
code = (c_m / ((1.0d0 / x) / s_m)) ** (-2.0d0)
end function
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x < c_m && c_m < s_m;
public static double code(double x, double c_m, double s_m) {
return Math.pow((c_m / ((1.0 / x) / s_m)), -2.0);
}
c_m = math.fabs(c) s_m = math.fabs(s) [x, c_m, s_m] = sort([x, c_m, s_m]) def code(x, c_m, s_m): return math.pow((c_m / ((1.0 / x) / s_m)), -2.0)
c_m = abs(c) s_m = abs(s) x, c_m, s_m = sort([x, c_m, s_m]) function code(x, c_m, s_m) return Float64(c_m / Float64(Float64(1.0 / x) / s_m)) ^ -2.0 end
c_m = abs(c);
s_m = abs(s);
x, c_m, s_m = num2cell(sort([x, c_m, s_m])){:}
function tmp = code(x, c_m, s_m)
tmp = (c_m / ((1.0 / x) / s_m)) ^ -2.0;
end
c_m = N[Abs[c], $MachinePrecision] s_m = N[Abs[s], $MachinePrecision] NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. code[x_, c$95$m_, s$95$m_] := N[Power[N[(c$95$m / N[(N[(1.0 / x), $MachinePrecision] / s$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]
\begin{array}{l}
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x, c_m, s_m] = \mathsf{sort}([x, c_m, s_m])\\
\\
{\left(\frac{c_m}{\frac{\frac{1}{x}}{s_m}}\right)}^{-2}
\end{array}
Initial program 65.1%
Taylor expanded in x around 0 51.5%
associate-/r*51.3%
*-commutative51.3%
unpow251.3%
unpow251.3%
swap-sqr63.6%
unpow263.6%
associate-/r*63.8%
unpow263.8%
unpow263.8%
swap-sqr76.2%
unpow276.2%
*-commutative76.2%
Simplified76.2%
pow-flip76.4%
*-commutative76.4%
metadata-eval76.4%
Applied egg-rr76.4%
/-rgt-identity76.4%
associate-/l*76.3%
Applied egg-rr76.3%
Taylor expanded in x around 0 76.3%
*-commutative76.3%
associate-/r*76.2%
Simplified76.2%
Final simplification76.2%
c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x c_m s_m) :precision binary64 (* (/ 1.0 (* c_m (* s_m x))) (/ (/ 1.0 (* s_m x)) c_m)))
c_m = fabs(c);
s_m = fabs(s);
assert(x < c_m && c_m < s_m);
double code(double x, double c_m, double s_m) {
return (1.0 / (c_m * (s_m * x))) * ((1.0 / (s_m * x)) / c_m);
}
c_m = abs(c)
s_m = abs(s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s_m)
real(8), intent (in) :: x
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
code = (1.0d0 / (c_m * (s_m * x))) * ((1.0d0 / (s_m * x)) / c_m)
end function
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x < c_m && c_m < s_m;
public static double code(double x, double c_m, double s_m) {
return (1.0 / (c_m * (s_m * x))) * ((1.0 / (s_m * x)) / c_m);
}
c_m = math.fabs(c) s_m = math.fabs(s) [x, c_m, s_m] = sort([x, c_m, s_m]) def code(x, c_m, s_m): return (1.0 / (c_m * (s_m * x))) * ((1.0 / (s_m * x)) / c_m)
c_m = abs(c) s_m = abs(s) x, c_m, s_m = sort([x, c_m, s_m]) function code(x, c_m, s_m) return Float64(Float64(1.0 / Float64(c_m * Float64(s_m * x))) * Float64(Float64(1.0 / Float64(s_m * x)) / c_m)) end
c_m = abs(c);
s_m = abs(s);
x, c_m, s_m = num2cell(sort([x, c_m, s_m])){:}
function tmp = code(x, c_m, s_m)
tmp = (1.0 / (c_m * (s_m * x))) * ((1.0 / (s_m * x)) / c_m);
end
c_m = N[Abs[c], $MachinePrecision] s_m = N[Abs[s], $MachinePrecision] NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. code[x_, c$95$m_, s$95$m_] := N[(N[(1.0 / N[(c$95$m * N[(s$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[(s$95$m * x), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x, c_m, s_m] = \mathsf{sort}([x, c_m, s_m])\\
\\
\frac{1}{c_m \cdot \left(s_m \cdot x\right)} \cdot \frac{\frac{1}{s_m \cdot x}}{c_m}
\end{array}
Initial program 65.1%
*-un-lft-identity65.1%
add-sqr-sqrt65.1%
times-frac65.1%
Applied egg-rr96.8%
Taylor expanded in x around 0 76.4%
associate-/r*76.4%
*-commutative76.4%
*-rgt-identity76.4%
associate-*r/76.3%
associate-*l/76.3%
*-lft-identity76.3%
*-commutative76.3%
Simplified76.3%
Final simplification76.3%
c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x c_m s_m) :precision binary64 (/ 1.0 (* (* s_m c_m) (* x (* c_m (* s_m x))))))
c_m = fabs(c);
s_m = fabs(s);
assert(x < c_m && c_m < s_m);
double code(double x, double c_m, double s_m) {
return 1.0 / ((s_m * c_m) * (x * (c_m * (s_m * x))));
}
c_m = abs(c)
s_m = abs(s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s_m)
real(8), intent (in) :: x
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
code = 1.0d0 / ((s_m * c_m) * (x * (c_m * (s_m * x))))
end function
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x < c_m && c_m < s_m;
public static double code(double x, double c_m, double s_m) {
return 1.0 / ((s_m * c_m) * (x * (c_m * (s_m * x))));
}
c_m = math.fabs(c) s_m = math.fabs(s) [x, c_m, s_m] = sort([x, c_m, s_m]) def code(x, c_m, s_m): return 1.0 / ((s_m * c_m) * (x * (c_m * (s_m * x))))
c_m = abs(c) s_m = abs(s) x, c_m, s_m = sort([x, c_m, s_m]) function code(x, c_m, s_m) return Float64(1.0 / Float64(Float64(s_m * c_m) * Float64(x * Float64(c_m * Float64(s_m * x))))) end
c_m = abs(c);
s_m = abs(s);
x, c_m, s_m = num2cell(sort([x, c_m, s_m])){:}
function tmp = code(x, c_m, s_m)
tmp = 1.0 / ((s_m * c_m) * (x * (c_m * (s_m * x))));
end
c_m = N[Abs[c], $MachinePrecision] s_m = N[Abs[s], $MachinePrecision] NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. code[x_, c$95$m_, s$95$m_] := N[(1.0 / N[(N[(s$95$m * c$95$m), $MachinePrecision] * N[(x * N[(c$95$m * N[(s$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x, c_m, s_m] = \mathsf{sort}([x, c_m, s_m])\\
\\
\frac{1}{\left(s_m \cdot c_m\right) \cdot \left(x \cdot \left(c_m \cdot \left(s_m \cdot x\right)\right)\right)}
\end{array}
Initial program 65.1%
Taylor expanded in x around 0 51.5%
associate-/r*51.3%
*-commutative51.3%
unpow251.3%
unpow251.3%
swap-sqr63.6%
unpow263.6%
associate-/r*63.8%
unpow263.8%
unpow263.8%
swap-sqr76.2%
unpow276.2%
*-commutative76.2%
Simplified76.2%
unpow276.2%
associate-*r*75.7%
*-commutative75.7%
associate-*l*74.8%
Applied egg-rr74.8%
Final simplification74.8%
c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x c_m s_m) :precision binary64 (/ 1.0 (* (* s_m c_m) (* x (* x (* s_m c_m))))))
c_m = fabs(c);
s_m = fabs(s);
assert(x < c_m && c_m < s_m);
double code(double x, double c_m, double s_m) {
return 1.0 / ((s_m * c_m) * (x * (x * (s_m * c_m))));
}
c_m = abs(c)
s_m = abs(s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s_m)
real(8), intent (in) :: x
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
code = 1.0d0 / ((s_m * c_m) * (x * (x * (s_m * c_m))))
end function
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x < c_m && c_m < s_m;
public static double code(double x, double c_m, double s_m) {
return 1.0 / ((s_m * c_m) * (x * (x * (s_m * c_m))));
}
c_m = math.fabs(c) s_m = math.fabs(s) [x, c_m, s_m] = sort([x, c_m, s_m]) def code(x, c_m, s_m): return 1.0 / ((s_m * c_m) * (x * (x * (s_m * c_m))))
c_m = abs(c) s_m = abs(s) x, c_m, s_m = sort([x, c_m, s_m]) function code(x, c_m, s_m) return Float64(1.0 / Float64(Float64(s_m * c_m) * Float64(x * Float64(x * Float64(s_m * c_m))))) end
c_m = abs(c);
s_m = abs(s);
x, c_m, s_m = num2cell(sort([x, c_m, s_m])){:}
function tmp = code(x, c_m, s_m)
tmp = 1.0 / ((s_m * c_m) * (x * (x * (s_m * c_m))));
end
c_m = N[Abs[c], $MachinePrecision] s_m = N[Abs[s], $MachinePrecision] NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. code[x_, c$95$m_, s$95$m_] := N[(1.0 / N[(N[(s$95$m * c$95$m), $MachinePrecision] * N[(x * N[(x * N[(s$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x, c_m, s_m] = \mathsf{sort}([x, c_m, s_m])\\
\\
\frac{1}{\left(s_m \cdot c_m\right) \cdot \left(x \cdot \left(x \cdot \left(s_m \cdot c_m\right)\right)\right)}
\end{array}
Initial program 65.1%
Taylor expanded in x around 0 51.5%
associate-/r*51.3%
*-commutative51.3%
unpow251.3%
unpow251.3%
swap-sqr63.6%
unpow263.6%
associate-/r*63.8%
unpow263.8%
unpow263.8%
swap-sqr76.2%
unpow276.2%
*-commutative76.2%
Simplified76.2%
unpow276.2%
associate-*r*75.7%
*-commutative75.7%
associate-*l*74.8%
Applied egg-rr74.8%
/-rgt-identity74.8%
*-commutative74.8%
associate-*r*75.5%
associate-/l*75.5%
Applied egg-rr75.5%
div-inv75.5%
inv-pow75.5%
pow-flip75.5%
metadata-eval75.5%
pow175.5%
Applied egg-rr75.5%
Final simplification75.5%
c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x c_m s_m) :precision binary64 (let* ((t_0 (* c_m (* s_m x)))) (/ 1.0 (* t_0 t_0))))
c_m = fabs(c);
s_m = fabs(s);
assert(x < c_m && c_m < s_m);
double code(double x, double c_m, double s_m) {
double t_0 = c_m * (s_m * x);
return 1.0 / (t_0 * t_0);
}
c_m = abs(c)
s_m = abs(s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s_m)
real(8), intent (in) :: x
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
real(8) :: t_0
t_0 = c_m * (s_m * x)
code = 1.0d0 / (t_0 * t_0)
end function
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x < c_m && c_m < s_m;
public static double code(double x, double c_m, double s_m) {
double t_0 = c_m * (s_m * x);
return 1.0 / (t_0 * t_0);
}
c_m = math.fabs(c) s_m = math.fabs(s) [x, c_m, s_m] = sort([x, c_m, s_m]) def code(x, c_m, s_m): t_0 = c_m * (s_m * x) return 1.0 / (t_0 * t_0)
c_m = abs(c) s_m = abs(s) x, c_m, s_m = sort([x, c_m, s_m]) function code(x, c_m, s_m) t_0 = Float64(c_m * Float64(s_m * x)) return Float64(1.0 / Float64(t_0 * t_0)) end
c_m = abs(c);
s_m = abs(s);
x, c_m, s_m = num2cell(sort([x, c_m, s_m])){:}
function tmp = code(x, c_m, s_m)
t_0 = c_m * (s_m * x);
tmp = 1.0 / (t_0 * t_0);
end
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
code[x_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[(c$95$m * N[(s$95$m * x), $MachinePrecision]), $MachinePrecision]}, N[(1.0 / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x, c_m, s_m] = \mathsf{sort}([x, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := c_m \cdot \left(s_m \cdot x\right)\\
\frac{1}{t_0 \cdot t_0}
\end{array}
\end{array}
Initial program 65.1%
Taylor expanded in x around 0 51.5%
associate-/r*51.3%
*-commutative51.3%
unpow251.3%
unpow251.3%
swap-sqr63.6%
unpow263.6%
associate-/r*63.8%
unpow263.8%
unpow263.8%
swap-sqr76.2%
unpow276.2%
*-commutative76.2%
Simplified76.2%
*-commutative76.2%
*-commutative76.2%
*-commutative76.2%
unpow276.2%
Applied egg-rr76.2%
Final simplification76.2%
c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x c_m s_m) :precision binary64 (/ (/ 1.0 c_m) (* (* s_m x) (* c_m (* s_m x)))))
c_m = fabs(c);
s_m = fabs(s);
assert(x < c_m && c_m < s_m);
double code(double x, double c_m, double s_m) {
return (1.0 / c_m) / ((s_m * x) * (c_m * (s_m * x)));
}
c_m = abs(c)
s_m = abs(s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s_m)
real(8), intent (in) :: x
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
code = (1.0d0 / c_m) / ((s_m * x) * (c_m * (s_m * x)))
end function
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x < c_m && c_m < s_m;
public static double code(double x, double c_m, double s_m) {
return (1.0 / c_m) / ((s_m * x) * (c_m * (s_m * x)));
}
c_m = math.fabs(c) s_m = math.fabs(s) [x, c_m, s_m] = sort([x, c_m, s_m]) def code(x, c_m, s_m): return (1.0 / c_m) / ((s_m * x) * (c_m * (s_m * x)))
c_m = abs(c) s_m = abs(s) x, c_m, s_m = sort([x, c_m, s_m]) function code(x, c_m, s_m) return Float64(Float64(1.0 / c_m) / Float64(Float64(s_m * x) * Float64(c_m * Float64(s_m * x)))) end
c_m = abs(c);
s_m = abs(s);
x, c_m, s_m = num2cell(sort([x, c_m, s_m])){:}
function tmp = code(x, c_m, s_m)
tmp = (1.0 / c_m) / ((s_m * x) * (c_m * (s_m * x)));
end
c_m = N[Abs[c], $MachinePrecision] s_m = N[Abs[s], $MachinePrecision] NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. code[x_, c$95$m_, s$95$m_] := N[(N[(1.0 / c$95$m), $MachinePrecision] / N[(N[(s$95$m * x), $MachinePrecision] * N[(c$95$m * N[(s$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x, c_m, s_m] = \mathsf{sort}([x, c_m, s_m])\\
\\
\frac{\frac{1}{c_m}}{\left(s_m \cdot x\right) \cdot \left(c_m \cdot \left(s_m \cdot x\right)\right)}
\end{array}
Initial program 65.1%
*-un-lft-identity65.1%
add-sqr-sqrt65.1%
times-frac65.1%
Applied egg-rr96.8%
associate-*l/96.9%
*-un-lft-identity96.9%
associate-/r*96.9%
associate-/l/95.4%
*-commutative95.4%
Applied egg-rr95.4%
Taylor expanded in x around 0 76.0%
Final simplification76.0%
herbie shell --seed 2024010
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))