
(FPCore (x c s) :precision binary64 (/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))
double code(double x, double c, double s) {
return cos((2.0 * x)) / (pow(c, 2.0) * ((x * pow(s, 2.0)) * x));
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = cos((2.0d0 * x)) / ((c ** 2.0d0) * ((x * (s ** 2.0d0)) * x))
end function
public static double code(double x, double c, double s) {
return Math.cos((2.0 * x)) / (Math.pow(c, 2.0) * ((x * Math.pow(s, 2.0)) * x));
}
def code(x, c, s): return math.cos((2.0 * x)) / (math.pow(c, 2.0) * ((x * math.pow(s, 2.0)) * x))
function code(x, c, s) return Float64(cos(Float64(2.0 * x)) / Float64((c ^ 2.0) * Float64(Float64(x * (s ^ 2.0)) * x))) end
function tmp = code(x, c, s) tmp = cos((2.0 * x)) / ((c ^ 2.0) * ((x * (s ^ 2.0)) * x)); end
code[x_, c_, s_] := N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[Power[c, 2.0], $MachinePrecision] * N[(N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x c s) :precision binary64 (/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))
double code(double x, double c, double s) {
return cos((2.0 * x)) / (pow(c, 2.0) * ((x * pow(s, 2.0)) * x));
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = cos((2.0d0 * x)) / ((c ** 2.0d0) * ((x * (s ** 2.0d0)) * x))
end function
public static double code(double x, double c, double s) {
return Math.cos((2.0 * x)) / (Math.pow(c, 2.0) * ((x * Math.pow(s, 2.0)) * x));
}
def code(x, c, s): return math.cos((2.0 * x)) / (math.pow(c, 2.0) * ((x * math.pow(s, 2.0)) * x))
function code(x, c, s) return Float64(cos(Float64(2.0 * x)) / Float64((c ^ 2.0) * Float64(Float64(x * (s ^ 2.0)) * x))) end
function tmp = code(x, c, s) tmp = cos((2.0 * x)) / ((c ^ 2.0) * ((x * (s ^ 2.0)) * x)); end
code[x_, c_, s_] := N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[Power[c, 2.0], $MachinePrecision] * N[(N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}
\end{array}
x_m = (fabs.f64 x) c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x_m c_m s_m) :precision binary64 (if (<= x_m 3.8e-66) (pow (/ (/ (/ 1.0 x_m) s_m) c_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 <= 3.8e-66) {
tmp = pow((((1.0 / x_m) / s_m) / c_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 <= 3.8d-66) then
tmp = (((1.0d0 / x_m) / s_m) / c_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 <= 3.8e-66) {
tmp = Math.pow((((1.0 / x_m) / s_m) / c_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 <= 3.8e-66: tmp = math.pow((((1.0 / x_m) / s_m) / c_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 <= 3.8e-66) tmp = Float64(Float64(Float64(1.0 / x_m) / s_m) / c_m) ^ 2.0; else tmp = Float64(Float64(Float64(cos(Float64(x_m * 2.0)) / Float64(x_m * c_m)) / s_m) / Float64(s_m * Float64(x_m * c_m))); end return tmp end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp_2 = code(x_m, c_m, s_m)
tmp = 0.0;
if (x_m <= 3.8e-66)
tmp = (((1.0 / x_m) / s_m) / c_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, 3.8e-66], N[Power[N[(N[(N[(1.0 / x$95$m), $MachinePrecision] / s$95$m), $MachinePrecision] / c$95$m), $MachinePrecision], 2.0], $MachinePrecision], N[(N[(N[(N[Cos[N[(x$95$m * 2.0), $MachinePrecision]], $MachinePrecision] / N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision] / s$95$m), $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 3.8 \cdot 10^{-66}:\\
\;\;\;\;{\left(\frac{\frac{\frac{1}{x\_m}}{s\_m}}{c\_m}\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{\cos \left(x\_m \cdot 2\right)}{x\_m \cdot c\_m}}{s\_m}}{s\_m \cdot \left(x\_m \cdot c\_m\right)}\\
\end{array}
\end{array}
if x < 3.7999999999999998e-66Initial program 64.3%
associate-/r*64.3%
cos-neg64.3%
distribute-rgt-neg-out64.3%
distribute-rgt-neg-out64.3%
*-commutative64.3%
distribute-rgt-neg-in64.3%
metadata-eval64.3%
*-commutative64.3%
associate-*l*59.3%
unpow259.3%
Simplified59.3%
Applied egg-rr78.1%
unpow278.1%
frac-times77.4%
add-sqr-sqrt96.0%
*-un-lft-identity96.0%
frac-times96.7%
associate-*l/96.7%
*-un-lft-identity96.7%
div-inv96.7%
div-inv96.7%
*-commutative96.7%
associate-*r*93.6%
associate-*r*96.4%
Applied egg-rr96.4%
add-cube-cbrt95.9%
pow396.0%
*-commutative96.0%
Applied egg-rr96.0%
Taylor expanded in x around 0 56.0%
associate-*r*56.0%
unpow256.0%
unpow256.0%
swap-sqr68.4%
unpow268.4%
swap-sqr84.7%
*-commutative84.7%
*-commutative84.7%
associate-/l/85.2%
associate-/l/85.3%
associate-/r*85.4%
associate-/l/84.7%
*-rgt-identity84.7%
associate-/l*84.7%
associate-/l/84.7%
associate-/r*84.8%
associate-/l/86.9%
unpow286.9%
Simplified86.4%
if 3.7999999999999998e-66 < x Initial program 66.1%
associate-/r*66.1%
cos-neg66.1%
distribute-rgt-neg-out66.1%
distribute-rgt-neg-out66.1%
*-commutative66.1%
distribute-rgt-neg-in66.1%
metadata-eval66.1%
*-commutative66.1%
associate-*l*62.5%
unpow262.5%
Simplified62.5%
Applied egg-rr57.9%
unpow257.9%
frac-times57.8%
add-sqr-sqrt94.8%
*-un-lft-identity94.8%
frac-times95.4%
associate-*l/95.4%
*-un-lft-identity95.4%
div-inv95.3%
div-inv95.4%
*-commutative95.4%
associate-*r*90.2%
associate-*r*94.4%
Applied egg-rr94.4%
add-cube-cbrt94.0%
pow394.0%
*-commutative94.0%
Applied egg-rr94.0%
rem-cube-cbrt94.4%
associate-/r*94.4%
div-inv94.4%
Applied egg-rr94.4%
associate-*r/94.4%
*-rgt-identity94.4%
*-commutative94.4%
Simplified94.4%
Final simplification89.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
(let* ((t_0 (* s_m (* x_m c_m))))
(if (<= x_m 1.42e-68)
(pow (* c_m (* x_m s_m)) -2.0)
(/ (/ (cos (* x_m 2.0)) t_0) t_0))))x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
double t_0 = s_m * (x_m * c_m);
double tmp;
if (x_m <= 1.42e-68) {
tmp = pow((c_m * (x_m * s_m)), -2.0);
} else {
tmp = (cos((x_m * 2.0)) / t_0) / t_0;
}
return tmp;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
real(8) :: t_0
real(8) :: tmp
t_0 = s_m * (x_m * c_m)
if (x_m <= 1.42d-68) then
tmp = (c_m * (x_m * s_m)) ** (-2.0d0)
else
tmp = (cos((x_m * 2.0d0)) / t_0) / t_0
end if
code = tmp
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
double t_0 = s_m * (x_m * c_m);
double tmp;
if (x_m <= 1.42e-68) {
tmp = Math.pow((c_m * (x_m * s_m)), -2.0);
} else {
tmp = (Math.cos((x_m * 2.0)) / t_0) / t_0;
}
return tmp;
}
x_m = math.fabs(x) c_m = math.fabs(c) s_m = math.fabs(s) [x_m, c_m, s_m] = sort([x_m, c_m, s_m]) def code(x_m, c_m, s_m): t_0 = s_m * (x_m * c_m) tmp = 0 if x_m <= 1.42e-68: tmp = math.pow((c_m * (x_m * s_m)), -2.0) else: tmp = (math.cos((x_m * 2.0)) / t_0) / t_0 return tmp
x_m = abs(x) c_m = abs(c) s_m = abs(s) x_m, c_m, s_m = sort([x_m, c_m, s_m]) function code(x_m, c_m, s_m) t_0 = Float64(s_m * Float64(x_m * c_m)) tmp = 0.0 if (x_m <= 1.42e-68) tmp = Float64(c_m * Float64(x_m * s_m)) ^ -2.0; else tmp = Float64(Float64(cos(Float64(x_m * 2.0)) / t_0) / t_0); end return tmp end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp_2 = code(x_m, c_m, s_m)
t_0 = s_m * (x_m * c_m);
tmp = 0.0;
if (x_m <= 1.42e-68)
tmp = (c_m * (x_m * s_m)) ^ -2.0;
else
tmp = (cos((x_m * 2.0)) / t_0) / t_0;
end
tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[(s$95$m * N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$95$m, 1.42e-68], N[Power[N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], N[(N[(N[Cos[N[(x$95$m * 2.0), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := s\_m \cdot \left(x\_m \cdot c\_m\right)\\
\mathbf{if}\;x\_m \leq 1.42 \cdot 10^{-68}:\\
\;\;\;\;{\left(c\_m \cdot \left(x\_m \cdot s\_m\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cos \left(x\_m \cdot 2\right)}{t\_0}}{t\_0}\\
\end{array}
\end{array}
if x < 1.42e-68Initial program 64.2%
associate-/r*64.2%
cos-neg64.2%
distribute-rgt-neg-out64.2%
distribute-rgt-neg-out64.2%
*-commutative64.2%
distribute-rgt-neg-in64.2%
metadata-eval64.2%
*-commutative64.2%
associate-*l*59.1%
unpow259.1%
Simplified59.1%
Taylor expanded in x around 0 55.8%
associate-/r*55.8%
*-commutative55.8%
unpow255.8%
unpow255.8%
swap-sqr70.0%
unpow270.0%
associate-/r*70.2%
unpow270.2%
unpow270.2%
swap-sqr86.0%
unpow286.0%
Simplified86.0%
Taylor expanded in c around 0 55.8%
unpow255.8%
*-commutative55.8%
unpow255.8%
unpow255.8%
swap-sqr70.2%
swap-sqr86.0%
associate-*l*82.8%
associate-*l*83.4%
associate-/l/84.0%
*-lft-identity84.0%
associate-*l/84.0%
unpow-184.0%
unpow-184.0%
pow-sqr84.0%
associate-*l*86.6%
*-commutative86.6%
metadata-eval86.6%
Simplified86.6%
if 1.42e-68 < x Initial program 66.2%
associate-/r*66.2%
cos-neg66.2%
distribute-rgt-neg-out66.2%
distribute-rgt-neg-out66.2%
*-commutative66.2%
distribute-rgt-neg-in66.2%
metadata-eval66.2%
*-commutative66.2%
associate-*l*62.7%
unpow262.7%
Simplified62.7%
Applied egg-rr59.2%
unpow259.2%
frac-times59.2%
add-sqr-sqrt94.9%
*-un-lft-identity94.9%
frac-times95.5%
associate-*l/95.5%
*-un-lft-identity95.5%
div-inv95.4%
div-inv95.5%
*-commutative95.5%
associate-*r*90.5%
associate-*r*94.5%
Applied egg-rr94.5%
Final simplification89.4%
x_m = (fabs.f64 x) c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x_m c_m s_m) :precision binary64 (if (<= x_m 4.4e-36) (pow (/ (/ (/ 1.0 x_m) s_m) c_m) 2.0) (/ (/ (cos (* x_m 2.0)) (* s_m (* x_m c_m))) (* c_m (* x_m s_m)))))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
double tmp;
if (x_m <= 4.4e-36) {
tmp = pow((((1.0 / x_m) / s_m) / c_m), 2.0);
} else {
tmp = (cos((x_m * 2.0)) / (s_m * (x_m * c_m))) / (c_m * (x_m * s_m));
}
return tmp;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
real(8) :: tmp
if (x_m <= 4.4d-36) then
tmp = (((1.0d0 / x_m) / s_m) / c_m) ** 2.0d0
else
tmp = (cos((x_m * 2.0d0)) / (s_m * (x_m * c_m))) / (c_m * (x_m * s_m))
end if
code = tmp
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
double tmp;
if (x_m <= 4.4e-36) {
tmp = Math.pow((((1.0 / x_m) / s_m) / c_m), 2.0);
} else {
tmp = (Math.cos((x_m * 2.0)) / (s_m * (x_m * c_m))) / (c_m * (x_m * s_m));
}
return tmp;
}
x_m = math.fabs(x) c_m = math.fabs(c) s_m = math.fabs(s) [x_m, c_m, s_m] = sort([x_m, c_m, s_m]) def code(x_m, c_m, s_m): tmp = 0 if x_m <= 4.4e-36: tmp = math.pow((((1.0 / x_m) / s_m) / c_m), 2.0) else: tmp = (math.cos((x_m * 2.0)) / (s_m * (x_m * c_m))) / (c_m * (x_m * s_m)) return tmp
x_m = abs(x) c_m = abs(c) s_m = abs(s) x_m, c_m, s_m = sort([x_m, c_m, s_m]) function code(x_m, c_m, s_m) tmp = 0.0 if (x_m <= 4.4e-36) tmp = Float64(Float64(Float64(1.0 / x_m) / s_m) / c_m) ^ 2.0; else tmp = Float64(Float64(cos(Float64(x_m * 2.0)) / Float64(s_m * Float64(x_m * c_m))) / Float64(c_m * Float64(x_m * s_m))); end return tmp end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp_2 = code(x_m, c_m, s_m)
tmp = 0.0;
if (x_m <= 4.4e-36)
tmp = (((1.0 / x_m) / s_m) / c_m) ^ 2.0;
else
tmp = (cos((x_m * 2.0)) / (s_m * (x_m * c_m))) / (c_m * (x_m * s_m));
end
tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision] c_m = N[Abs[c], $MachinePrecision] s_m = N[Abs[s], $MachinePrecision] NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function. code[x$95$m_, c$95$m_, s$95$m_] := If[LessEqual[x$95$m, 4.4e-36], N[Power[N[(N[(N[(1.0 / x$95$m), $MachinePrecision] / s$95$m), $MachinePrecision] / c$95$m), $MachinePrecision], 2.0], $MachinePrecision], N[(N[(N[Cos[N[(x$95$m * 2.0), $MachinePrecision]], $MachinePrecision] / N[(s$95$m * N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 4.4 \cdot 10^{-36}:\\
\;\;\;\;{\left(\frac{\frac{\frac{1}{x\_m}}{s\_m}}{c\_m}\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cos \left(x\_m \cdot 2\right)}{s\_m \cdot \left(x\_m \cdot c\_m\right)}}{c\_m \cdot \left(x\_m \cdot s\_m\right)}\\
\end{array}
\end{array}
if x < 4.3999999999999999e-36Initial program 65.1%
associate-/r*65.2%
cos-neg65.2%
distribute-rgt-neg-out65.2%
distribute-rgt-neg-out65.2%
*-commutative65.2%
distribute-rgt-neg-in65.2%
metadata-eval65.2%
*-commutative65.2%
associate-*l*60.4%
unpow260.4%
Simplified60.4%
Applied egg-rr79.0%
unpow279.0%
frac-times78.3%
add-sqr-sqrt96.2%
*-un-lft-identity96.2%
frac-times96.8%
associate-*l/96.8%
*-un-lft-identity96.8%
div-inv96.8%
div-inv96.8%
*-commutative96.8%
associate-*r*93.8%
associate-*r*96.5%
Applied egg-rr96.5%
add-cube-cbrt96.1%
pow396.1%
*-commutative96.1%
Applied egg-rr96.1%
Taylor expanded in x around 0 57.2%
associate-*r*57.2%
unpow257.2%
unpow257.2%
swap-sqr69.6%
unpow269.6%
swap-sqr85.3%
*-commutative85.3%
*-commutative85.3%
associate-/l/85.8%
associate-/l/85.9%
associate-/r*85.9%
associate-/l/85.3%
*-rgt-identity85.3%
associate-/l*85.3%
associate-/l/85.3%
associate-/r*85.4%
associate-/l/87.4%
unpow287.4%
Simplified86.9%
if 4.3999999999999999e-36 < x Initial program 64.4%
associate-/r*64.4%
cos-neg64.4%
distribute-rgt-neg-out64.4%
distribute-rgt-neg-out64.4%
*-commutative64.4%
distribute-rgt-neg-in64.4%
metadata-eval64.4%
*-commutative64.4%
associate-*l*60.5%
unpow260.5%
Simplified60.5%
Applied egg-rr54.3%
unpow254.3%
frac-times54.2%
add-sqr-sqrt94.3%
*-un-lft-identity94.3%
frac-times95.0%
associate-*l/95.0%
*-un-lft-identity95.0%
div-inv94.9%
div-inv95.0%
*-commutative95.0%
associate-*r*89.4%
associate-*r*93.9%
Applied egg-rr93.9%
Taylor expanded in c around 0 89.4%
Final simplification87.7%
x_m = (fabs.f64 x) c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x_m c_m s_m) :precision binary64 (if (<= s_m 2.2e+214) (/ (/ (cos (* x_m 2.0)) c_m) (* (* s_m (* x_m c_m)) (* x_m s_m))) (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) {
double tmp;
if (s_m <= 2.2e+214) {
tmp = (cos((x_m * 2.0)) / c_m) / ((s_m * (x_m * c_m)) * (x_m * s_m));
} else {
tmp = pow((c_m * (x_m * s_m)), -2.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) :: tmp
if (s_m <= 2.2d+214) then
tmp = (cos((x_m * 2.0d0)) / c_m) / ((s_m * (x_m * c_m)) * (x_m * s_m))
else
tmp = (c_m * (x_m * s_m)) ** (-2.0d0)
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 (s_m <= 2.2e+214) {
tmp = (Math.cos((x_m * 2.0)) / c_m) / ((s_m * (x_m * c_m)) * (x_m * s_m));
} else {
tmp = Math.pow((c_m * (x_m * s_m)), -2.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): tmp = 0 if s_m <= 2.2e+214: tmp = (math.cos((x_m * 2.0)) / c_m) / ((s_m * (x_m * c_m)) * (x_m * s_m)) else: tmp = math.pow((c_m * (x_m * s_m)), -2.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) tmp = 0.0 if (s_m <= 2.2e+214) tmp = Float64(Float64(cos(Float64(x_m * 2.0)) / c_m) / Float64(Float64(s_m * Float64(x_m * c_m)) * Float64(x_m * s_m))); else tmp = Float64(c_m * Float64(x_m * s_m)) ^ -2.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)
tmp = 0.0;
if (s_m <= 2.2e+214)
tmp = (cos((x_m * 2.0)) / c_m) / ((s_m * (x_m * c_m)) * (x_m * s_m));
else
tmp = (c_m * (x_m * s_m)) ^ -2.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_] := If[LessEqual[s$95$m, 2.2e+214], N[(N[(N[Cos[N[(x$95$m * 2.0), $MachinePrecision]], $MachinePrecision] / c$95$m), $MachinePrecision] / N[(N[(s$95$m * N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision] * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;s\_m \leq 2.2 \cdot 10^{+214}:\\
\;\;\;\;\frac{\frac{\cos \left(x\_m \cdot 2\right)}{c\_m}}{\left(s\_m \cdot \left(x\_m \cdot c\_m\right)\right) \cdot \left(x\_m \cdot s\_m\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left(c\_m \cdot \left(x\_m \cdot s\_m\right)\right)}^{-2}\\
\end{array}
\end{array}
if s < 2.20000000000000023e214Initial program 67.1%
associate-/r*67.1%
cos-neg67.1%
distribute-rgt-neg-out67.1%
distribute-rgt-neg-out67.1%
*-commutative67.1%
distribute-rgt-neg-in67.1%
metadata-eval67.1%
*-commutative67.1%
associate-*l*62.6%
unpow262.6%
Simplified62.6%
Applied egg-rr72.4%
unpow272.4%
frac-times71.8%
add-sqr-sqrt96.4%
*-un-lft-identity96.4%
frac-times97.1%
*-commutative97.1%
associate-/r*97.2%
frac-times93.6%
div-inv93.6%
*-commutative93.6%
associate-*r*90.5%
Applied egg-rr90.5%
if 2.20000000000000023e214 < s Initial program 41.6%
associate-/r*41.5%
cos-neg41.5%
distribute-rgt-neg-out41.5%
distribute-rgt-neg-out41.5%
*-commutative41.5%
distribute-rgt-neg-in41.5%
metadata-eval41.5%
*-commutative41.5%
associate-*l*36.8%
unpow236.8%
Simplified36.8%
Taylor expanded in x around 0 36.8%
associate-/r*36.8%
*-commutative36.8%
unpow236.8%
unpow236.8%
swap-sqr59.8%
unpow259.8%
associate-/r*61.7%
unpow261.7%
unpow261.7%
swap-sqr82.4%
unpow282.4%
Simplified82.4%
Taylor expanded in c around 0 36.8%
unpow236.8%
*-commutative36.8%
unpow236.8%
unpow236.8%
swap-sqr61.7%
swap-sqr82.4%
associate-*l*70.3%
associate-*l*70.0%
associate-/l/70.0%
*-lft-identity70.0%
associate-*l/70.0%
unpow-170.0%
unpow-170.0%
pow-sqr70.0%
associate-*l*82.5%
*-commutative82.5%
metadata-eval82.5%
Simplified82.5%
Final simplification89.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 (pow (/ (/ (/ 1.0 x_m) s_m) c_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((((1.0 / x_m) / s_m) / c_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 = (((1.0d0 / x_m) / s_m) / c_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((((1.0 / x_m) / s_m) / c_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((((1.0 / x_m) / s_m) / c_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(Float64(Float64(1.0 / x_m) / s_m) / c_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 = (((1.0 / x_m) / s_m) / c_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[(N[(N[(1.0 / x$95$m), $MachinePrecision] / s$95$m), $MachinePrecision] / c$95$m), $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(\frac{\frac{\frac{1}{x\_m}}{s\_m}}{c\_m}\right)}^{2}
\end{array}
Initial program 64.9%
associate-/r*64.9%
cos-neg64.9%
distribute-rgt-neg-out64.9%
distribute-rgt-neg-out64.9%
*-commutative64.9%
distribute-rgt-neg-in64.9%
metadata-eval64.9%
*-commutative64.9%
associate-*l*60.4%
unpow260.4%
Simplified60.4%
Applied egg-rr71.2%
unpow271.2%
frac-times70.7%
add-sqr-sqrt95.6%
*-un-lft-identity95.6%
frac-times96.2%
associate-*l/96.2%
*-un-lft-identity96.2%
div-inv96.2%
div-inv96.2%
*-commutative96.2%
associate-*r*92.4%
associate-*r*95.7%
Applied egg-rr95.7%
add-cube-cbrt95.3%
pow395.3%
*-commutative95.3%
Applied egg-rr95.3%
Taylor expanded in x around 0 56.1%
associate-*r*56.1%
unpow256.1%
unpow256.1%
swap-sqr67.3%
unpow267.3%
swap-sqr79.0%
*-commutative79.0%
*-commutative79.0%
associate-/l/79.3%
associate-/l/79.4%
associate-/r*79.4%
associate-/l/78.9%
*-rgt-identity78.9%
associate-/l*78.9%
associate-/l/78.9%
associate-/r*79.0%
associate-/l/80.3%
unpow280.3%
Simplified80.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 (/ (/ 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(Float64(1.0 / 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[(N[(1.0 / c$95$m), $MachinePrecision] / N[(x$95$m * s$95$m), $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{\frac{1}{c\_m}}{x\_m \cdot s\_m}\\
t\_0 \cdot t\_0
\end{array}
\end{array}
Initial program 64.9%
associate-/r*64.9%
cos-neg64.9%
distribute-rgt-neg-out64.9%
distribute-rgt-neg-out64.9%
*-commutative64.9%
distribute-rgt-neg-in64.9%
metadata-eval64.9%
*-commutative64.9%
associate-*l*60.4%
unpow260.4%
Simplified60.4%
Taylor expanded in x around 0 56.1%
associate-/r*56.1%
*-commutative56.1%
unpow256.1%
unpow256.1%
swap-sqr67.2%
unpow267.2%
associate-/r*67.3%
unpow267.3%
unpow267.3%
swap-sqr79.9%
unpow279.9%
Simplified79.9%
Taylor expanded in c around 0 56.1%
unpow256.1%
*-commutative56.1%
unpow256.1%
unpow256.1%
swap-sqr67.3%
swap-sqr79.9%
associate-*l*77.7%
associate-*l*78.2%
associate-/l/78.6%
*-lft-identity78.6%
associate-*l/78.6%
unpow-178.6%
unpow-178.6%
pow-sqr78.6%
associate-*l*80.3%
*-commutative80.3%
metadata-eval80.3%
Simplified80.3%
*-commutative80.3%
/-rgt-identity80.3%
clear-num80.0%
Applied egg-rr80.0%
remove-double-div80.3%
metadata-eval80.3%
pow-sqr80.3%
inv-pow80.3%
associate-/r*80.3%
inv-pow80.3%
associate-/r*80.3%
Applied egg-rr80.3%
x_m = (fabs.f64 x) c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x_m c_m s_m) :precision binary64 (let* ((t_0 (/ 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 64.9%
associate-/r*64.9%
cos-neg64.9%
distribute-rgt-neg-out64.9%
distribute-rgt-neg-out64.9%
*-commutative64.9%
distribute-rgt-neg-in64.9%
metadata-eval64.9%
*-commutative64.9%
associate-*l*60.4%
unpow260.4%
Simplified60.4%
Applied egg-rr96.2%
Taylor expanded in x around 0 80.3%
x_m = (fabs.f64 x) c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x_m c_m s_m) :precision binary64 (let* ((t_0 (* 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.9%
associate-/r*64.9%
cos-neg64.9%
distribute-rgt-neg-out64.9%
distribute-rgt-neg-out64.9%
*-commutative64.9%
distribute-rgt-neg-in64.9%
metadata-eval64.9%
*-commutative64.9%
associate-*l*60.4%
unpow260.4%
Simplified60.4%
Taylor expanded in x around 0 56.1%
associate-/r*56.1%
*-commutative56.1%
unpow256.1%
unpow256.1%
swap-sqr67.2%
unpow267.2%
associate-/r*67.3%
unpow267.3%
unpow267.3%
swap-sqr79.9%
unpow279.9%
Simplified79.9%
Taylor expanded in c around 0 56.1%
unpow256.1%
*-commutative56.1%
unpow256.1%
unpow256.1%
swap-sqr67.3%
swap-sqr79.9%
associate-*l*77.7%
associate-*l*78.2%
associate-/l/78.6%
*-lft-identity78.6%
associate-*l/78.6%
unpow-178.6%
unpow-178.6%
pow-sqr78.6%
associate-*l*80.3%
*-commutative80.3%
metadata-eval80.3%
Simplified80.3%
*-commutative80.3%
associate-*l*78.6%
metadata-eval78.6%
pow-div78.6%
inv-pow78.6%
pow178.6%
associate-*l*78.1%
associate-*l*80.3%
Applied egg-rr80.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 (/ 1.0 (* (* x_m s_m) (* c_m (* c_m (* x_m s_m))))))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
return 1.0 / ((x_m * s_m) * (c_m * (c_m * (x_m * s_m))));
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
code = 1.0d0 / ((x_m * s_m) * (c_m * (c_m * (x_m * s_m))))
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
return 1.0 / ((x_m * s_m) * (c_m * (c_m * (x_m * s_m))));
}
x_m = math.fabs(x) c_m = math.fabs(c) s_m = math.fabs(s) [x_m, c_m, s_m] = sort([x_m, c_m, s_m]) def code(x_m, c_m, s_m): return 1.0 / ((x_m * s_m) * (c_m * (c_m * (x_m * s_m))))
x_m = abs(x) c_m = abs(c) s_m = abs(s) x_m, c_m, s_m = sort([x_m, c_m, s_m]) function code(x_m, c_m, s_m) return Float64(1.0 / Float64(Float64(x_m * s_m) * Float64(c_m * Float64(c_m * Float64(x_m * s_m))))) end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp = code(x_m, c_m, s_m)
tmp = 1.0 / ((x_m * s_m) * (c_m * (c_m * (x_m * s_m))));
end
x_m = N[Abs[x], $MachinePrecision] c_m = N[Abs[c], $MachinePrecision] s_m = N[Abs[s], $MachinePrecision] NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function. code[x$95$m_, c$95$m_, s$95$m_] := N[(1.0 / N[(N[(x$95$m * s$95$m), $MachinePrecision] * N[(c$95$m * N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\frac{1}{\left(x\_m \cdot s\_m\right) \cdot \left(c\_m \cdot \left(c\_m \cdot \left(x\_m \cdot s\_m\right)\right)\right)}
\end{array}
Initial program 64.9%
associate-/r*64.9%
cos-neg64.9%
distribute-rgt-neg-out64.9%
distribute-rgt-neg-out64.9%
*-commutative64.9%
distribute-rgt-neg-in64.9%
metadata-eval64.9%
*-commutative64.9%
associate-*l*60.4%
unpow260.4%
Simplified60.4%
Taylor expanded in x around 0 56.1%
associate-/r*56.1%
*-commutative56.1%
unpow256.1%
unpow256.1%
swap-sqr67.2%
unpow267.2%
associate-/r*67.3%
unpow267.3%
unpow267.3%
swap-sqr79.9%
unpow279.9%
Simplified79.9%
unpow279.9%
associate-*r*76.0%
associate-*r*74.9%
Applied egg-rr74.9%
Taylor expanded in c around 0 76.0%
Final simplification76.0%
x_m = (fabs.f64 x) c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x_m c_m s_m) :precision binary64 (let* ((t_0 (* s_m (* x_m c_m)))) (/ 1.0 (* t_0 t_0))))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
double t_0 = s_m * (x_m * c_m);
return 1.0 / (t_0 * t_0);
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
real(8) :: t_0
t_0 = s_m * (x_m * c_m)
code = 1.0d0 / (t_0 * t_0)
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
double t_0 = s_m * (x_m * c_m);
return 1.0 / (t_0 * t_0);
}
x_m = math.fabs(x) c_m = math.fabs(c) s_m = math.fabs(s) [x_m, c_m, s_m] = sort([x_m, c_m, s_m]) def code(x_m, c_m, s_m): t_0 = s_m * (x_m * c_m) return 1.0 / (t_0 * t_0)
x_m = abs(x) c_m = abs(c) s_m = abs(s) x_m, c_m, s_m = sort([x_m, c_m, s_m]) function code(x_m, c_m, s_m) t_0 = Float64(s_m * Float64(x_m * c_m)) return Float64(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 64.9%
associate-/r*64.9%
cos-neg64.9%
distribute-rgt-neg-out64.9%
distribute-rgt-neg-out64.9%
*-commutative64.9%
distribute-rgt-neg-in64.9%
metadata-eval64.9%
*-commutative64.9%
associate-*l*60.4%
unpow260.4%
Simplified60.4%
Taylor expanded in x around 0 56.1%
associate-/r*56.1%
*-commutative56.1%
unpow256.1%
unpow256.1%
swap-sqr67.2%
unpow267.2%
associate-/r*67.3%
unpow267.3%
unpow267.3%
swap-sqr79.9%
unpow279.9%
Simplified79.9%
unpow279.9%
associate-*r*77.7%
associate-*r*78.2%
Applied egg-rr78.2%
Final simplification78.2%
herbie shell --seed 2024130
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))