
(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 12 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
(let* ((t_0 (* c_m (* x s_m))) (t_1 (cos (* x 2.0))))
(if (<= c_m 6.5e-260)
(/ (/ (/ t_1 (* x (* c_m s_m))) (* c_m s_m)) x)
(* (/ 1.0 t_0) (/ t_1 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 * (x * s_m);
double t_1 = cos((x * 2.0));
double tmp;
if (c_m <= 6.5e-260) {
tmp = ((t_1 / (x * (c_m * s_m))) / (c_m * s_m)) / x;
} else {
tmp = (1.0 / t_0) * (t_1 / t_0);
}
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 * (x * s_m)
t_1 = cos((x * 2.0d0))
if (c_m <= 6.5d-260) then
tmp = ((t_1 / (x * (c_m * s_m))) / (c_m * s_m)) / x
else
tmp = (1.0d0 / t_0) * (t_1 / t_0)
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 * (x * s_m);
double t_1 = Math.cos((x * 2.0));
double tmp;
if (c_m <= 6.5e-260) {
tmp = ((t_1 / (x * (c_m * s_m))) / (c_m * s_m)) / x;
} else {
tmp = (1.0 / t_0) * (t_1 / t_0);
}
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 * (x * s_m) t_1 = math.cos((x * 2.0)) tmp = 0 if c_m <= 6.5e-260: tmp = ((t_1 / (x * (c_m * s_m))) / (c_m * s_m)) / x else: tmp = (1.0 / t_0) * (t_1 / t_0) 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(x * s_m)) t_1 = cos(Float64(x * 2.0)) tmp = 0.0 if (c_m <= 6.5e-260) tmp = Float64(Float64(Float64(t_1 / Float64(x * Float64(c_m * s_m))) / Float64(c_m * s_m)) / x); else tmp = Float64(Float64(1.0 / t_0) * Float64(t_1 / t_0)); 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 * (x * s_m);
t_1 = cos((x * 2.0));
tmp = 0.0;
if (c_m <= 6.5e-260)
tmp = ((t_1 / (x * (c_m * s_m))) / (c_m * s_m)) / x;
else
tmp = (1.0 / t_0) * (t_1 / t_0);
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[(x * s$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[c$95$m, 6.5e-260], N[(N[(N[(t$95$1 / N[(x * N[(c$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(c$95$m * s$95$m), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(t$95$1 / 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(x \cdot s\_m\right)\\
t_1 := \cos \left(x \cdot 2\right)\\
\mathbf{if}\;c\_m \leq 6.5 \cdot 10^{-260}:\\
\;\;\;\;\frac{\frac{\frac{t\_1}{x \cdot \left(c\_m \cdot s\_m\right)}}{c\_m \cdot s\_m}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_0} \cdot \frac{t\_1}{t\_0}\\
\end{array}
\end{array}
if c < 6.50000000000000002e-260Initial program 66.0%
*-un-lft-identity66.0%
add-sqr-sqrt66.0%
times-frac66.0%
Applied egg-rr97.7%
associate-*l/97.8%
*-un-lft-identity97.8%
*-commutative97.8%
associate-*r*94.4%
associate-/r*89.8%
*-commutative89.8%
Applied egg-rr89.8%
Taylor expanded in x around inf 89.8%
*-commutative89.8%
associate-*r*91.7%
Simplified91.7%
if 6.50000000000000002e-260 < c Initial program 60.9%
*-un-lft-identity60.9%
add-sqr-sqrt60.9%
times-frac61.0%
Applied egg-rr98.0%
Final simplification94.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
(let* ((t_0 (* c_m (* x s_m))))
(if (<= x 1.04e-7)
(/ (/ 1.0 t_0) t_0)
(/ (/ (cos (* x 2.0)) s_m) (* (* x c_m) 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 * (x * s_m);
double tmp;
if (x <= 1.04e-7) {
tmp = (1.0 / t_0) / t_0;
} else {
tmp = (cos((x * 2.0)) / s_m) / ((x * c_m) * t_0);
}
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 = c_m * (x * s_m)
if (x <= 1.04d-7) then
tmp = (1.0d0 / t_0) / t_0
else
tmp = (cos((x * 2.0d0)) / s_m) / ((x * c_m) * t_0)
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 * (x * s_m);
double tmp;
if (x <= 1.04e-7) {
tmp = (1.0 / t_0) / t_0;
} else {
tmp = (Math.cos((x * 2.0)) / s_m) / ((x * c_m) * t_0);
}
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 * (x * s_m) tmp = 0 if x <= 1.04e-7: tmp = (1.0 / t_0) / t_0 else: tmp = (math.cos((x * 2.0)) / s_m) / ((x * c_m) * t_0) 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(x * s_m)) tmp = 0.0 if (x <= 1.04e-7) tmp = Float64(Float64(1.0 / t_0) / t_0); else tmp = Float64(Float64(cos(Float64(x * 2.0)) / s_m) / Float64(Float64(x * c_m) * t_0)); 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 * (x * s_m);
tmp = 0.0;
if (x <= 1.04e-7)
tmp = (1.0 / t_0) / t_0;
else
tmp = (cos((x * 2.0)) / s_m) / ((x * c_m) * t_0);
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[(x * s$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.04e-7], N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / s$95$m), $MachinePrecision] / N[(N[(x * c$95$m), $MachinePrecision] * 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(x \cdot s\_m\right)\\
\mathbf{if}\;x \leq 1.04 \cdot 10^{-7}:\\
\;\;\;\;\frac{\frac{1}{t\_0}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cos \left(x \cdot 2\right)}{s\_m}}{\left(x \cdot c\_m\right) \cdot t\_0}\\
\end{array}
\end{array}
if x < 1.04e-7Initial program 60.7%
Taylor expanded in x around 0 55.1%
associate-/r*55.4%
*-commutative55.4%
unpow255.4%
unpow255.4%
swap-sqr68.5%
unpow268.5%
associate-/r*68.2%
unpow268.2%
unpow268.2%
swap-sqr88.9%
unpow288.9%
*-commutative88.9%
Simplified88.9%
pow-flip89.3%
*-commutative89.3%
pow-flip88.9%
unpow288.9%
associate-/r*89.3%
un-div-inv89.3%
Applied egg-rr89.3%
un-div-inv89.3%
Applied egg-rr89.3%
if 1.04e-7 < x Initial program 72.2%
associate-/r*70.7%
*-commutative70.7%
associate-*r*61.9%
unpow261.9%
associate-/r*63.5%
add-sqr-sqrt57.0%
sqrt-unprod45.1%
swap-sqr45.1%
metadata-eval45.1%
metadata-eval45.1%
swap-sqr45.1%
*-commutative45.1%
*-commutative45.1%
sqrt-unprod0.0%
add-sqr-sqrt63.5%
add-cube-cbrt63.4%
Applied egg-rr96.4%
/-rgt-identity96.4%
associate-*r*97.6%
associate-/l*97.6%
Applied egg-rr97.6%
Applied egg-rr91.6%
Final simplification89.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
(let* ((t_0 (cos (* x 2.0))))
(if (<= c_m 9.5e-194)
(/ (/ t_0 (* c_m (* s_m (* x (* c_m s_m))))) x)
(/ (/ (/ t_0 c_m) (* c_m (* x s_m))) (* x s_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((x * 2.0));
double tmp;
if (c_m <= 9.5e-194) {
tmp = (t_0 / (c_m * (s_m * (x * (c_m * s_m))))) / x;
} else {
tmp = ((t_0 / c_m) / (c_m * (x * s_m))) / (x * s_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((x * 2.0d0))
if (c_m <= 9.5d-194) then
tmp = (t_0 / (c_m * (s_m * (x * (c_m * s_m))))) / x
else
tmp = ((t_0 / c_m) / (c_m * (x * s_m))) / (x * s_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((x * 2.0));
double tmp;
if (c_m <= 9.5e-194) {
tmp = (t_0 / (c_m * (s_m * (x * (c_m * s_m))))) / x;
} else {
tmp = ((t_0 / c_m) / (c_m * (x * s_m))) / (x * s_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((x * 2.0)) tmp = 0 if c_m <= 9.5e-194: tmp = (t_0 / (c_m * (s_m * (x * (c_m * s_m))))) / x else: tmp = ((t_0 / c_m) / (c_m * (x * s_m))) / (x * s_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(x * 2.0)) tmp = 0.0 if (c_m <= 9.5e-194) tmp = Float64(Float64(t_0 / Float64(c_m * Float64(s_m * Float64(x * Float64(c_m * s_m))))) / x); else tmp = Float64(Float64(Float64(t_0 / c_m) / Float64(c_m * Float64(x * s_m))) / Float64(x * s_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((x * 2.0));
tmp = 0.0;
if (c_m <= 9.5e-194)
tmp = (t_0 / (c_m * (s_m * (x * (c_m * s_m))))) / x;
else
tmp = ((t_0 / c_m) / (c_m * (x * s_m))) / (x * s_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[(x * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[c$95$m, 9.5e-194], N[(N[(t$95$0 / N[(c$95$m * N[(s$95$m * N[(x * N[(c$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(t$95$0 / c$95$m), $MachinePrecision] / N[(c$95$m * N[(x * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * s$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])\\
\\
\begin{array}{l}
t_0 := \cos \left(x \cdot 2\right)\\
\mathbf{if}\;c\_m \leq 9.5 \cdot 10^{-194}:\\
\;\;\;\;\frac{\frac{t\_0}{c\_m \cdot \left(s\_m \cdot \left(x \cdot \left(c\_m \cdot s\_m\right)\right)\right)}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{t\_0}{c\_m}}{c\_m \cdot \left(x \cdot s\_m\right)}}{x \cdot s\_m}\\
\end{array}
\end{array}
if c < 9.50000000000000009e-194Initial program 65.2%
*-un-lft-identity65.2%
add-sqr-sqrt65.2%
times-frac65.2%
Applied egg-rr97.9%
associate-*l/97.9%
*-un-lft-identity97.9%
*-commutative97.9%
associate-*r*94.0%
associate-/r*89.7%
*-commutative89.7%
Applied egg-rr89.7%
*-un-lft-identity89.7%
associate-/l/89.0%
*-commutative89.0%
associate-*r*89.0%
*-commutative89.0%
associate-*r*89.0%
Applied egg-rr89.0%
*-lft-identity89.0%
*-commutative89.0%
*-commutative89.0%
associate-*r*90.8%
Simplified90.8%
if 9.50000000000000009e-194 < c Initial program 61.7%
associate-/r*62.1%
*-commutative62.1%
associate-*r*58.7%
unpow258.7%
associate-/r*58.3%
add-sqr-sqrt23.6%
sqrt-unprod49.8%
swap-sqr49.8%
metadata-eval49.8%
metadata-eval49.8%
swap-sqr49.8%
*-commutative49.8%
*-commutative49.8%
sqrt-unprod29.8%
add-sqr-sqrt58.3%
add-cube-cbrt58.2%
Applied egg-rr96.6%
/-rgt-identity96.6%
associate-*r*94.6%
associate-/l*94.6%
Applied egg-rr94.6%
Applied egg-rr95.6%
Final simplification92.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
(let* ((t_0 (cos (* x 2.0))))
(if (<= c_m 9e-194)
(/ (/ t_0 (* c_m (* s_m (* x (* c_m s_m))))) x)
(/ (/ (/ t_0 (* c_m (* x s_m))) c_m) (* x s_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((x * 2.0));
double tmp;
if (c_m <= 9e-194) {
tmp = (t_0 / (c_m * (s_m * (x * (c_m * s_m))))) / x;
} else {
tmp = ((t_0 / (c_m * (x * s_m))) / c_m) / (x * s_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((x * 2.0d0))
if (c_m <= 9d-194) then
tmp = (t_0 / (c_m * (s_m * (x * (c_m * s_m))))) / x
else
tmp = ((t_0 / (c_m * (x * s_m))) / c_m) / (x * s_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((x * 2.0));
double tmp;
if (c_m <= 9e-194) {
tmp = (t_0 / (c_m * (s_m * (x * (c_m * s_m))))) / x;
} else {
tmp = ((t_0 / (c_m * (x * s_m))) / c_m) / (x * s_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((x * 2.0)) tmp = 0 if c_m <= 9e-194: tmp = (t_0 / (c_m * (s_m * (x * (c_m * s_m))))) / x else: tmp = ((t_0 / (c_m * (x * s_m))) / c_m) / (x * s_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(x * 2.0)) tmp = 0.0 if (c_m <= 9e-194) tmp = Float64(Float64(t_0 / Float64(c_m * Float64(s_m * Float64(x * Float64(c_m * s_m))))) / x); else tmp = Float64(Float64(Float64(t_0 / Float64(c_m * Float64(x * s_m))) / c_m) / Float64(x * s_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((x * 2.0));
tmp = 0.0;
if (c_m <= 9e-194)
tmp = (t_0 / (c_m * (s_m * (x * (c_m * s_m))))) / x;
else
tmp = ((t_0 / (c_m * (x * s_m))) / c_m) / (x * s_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[(x * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[c$95$m, 9e-194], N[(N[(t$95$0 / N[(c$95$m * N[(s$95$m * N[(x * N[(c$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(t$95$0 / N[(c$95$m * N[(x * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision] / N[(x * s$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])\\
\\
\begin{array}{l}
t_0 := \cos \left(x \cdot 2\right)\\
\mathbf{if}\;c\_m \leq 9 \cdot 10^{-194}:\\
\;\;\;\;\frac{\frac{t\_0}{c\_m \cdot \left(s\_m \cdot \left(x \cdot \left(c\_m \cdot s\_m\right)\right)\right)}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{t\_0}{c\_m \cdot \left(x \cdot s\_m\right)}}{c\_m}}{x \cdot s\_m}\\
\end{array}
\end{array}
if c < 8.9999999999999997e-194Initial program 65.2%
*-un-lft-identity65.2%
add-sqr-sqrt65.2%
times-frac65.2%
Applied egg-rr97.9%
associate-*l/97.9%
*-un-lft-identity97.9%
*-commutative97.9%
associate-*r*94.0%
associate-/r*89.7%
*-commutative89.7%
Applied egg-rr89.7%
*-un-lft-identity89.7%
associate-/l/89.0%
*-commutative89.0%
associate-*r*89.0%
*-commutative89.0%
associate-*r*89.0%
Applied egg-rr89.0%
*-lft-identity89.0%
*-commutative89.0%
*-commutative89.0%
associate-*r*90.8%
Simplified90.8%
if 8.9999999999999997e-194 < c Initial program 61.7%
*-un-lft-identity61.7%
add-sqr-sqrt61.7%
times-frac61.7%
Applied egg-rr97.9%
associate-*l/98.0%
*-un-lft-identity98.0%
associate-/r*95.6%
*-commutative95.6%
Applied egg-rr95.6%
Final simplification92.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
(let* ((t_0 (cos (* x 2.0))))
(if (<= c_m 1e-193)
(/ (/ (/ t_0 (* x (* c_m s_m))) (* c_m s_m)) x)
(/ (/ (/ t_0 (* c_m (* x s_m))) c_m) (* x s_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((x * 2.0));
double tmp;
if (c_m <= 1e-193) {
tmp = ((t_0 / (x * (c_m * s_m))) / (c_m * s_m)) / x;
} else {
tmp = ((t_0 / (c_m * (x * s_m))) / c_m) / (x * s_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((x * 2.0d0))
if (c_m <= 1d-193) then
tmp = ((t_0 / (x * (c_m * s_m))) / (c_m * s_m)) / x
else
tmp = ((t_0 / (c_m * (x * s_m))) / c_m) / (x * s_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((x * 2.0));
double tmp;
if (c_m <= 1e-193) {
tmp = ((t_0 / (x * (c_m * s_m))) / (c_m * s_m)) / x;
} else {
tmp = ((t_0 / (c_m * (x * s_m))) / c_m) / (x * s_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((x * 2.0)) tmp = 0 if c_m <= 1e-193: tmp = ((t_0 / (x * (c_m * s_m))) / (c_m * s_m)) / x else: tmp = ((t_0 / (c_m * (x * s_m))) / c_m) / (x * s_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(x * 2.0)) tmp = 0.0 if (c_m <= 1e-193) tmp = Float64(Float64(Float64(t_0 / Float64(x * Float64(c_m * s_m))) / Float64(c_m * s_m)) / x); else tmp = Float64(Float64(Float64(t_0 / Float64(c_m * Float64(x * s_m))) / c_m) / Float64(x * s_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((x * 2.0));
tmp = 0.0;
if (c_m <= 1e-193)
tmp = ((t_0 / (x * (c_m * s_m))) / (c_m * s_m)) / x;
else
tmp = ((t_0 / (c_m * (x * s_m))) / c_m) / (x * s_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[(x * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[c$95$m, 1e-193], N[(N[(N[(t$95$0 / N[(x * N[(c$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(c$95$m * s$95$m), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(t$95$0 / N[(c$95$m * N[(x * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision] / N[(x * s$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])\\
\\
\begin{array}{l}
t_0 := \cos \left(x \cdot 2\right)\\
\mathbf{if}\;c\_m \leq 10^{-193}:\\
\;\;\;\;\frac{\frac{\frac{t\_0}{x \cdot \left(c\_m \cdot s\_m\right)}}{c\_m \cdot s\_m}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{t\_0}{c\_m \cdot \left(x \cdot s\_m\right)}}{c\_m}}{x \cdot s\_m}\\
\end{array}
\end{array}
if c < 1e-193Initial program 65.2%
*-un-lft-identity65.2%
add-sqr-sqrt65.2%
times-frac65.2%
Applied egg-rr97.9%
associate-*l/97.9%
*-un-lft-identity97.9%
*-commutative97.9%
associate-*r*94.0%
associate-/r*89.7%
*-commutative89.7%
Applied egg-rr89.7%
Taylor expanded in x around inf 89.7%
*-commutative89.7%
associate-*r*91.5%
Simplified91.5%
if 1e-193 < c Initial program 61.7%
*-un-lft-identity61.7%
add-sqr-sqrt61.7%
times-frac61.7%
Applied egg-rr97.9%
associate-*l/98.0%
*-un-lft-identity98.0%
associate-/r*95.6%
*-commutative95.6%
Applied egg-rr95.6%
Final simplification93.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 (* s_m (* x c_m))) (/ (/ (cos (* x 2.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 / (s_m * (x * c_m))) * ((cos((x * 2.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 / (s_m * (x * c_m))) * ((cos((x * 2.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 / (s_m * (x * c_m))) * ((Math.cos((x * 2.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 / (s_m * (x * c_m))) * ((math.cos((x * 2.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(s_m * Float64(x * c_m))) * Float64(Float64(cos(Float64(x * 2.0)) / s_m) / Float64(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 / (s_m * (x * c_m))) * ((cos((x * 2.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[(s$95$m * N[(x * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / 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])\\
\\
\frac{1}{s\_m \cdot \left(x \cdot c\_m\right)} \cdot \frac{\frac{\cos \left(x \cdot 2\right)}{s\_m}}{x \cdot c\_m}
\end{array}
Initial program 63.7%
*-un-lft-identity63.7%
add-sqr-sqrt63.7%
times-frac63.7%
Applied egg-rr97.9%
*-un-lft-identity97.9%
associate-*r*95.8%
times-frac95.3%
*-commutative95.3%
Applied egg-rr95.3%
associate-*l/95.8%
*-lft-identity95.8%
Simplified95.8%
/-rgt-identity97.0%
associate-*r*96.5%
associate-/l*96.5%
Applied egg-rr97.4%
div-inv97.4%
*-commutative97.4%
inv-pow97.4%
pow-flip97.4%
metadata-eval97.4%
pow197.4%
Applied egg-rr97.4%
Final simplification97.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 (* x s_m))))
(if (<= c_m 5.5e-34)
(/ 1.0 (* x (* (* c_m s_m) t_0)))
(/ 1.0 (* (* c_m s_m) (* x 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 * (x * s_m);
double tmp;
if (c_m <= 5.5e-34) {
tmp = 1.0 / (x * ((c_m * s_m) * t_0));
} else {
tmp = 1.0 / ((c_m * s_m) * (x * t_0));
}
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 = c_m * (x * s_m)
if (c_m <= 5.5d-34) then
tmp = 1.0d0 / (x * ((c_m * s_m) * t_0))
else
tmp = 1.0d0 / ((c_m * s_m) * (x * t_0))
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 * (x * s_m);
double tmp;
if (c_m <= 5.5e-34) {
tmp = 1.0 / (x * ((c_m * s_m) * t_0));
} else {
tmp = 1.0 / ((c_m * s_m) * (x * t_0));
}
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 * (x * s_m) tmp = 0 if c_m <= 5.5e-34: tmp = 1.0 / (x * ((c_m * s_m) * t_0)) else: tmp = 1.0 / ((c_m * s_m) * (x * t_0)) 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(x * s_m)) tmp = 0.0 if (c_m <= 5.5e-34) tmp = Float64(1.0 / Float64(x * Float64(Float64(c_m * s_m) * t_0))); else tmp = Float64(1.0 / Float64(Float64(c_m * s_m) * Float64(x * t_0))); 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 * (x * s_m);
tmp = 0.0;
if (c_m <= 5.5e-34)
tmp = 1.0 / (x * ((c_m * s_m) * t_0));
else
tmp = 1.0 / ((c_m * s_m) * (x * t_0));
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[(x * s$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c$95$m, 5.5e-34], N[(1.0 / N[(x * N[(N[(c$95$m * s$95$m), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(c$95$m * s$95$m), $MachinePrecision] * N[(x * t$95$0), $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 := c\_m \cdot \left(x \cdot s\_m\right)\\
\mathbf{if}\;c\_m \leq 5.5 \cdot 10^{-34}:\\
\;\;\;\;\frac{1}{x \cdot \left(\left(c\_m \cdot s\_m\right) \cdot t\_0\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(c\_m \cdot s\_m\right) \cdot \left(x \cdot t\_0\right)}\\
\end{array}
\end{array}
if c < 5.50000000000000014e-34Initial program 65.8%
Taylor expanded in x around 0 53.8%
associate-/r*53.2%
*-commutative53.2%
unpow253.2%
unpow253.2%
swap-sqr64.3%
unpow264.3%
associate-/r*64.9%
unpow264.9%
unpow264.9%
swap-sqr78.9%
unpow278.9%
*-commutative78.9%
Simplified78.9%
unpow278.9%
*-commutative78.9%
associate-*r*76.7%
associate-*r*73.4%
Applied egg-rr73.4%
if 5.50000000000000014e-34 < c Initial program 59.0%
Taylor expanded in x around 0 48.8%
associate-/r*49.4%
*-commutative49.4%
unpow249.4%
unpow249.4%
swap-sqr61.8%
unpow261.8%
associate-/r*61.1%
unpow261.1%
unpow261.1%
swap-sqr80.7%
unpow280.7%
*-commutative80.7%
Simplified80.7%
unpow280.7%
associate-*r*78.4%
*-commutative78.4%
associate-*l*74.6%
Applied egg-rr74.6%
Final simplification73.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
(let* ((t_0 (* c_m (* x s_m))))
(if (<= c_m 8.2e-18)
(/ 1.0 (* x (* (* c_m s_m) t_0)))
(/ 1.0 (* s_m (* (* x c_m) 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 * (x * s_m);
double tmp;
if (c_m <= 8.2e-18) {
tmp = 1.0 / (x * ((c_m * s_m) * t_0));
} else {
tmp = 1.0 / (s_m * ((x * c_m) * t_0));
}
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 = c_m * (x * s_m)
if (c_m <= 8.2d-18) then
tmp = 1.0d0 / (x * ((c_m * s_m) * t_0))
else
tmp = 1.0d0 / (s_m * ((x * c_m) * t_0))
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 * (x * s_m);
double tmp;
if (c_m <= 8.2e-18) {
tmp = 1.0 / (x * ((c_m * s_m) * t_0));
} else {
tmp = 1.0 / (s_m * ((x * c_m) * t_0));
}
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 * (x * s_m) tmp = 0 if c_m <= 8.2e-18: tmp = 1.0 / (x * ((c_m * s_m) * t_0)) else: tmp = 1.0 / (s_m * ((x * c_m) * t_0)) 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(x * s_m)) tmp = 0.0 if (c_m <= 8.2e-18) tmp = Float64(1.0 / Float64(x * Float64(Float64(c_m * s_m) * t_0))); else tmp = Float64(1.0 / Float64(s_m * Float64(Float64(x * c_m) * t_0))); 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 * (x * s_m);
tmp = 0.0;
if (c_m <= 8.2e-18)
tmp = 1.0 / (x * ((c_m * s_m) * t_0));
else
tmp = 1.0 / (s_m * ((x * c_m) * t_0));
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[(x * s$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c$95$m, 8.2e-18], N[(1.0 / N[(x * N[(N[(c$95$m * s$95$m), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(s$95$m * N[(N[(x * c$95$m), $MachinePrecision] * t$95$0), $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 := c\_m \cdot \left(x \cdot s\_m\right)\\
\mathbf{if}\;c\_m \leq 8.2 \cdot 10^{-18}:\\
\;\;\;\;\frac{1}{x \cdot \left(\left(c\_m \cdot s\_m\right) \cdot t\_0\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{s\_m \cdot \left(\left(x \cdot c\_m\right) \cdot t\_0\right)}\\
\end{array}
\end{array}
if c < 8.1999999999999995e-18Initial program 66.7%
Taylor expanded in x around 0 54.2%
associate-/r*53.7%
*-commutative53.7%
unpow253.7%
unpow253.7%
swap-sqr64.4%
unpow264.4%
associate-/r*65.0%
unpow265.0%
unpow265.0%
swap-sqr78.6%
unpow278.6%
*-commutative78.6%
Simplified78.6%
unpow278.6%
*-commutative78.6%
associate-*r*76.5%
associate-*r*73.3%
Applied egg-rr73.3%
if 8.1999999999999995e-18 < c Initial program 56.2%
Taylor expanded in x around 0 47.5%
associate-/r*48.1%
*-commutative48.1%
unpow248.1%
unpow248.1%
swap-sqr61.3%
unpow261.3%
associate-/r*60.6%
unpow260.6%
unpow260.6%
swap-sqr81.5%
unpow281.5%
*-commutative81.5%
Simplified81.5%
*-commutative81.5%
*-commutative81.5%
*-commutative81.5%
unpow281.5%
associate-*r*81.4%
associate-*r*81.3%
Applied egg-rr81.3%
Final simplification75.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 (/ 1.0 (* (* c_m s_m) (* x (* c_m (* x s_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 * (c_m * (x * s_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 * (c_m * (x * s_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 * (c_m * (x * s_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 * (c_m * (x * s_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(c_m * s_m) * Float64(x * Float64(c_m * Float64(x * s_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 * (c_m * (x * s_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[(c$95$m * s$95$m), $MachinePrecision] * N[(x * N[(c$95$m * N[(x * s$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(c\_m \cdot s\_m\right) \cdot \left(x \cdot \left(c\_m \cdot \left(x \cdot s\_m\right)\right)\right)}
\end{array}
Initial program 63.7%
Taylor expanded in x around 0 52.3%
associate-/r*52.1%
*-commutative52.1%
unpow252.1%
unpow252.1%
swap-sqr63.5%
unpow263.5%
associate-/r*63.7%
unpow263.7%
unpow263.7%
swap-sqr79.4%
unpow279.4%
*-commutative79.4%
Simplified79.4%
unpow279.4%
associate-*r*77.2%
*-commutative77.2%
associate-*l*75.1%
Applied egg-rr75.1%
Final simplification75.1%
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 (* (* x s_m) (* c_m (* x s_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 * ((x * s_m) * (c_m * (x * s_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 * ((x * s_m) * (c_m * (x * s_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 * ((x * s_m) * (c_m * (x * s_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 * ((x * s_m) * (c_m * (x * s_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(c_m * Float64(Float64(x * s_m) * Float64(c_m * Float64(x * s_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 * ((x * s_m) * (c_m * (x * s_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[(c$95$m * N[(N[(x * s$95$m), $MachinePrecision] * N[(c$95$m * N[(x * s$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}{c\_m \cdot \left(\left(x \cdot s\_m\right) \cdot \left(c\_m \cdot \left(x \cdot s\_m\right)\right)\right)}
\end{array}
Initial program 63.7%
Taylor expanded in x around 0 52.3%
associate-/r*52.1%
*-commutative52.1%
unpow252.1%
unpow252.1%
swap-sqr63.5%
unpow263.5%
associate-/r*63.7%
unpow263.7%
unpow263.7%
swap-sqr79.4%
unpow279.4%
*-commutative79.4%
Simplified79.4%
*-commutative79.4%
*-commutative79.4%
*-commutative79.4%
unpow279.4%
*-commutative79.4%
associate-*r*77.3%
Applied egg-rr77.3%
Final simplification77.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 c_m) (* (* x s_m) (* c_m (* x s_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) / ((x * s_m) * (c_m * (x * s_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) / ((x * s_m) * (c_m * (x * s_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) / ((x * s_m) * (c_m * (x * s_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) / ((x * s_m) * (c_m * (x * s_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 / c_m) / Float64(Float64(x * s_m) * Float64(c_m * Float64(x * s_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) / ((x * s_m) * (c_m * (x * s_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 / c$95$m), $MachinePrecision] / N[(N[(x * s$95$m), $MachinePrecision] * N[(c$95$m * N[(x * s$95$m), $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(x \cdot s\_m\right) \cdot \left(c\_m \cdot \left(x \cdot s\_m\right)\right)}
\end{array}
Initial program 63.7%
*-un-lft-identity63.7%
add-sqr-sqrt63.7%
times-frac63.7%
Applied egg-rr97.9%
*-commutative97.9%
associate-/r*98.0%
frac-times94.0%
div-inv94.0%
*-commutative94.0%
Applied egg-rr94.0%
Taylor expanded in x around 0 77.6%
Final simplification77.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 (let* ((t_0 (* c_m (* x s_m)))) (/ (/ 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 * (x * s_m);
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 * (x * s_m)
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 * (x * s_m);
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 * (x * s_m) 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(x * s_m)) return Float64(Float64(1.0 / 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 * (x * s_m);
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[(x * s$95$m), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 / 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(x \cdot s\_m\right)\\
\frac{\frac{1}{t\_0}}{t\_0}
\end{array}
\end{array}
Initial program 63.7%
Taylor expanded in x around 0 52.3%
associate-/r*52.1%
*-commutative52.1%
unpow252.1%
unpow252.1%
swap-sqr63.5%
unpow263.5%
associate-/r*63.7%
unpow263.7%
unpow263.7%
swap-sqr79.4%
unpow279.4%
*-commutative79.4%
Simplified79.4%
pow-flip79.8%
*-commutative79.8%
pow-flip79.4%
unpow279.4%
associate-/r*79.8%
un-div-inv79.7%
Applied egg-rr79.7%
un-div-inv79.8%
Applied egg-rr79.8%
Final simplification79.8%
herbie shell --seed 2024035
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))