
(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}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* s (* x c))))
(if (<= x 7.3e-50)
(pow (* c (* x s)) -2.0)
(/ (/ (cos (* x 2.0)) t_0) t_0))))x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = s * (x * c);
double tmp;
if (x <= 7.3e-50) {
tmp = pow((c * (x * s)), -2.0);
} else {
tmp = (cos((x * 2.0)) / t_0) / t_0;
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
real(8) :: tmp
t_0 = s * (x * c)
if (x <= 7.3d-50) then
tmp = (c * (x * s)) ** (-2.0d0)
else
tmp = (cos((x * 2.0d0)) / t_0) / t_0
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = s * (x * c);
double tmp;
if (x <= 7.3e-50) {
tmp = Math.pow((c * (x * s)), -2.0);
} else {
tmp = (Math.cos((x * 2.0)) / t_0) / t_0;
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = s * (x * c) tmp = 0 if x <= 7.3e-50: tmp = math.pow((c * (x * s)), -2.0) else: tmp = (math.cos((x * 2.0)) / t_0) / t_0 return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(s * Float64(x * c)) tmp = 0.0 if (x <= 7.3e-50) tmp = Float64(c * Float64(x * s)) ^ -2.0; else tmp = Float64(Float64(cos(Float64(x * 2.0)) / t_0) / t_0); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
t_0 = s * (x * c);
tmp = 0.0;
if (x <= 7.3e-50)
tmp = (c * (x * s)) ^ -2.0;
else
tmp = (cos((x * 2.0)) / t_0) / t_0;
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 7.3e-50], N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], N[(N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := s \cdot \left(x \cdot c\right)\\
\mathbf{if}\;x \leq 7.3 \cdot 10^{-50}:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cos \left(x \cdot 2\right)}{t_0}}{t_0}\\
\end{array}
\end{array}
if x < 7.30000000000000035e-50Initial program 67.0%
*-commutative67.0%
associate-*l*61.8%
associate-*r*62.2%
*-commutative62.2%
unpow262.2%
associate-*r*66.1%
associate-*r*67.9%
*-commutative67.9%
unpow267.9%
Simplified67.9%
add-cube-cbrt67.9%
times-frac68.0%
associate-*r*66.6%
swap-sqr85.3%
associate-*r*94.0%
*-commutative94.0%
times-frac93.4%
associate-*l*95.9%
add-cube-cbrt96.1%
associate-/r*96.7%
Applied egg-rr96.6%
un-div-inv96.7%
Applied egg-rr96.7%
Taylor expanded in x around 0 59.3%
unpow259.3%
associate-*r*59.3%
*-commutative59.3%
associate-*r*59.1%
associate-/r*59.1%
*-commutative59.1%
unpow259.1%
unpow259.1%
swap-sqr68.8%
unpow268.8%
associate-/r*68.8%
unpow268.8%
swap-sqr82.7%
associate-/r*82.7%
*-rgt-identity82.7%
associate-*r/82.7%
unpow282.7%
Simplified83.9%
if 7.30000000000000035e-50 < x Initial program 54.8%
*-commutative54.8%
associate-*l*51.5%
associate-*r*53.0%
*-commutative53.0%
unpow253.0%
associate-*r*59.2%
associate-*r*60.9%
*-commutative60.9%
unpow260.9%
Simplified60.9%
add-cube-cbrt60.9%
times-frac60.8%
associate-*r*60.9%
swap-sqr79.8%
associate-*r*89.7%
*-commutative89.7%
times-frac89.7%
associate-*l*97.9%
add-cube-cbrt98.3%
associate-/r*98.2%
Applied egg-rr98.1%
un-div-inv98.2%
Applied egg-rr98.2%
Final simplification87.7%
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
:precision binary64
(let* ((t_0 (cos (* x 2.0))))
(if (<= x 1.2e-8)
(pow (* c (* x s)) -2.0)
(if (<= x 1.45e+150)
(/ t_0 (* x (* x (* (* c s) (* c s)))))
(/ t_0 (* x (* (* c (* x c)) (* s s))))))))x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = cos((x * 2.0));
double tmp;
if (x <= 1.2e-8) {
tmp = pow((c * (x * s)), -2.0);
} else if (x <= 1.45e+150) {
tmp = t_0 / (x * (x * ((c * s) * (c * s))));
} else {
tmp = t_0 / (x * ((c * (x * c)) * (s * s)));
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
real(8) :: tmp
t_0 = cos((x * 2.0d0))
if (x <= 1.2d-8) then
tmp = (c * (x * s)) ** (-2.0d0)
else if (x <= 1.45d+150) then
tmp = t_0 / (x * (x * ((c * s) * (c * s))))
else
tmp = t_0 / (x * ((c * (x * c)) * (s * s)))
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = Math.cos((x * 2.0));
double tmp;
if (x <= 1.2e-8) {
tmp = Math.pow((c * (x * s)), -2.0);
} else if (x <= 1.45e+150) {
tmp = t_0 / (x * (x * ((c * s) * (c * s))));
} else {
tmp = t_0 / (x * ((c * (x * c)) * (s * s)));
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = math.cos((x * 2.0)) tmp = 0 if x <= 1.2e-8: tmp = math.pow((c * (x * s)), -2.0) elif x <= 1.45e+150: tmp = t_0 / (x * (x * ((c * s) * (c * s)))) else: tmp = t_0 / (x * ((c * (x * c)) * (s * s))) return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = cos(Float64(x * 2.0)) tmp = 0.0 if (x <= 1.2e-8) tmp = Float64(c * Float64(x * s)) ^ -2.0; elseif (x <= 1.45e+150) tmp = Float64(t_0 / Float64(x * Float64(x * Float64(Float64(c * s) * Float64(c * s))))); else tmp = Float64(t_0 / Float64(x * Float64(Float64(c * Float64(x * c)) * Float64(s * s)))); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
t_0 = cos((x * 2.0));
tmp = 0.0;
if (x <= 1.2e-8)
tmp = (c * (x * s)) ^ -2.0;
elseif (x <= 1.45e+150)
tmp = t_0 / (x * (x * ((c * s) * (c * s))));
else
tmp = t_0 / (x * ((c * (x * c)) * (s * s)));
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 1.2e-8], N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], If[LessEqual[x, 1.45e+150], N[(t$95$0 / N[(x * N[(x * N[(N[(c * s), $MachinePrecision] * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(x * N[(N[(c * N[(x * c), $MachinePrecision]), $MachinePrecision] * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := \cos \left(x \cdot 2\right)\\
\mathbf{if}\;x \leq 1.2 \cdot 10^{-8}:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{+150}:\\
\;\;\;\;\frac{t_0}{x \cdot \left(x \cdot \left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{x \cdot \left(\left(c \cdot \left(x \cdot c\right)\right) \cdot \left(s \cdot s\right)\right)}\\
\end{array}
\end{array}
if x < 1.19999999999999999e-8Initial program 67.4%
*-commutative67.4%
associate-*l*62.3%
associate-*r*62.6%
*-commutative62.6%
unpow262.6%
associate-*r*66.5%
associate-*r*68.3%
*-commutative68.3%
unpow268.3%
Simplified68.3%
add-cube-cbrt68.3%
times-frac68.3%
associate-*r*67.0%
swap-sqr85.2%
associate-*r*94.1%
*-commutative94.1%
times-frac93.6%
associate-*l*96.0%
add-cube-cbrt96.2%
associate-/r*96.7%
Applied egg-rr96.7%
un-div-inv96.7%
Applied egg-rr96.7%
Taylor expanded in x around 0 59.8%
unpow259.8%
associate-*r*59.9%
*-commutative59.9%
associate-*r*59.7%
associate-/r*59.6%
*-commutative59.6%
unpow259.6%
unpow259.6%
swap-sqr69.1%
unpow269.1%
associate-/r*69.1%
unpow269.1%
swap-sqr83.1%
associate-/r*83.1%
*-rgt-identity83.1%
associate-*r/83.1%
unpow283.1%
Simplified84.3%
if 1.19999999999999999e-8 < x < 1.45000000000000005e150Initial program 48.0%
associate-*r*51.4%
*-commutative51.4%
associate-*r*51.4%
unpow251.4%
unpow251.4%
Simplified51.4%
Taylor expanded in c around 0 51.4%
unpow251.4%
associate-*l*57.9%
Simplified57.9%
Taylor expanded in c around 0 51.4%
associate-*r*51.4%
*-commutative51.4%
*-commutative51.4%
*-commutative51.4%
unpow251.4%
unpow251.4%
unswap-sqr90.1%
Simplified90.1%
if 1.45000000000000005e150 < x Initial program 57.3%
associate-*r*60.2%
*-commutative60.2%
associate-*r*60.3%
unpow260.3%
unpow260.3%
Simplified60.3%
Taylor expanded in c around 0 60.3%
unpow260.3%
associate-*l*69.6%
Simplified69.6%
Final simplification83.2%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (if (<= s 4.95e+33) (/ (cos (* x 2.0)) (* s (* (* x x) (* s (* c c))))) (pow (* c (* x s)) -2.0)))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (s <= 4.95e+33) {
tmp = cos((x * 2.0)) / (s * ((x * x) * (s * (c * c))));
} else {
tmp = pow((c * (x * s)), -2.0);
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: tmp
if (s <= 4.95d+33) then
tmp = cos((x * 2.0d0)) / (s * ((x * x) * (s * (c * c))))
else
tmp = (c * (x * s)) ** (-2.0d0)
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double tmp;
if (s <= 4.95e+33) {
tmp = Math.cos((x * 2.0)) / (s * ((x * x) * (s * (c * c))));
} else {
tmp = Math.pow((c * (x * s)), -2.0);
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): tmp = 0 if s <= 4.95e+33: tmp = math.cos((x * 2.0)) / (s * ((x * x) * (s * (c * c)))) else: tmp = math.pow((c * (x * s)), -2.0) return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) tmp = 0.0 if (s <= 4.95e+33) tmp = Float64(cos(Float64(x * 2.0)) / Float64(s * Float64(Float64(x * x) * Float64(s * Float64(c * c))))); else tmp = Float64(c * Float64(x * s)) ^ -2.0; end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
tmp = 0.0;
if (s <= 4.95e+33)
tmp = cos((x * 2.0)) / (s * ((x * x) * (s * (c * c))));
else
tmp = (c * (x * s)) ^ -2.0;
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := If[LessEqual[s, 4.95e+33], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(s * N[(N[(x * x), $MachinePrecision] * N[(s * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;s \leq 4.95 \cdot 10^{+33}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \left(s \cdot \left(c \cdot c\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\end{array}
\end{array}
if s < 4.94999999999999993e33Initial program 63.1%
*-commutative63.1%
associate-*l*59.1%
associate-*r*59.6%
*-commutative59.6%
unpow259.6%
associate-*r*65.3%
associate-*r*66.9%
*-commutative66.9%
unpow266.9%
Simplified66.9%
if 4.94999999999999993e33 < s Initial program 66.6%
*-commutative66.6%
associate-*l*59.0%
associate-*r*60.2%
*-commutative60.2%
unpow260.2%
associate-*r*60.6%
associate-*r*63.2%
*-commutative63.2%
unpow263.2%
Simplified63.2%
add-cube-cbrt63.2%
times-frac63.3%
associate-*r*61.6%
swap-sqr84.5%
associate-*r*94.3%
*-commutative94.3%
times-frac94.3%
associate-*l*96.0%
add-cube-cbrt96.2%
associate-/r*96.2%
Applied egg-rr96.0%
un-div-inv96.2%
Applied egg-rr96.2%
Taylor expanded in x around 0 59.0%
unpow259.0%
associate-*r*59.1%
*-commutative59.1%
associate-*r*58.2%
associate-/r*58.1%
*-commutative58.1%
unpow258.1%
unpow258.1%
swap-sqr68.6%
unpow268.6%
associate-/r*68.6%
unpow268.6%
swap-sqr82.4%
associate-/r*82.5%
*-rgt-identity82.5%
associate-*r/82.4%
unpow282.4%
Simplified85.5%
Final simplification70.7%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (if (<= x 4.2e-9) (pow (* c (* x s)) -2.0) (/ (cos (* x 2.0)) (* x (* x (* (* c s) (* c s)))))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (x <= 4.2e-9) {
tmp = pow((c * (x * s)), -2.0);
} else {
tmp = cos((x * 2.0)) / (x * (x * ((c * s) * (c * s))));
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: tmp
if (x <= 4.2d-9) then
tmp = (c * (x * s)) ** (-2.0d0)
else
tmp = cos((x * 2.0d0)) / (x * (x * ((c * s) * (c * s))))
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double tmp;
if (x <= 4.2e-9) {
tmp = Math.pow((c * (x * s)), -2.0);
} else {
tmp = Math.cos((x * 2.0)) / (x * (x * ((c * s) * (c * s))));
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): tmp = 0 if x <= 4.2e-9: tmp = math.pow((c * (x * s)), -2.0) else: tmp = math.cos((x * 2.0)) / (x * (x * ((c * s) * (c * s)))) return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) tmp = 0.0 if (x <= 4.2e-9) tmp = Float64(c * Float64(x * s)) ^ -2.0; else tmp = Float64(cos(Float64(x * 2.0)) / Float64(x * Float64(x * Float64(Float64(c * s) * Float64(c * s))))); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
tmp = 0.0;
if (x <= 4.2e-9)
tmp = (c * (x * s)) ^ -2.0;
else
tmp = cos((x * 2.0)) / (x * (x * ((c * s) * (c * s))));
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := If[LessEqual[x, 4.2e-9], N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(x * N[(x * N[(N[(c * s), $MachinePrecision] * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.2 \cdot 10^{-9}:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{x \cdot \left(x \cdot \left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right)\right)}\\
\end{array}
\end{array}
if x < 4.20000000000000039e-9Initial program 67.4%
*-commutative67.4%
associate-*l*62.3%
associate-*r*62.6%
*-commutative62.6%
unpow262.6%
associate-*r*66.5%
associate-*r*68.3%
*-commutative68.3%
unpow268.3%
Simplified68.3%
add-cube-cbrt68.3%
times-frac68.3%
associate-*r*67.0%
swap-sqr85.2%
associate-*r*94.1%
*-commutative94.1%
times-frac93.6%
associate-*l*96.0%
add-cube-cbrt96.2%
associate-/r*96.7%
Applied egg-rr96.7%
un-div-inv96.7%
Applied egg-rr96.7%
Taylor expanded in x around 0 59.8%
unpow259.8%
associate-*r*59.9%
*-commutative59.9%
associate-*r*59.7%
associate-/r*59.6%
*-commutative59.6%
unpow259.6%
unpow259.6%
swap-sqr69.1%
unpow269.1%
associate-/r*69.1%
unpow269.1%
swap-sqr83.1%
associate-/r*83.1%
*-rgt-identity83.1%
associate-*r/83.1%
unpow283.1%
Simplified84.3%
if 4.20000000000000039e-9 < x Initial program 52.8%
associate-*r*55.9%
*-commutative55.9%
associate-*r*56.0%
unpow256.0%
unpow256.0%
Simplified56.0%
Taylor expanded in c around 0 56.0%
unpow256.0%
associate-*l*64.0%
Simplified64.0%
Taylor expanded in c around 0 56.0%
associate-*r*54.4%
*-commutative54.4%
*-commutative54.4%
*-commutative54.4%
unpow254.4%
unpow254.4%
unswap-sqr82.7%
Simplified82.7%
Final simplification83.9%
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* c (* x s))))
(if (<= x 1.02e-50)
(pow t_0 -2.0)
(/ (cos (* x 2.0)) (* t_0 (* s (* x c)))))))x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = c * (x * s);
double tmp;
if (x <= 1.02e-50) {
tmp = pow(t_0, -2.0);
} else {
tmp = cos((x * 2.0)) / (t_0 * (s * (x * c)));
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
real(8) :: tmp
t_0 = c * (x * s)
if (x <= 1.02d-50) then
tmp = t_0 ** (-2.0d0)
else
tmp = cos((x * 2.0d0)) / (t_0 * (s * (x * c)))
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = c * (x * s);
double tmp;
if (x <= 1.02e-50) {
tmp = Math.pow(t_0, -2.0);
} else {
tmp = Math.cos((x * 2.0)) / (t_0 * (s * (x * c)));
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = c * (x * s) tmp = 0 if x <= 1.02e-50: tmp = math.pow(t_0, -2.0) else: tmp = math.cos((x * 2.0)) / (t_0 * (s * (x * c))) return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(c * Float64(x * s)) tmp = 0.0 if (x <= 1.02e-50) tmp = t_0 ^ -2.0; else tmp = Float64(cos(Float64(x * 2.0)) / Float64(t_0 * Float64(s * Float64(x * c)))); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
t_0 = c * (x * s);
tmp = 0.0;
if (x <= 1.02e-50)
tmp = t_0 ^ -2.0;
else
tmp = cos((x * 2.0)) / (t_0 * (s * (x * c)));
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.02e-50], N[Power[t$95$0, -2.0], $MachinePrecision], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 * N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
\mathbf{if}\;x \leq 1.02 \cdot 10^{-50}:\\
\;\;\;\;{t_0}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{t_0 \cdot \left(s \cdot \left(x \cdot c\right)\right)}\\
\end{array}
\end{array}
if x < 1.0199999999999999e-50Initial program 67.0%
*-commutative67.0%
associate-*l*61.8%
associate-*r*62.2%
*-commutative62.2%
unpow262.2%
associate-*r*66.1%
associate-*r*67.9%
*-commutative67.9%
unpow267.9%
Simplified67.9%
add-cube-cbrt67.9%
times-frac68.0%
associate-*r*66.6%
swap-sqr85.3%
associate-*r*94.0%
*-commutative94.0%
times-frac93.4%
associate-*l*95.9%
add-cube-cbrt96.1%
associate-/r*96.7%
Applied egg-rr96.6%
un-div-inv96.7%
Applied egg-rr96.7%
Taylor expanded in x around 0 59.3%
unpow259.3%
associate-*r*59.3%
*-commutative59.3%
associate-*r*59.1%
associate-/r*59.1%
*-commutative59.1%
unpow259.1%
unpow259.1%
swap-sqr68.8%
unpow268.8%
associate-/r*68.8%
unpow268.8%
swap-sqr82.7%
associate-/r*82.7%
*-rgt-identity82.7%
associate-*r/82.7%
unpow282.7%
Simplified83.9%
if 1.0199999999999999e-50 < x Initial program 54.8%
*-commutative54.8%
associate-*r*51.5%
associate-*r*53.1%
unpow253.1%
unswap-sqr66.6%
unpow266.6%
swap-sqr98.3%
*-commutative98.3%
*-commutative98.3%
*-commutative98.3%
*-commutative98.3%
Simplified98.3%
Taylor expanded in s around 0 94.1%
Final simplification86.6%
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* s (* x c))))
(if (<= x 1.1e-50)
(pow (* c (* x s)) -2.0)
(/ (cos (* x 2.0)) (* t_0 t_0)))))x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = s * (x * c);
double tmp;
if (x <= 1.1e-50) {
tmp = pow((c * (x * s)), -2.0);
} else {
tmp = cos((x * 2.0)) / (t_0 * t_0);
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
real(8) :: tmp
t_0 = s * (x * c)
if (x <= 1.1d-50) then
tmp = (c * (x * s)) ** (-2.0d0)
else
tmp = cos((x * 2.0d0)) / (t_0 * t_0)
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = s * (x * c);
double tmp;
if (x <= 1.1e-50) {
tmp = Math.pow((c * (x * s)), -2.0);
} else {
tmp = Math.cos((x * 2.0)) / (t_0 * t_0);
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = s * (x * c) tmp = 0 if x <= 1.1e-50: tmp = math.pow((c * (x * s)), -2.0) else: tmp = math.cos((x * 2.0)) / (t_0 * t_0) return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(s * Float64(x * c)) tmp = 0.0 if (x <= 1.1e-50) tmp = Float64(c * Float64(x * s)) ^ -2.0; else tmp = Float64(cos(Float64(x * 2.0)) / Float64(t_0 * t_0)); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
t_0 = s * (x * c);
tmp = 0.0;
if (x <= 1.1e-50)
tmp = (c * (x * s)) ^ -2.0;
else
tmp = cos((x * 2.0)) / (t_0 * t_0);
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.1e-50], N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := s \cdot \left(x \cdot c\right)\\
\mathbf{if}\;x \leq 1.1 \cdot 10^{-50}:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{t_0 \cdot t_0}\\
\end{array}
\end{array}
if x < 1.0999999999999999e-50Initial program 67.0%
*-commutative67.0%
associate-*l*61.8%
associate-*r*62.2%
*-commutative62.2%
unpow262.2%
associate-*r*66.1%
associate-*r*67.9%
*-commutative67.9%
unpow267.9%
Simplified67.9%
add-cube-cbrt67.9%
times-frac68.0%
associate-*r*66.6%
swap-sqr85.3%
associate-*r*94.0%
*-commutative94.0%
times-frac93.4%
associate-*l*95.9%
add-cube-cbrt96.1%
associate-/r*96.7%
Applied egg-rr96.6%
un-div-inv96.7%
Applied egg-rr96.7%
Taylor expanded in x around 0 59.3%
unpow259.3%
associate-*r*59.3%
*-commutative59.3%
associate-*r*59.1%
associate-/r*59.1%
*-commutative59.1%
unpow259.1%
unpow259.1%
swap-sqr68.8%
unpow268.8%
associate-/r*68.8%
unpow268.8%
swap-sqr82.7%
associate-/r*82.7%
*-rgt-identity82.7%
associate-*r/82.7%
unpow282.7%
Simplified83.9%
if 1.0999999999999999e-50 < x Initial program 54.8%
*-commutative54.8%
associate-*r*51.5%
associate-*r*53.1%
unpow253.1%
unswap-sqr66.6%
unpow266.6%
swap-sqr98.3%
*-commutative98.3%
*-commutative98.3%
*-commutative98.3%
*-commutative98.3%
Simplified98.3%
Final simplification87.7%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (pow (* c (* x s)) -2.0))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return pow((c * (x * s)), -2.0);
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = (c * (x * s)) ** (-2.0d0)
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return Math.pow((c * (x * s)), -2.0);
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return math.pow((c * (x * s)), -2.0)
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(c * Float64(x * s)) ^ -2.0 end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = (c * (x * s)) ^ -2.0;
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}
\end{array}
Initial program 63.8%
*-commutative63.8%
associate-*l*59.1%
associate-*r*59.8%
*-commutative59.8%
unpow259.8%
associate-*r*64.3%
associate-*r*66.1%
*-commutative66.1%
unpow266.1%
Simplified66.1%
add-cube-cbrt66.1%
times-frac66.1%
associate-*r*65.1%
swap-sqr83.8%
associate-*r*92.9%
*-commutative92.9%
times-frac92.5%
associate-*l*96.4%
add-cube-cbrt96.7%
associate-/r*97.1%
Applied egg-rr97.0%
un-div-inv97.1%
Applied egg-rr97.1%
Taylor expanded in x around 0 56.1%
unpow256.1%
associate-*r*56.2%
*-commutative56.2%
associate-*r*56.1%
associate-/r*56.0%
*-commutative56.0%
unpow256.0%
unpow256.0%
swap-sqr64.3%
unpow264.3%
associate-/r*64.3%
unpow264.3%
swap-sqr76.6%
associate-/r*76.7%
*-rgt-identity76.7%
associate-*r/76.6%
unpow276.6%
Simplified77.4%
Final simplification77.4%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (let* ((t_0 (/ 1.0 (* x (* c s))))) (* t_0 t_0)))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = 1.0 / (x * (c * s));
return t_0 * t_0;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
t_0 = 1.0d0 / (x * (c * s))
code = t_0 * t_0
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = 1.0 / (x * (c * s));
return t_0 * t_0;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = 1.0 / (x * (c * s)) return t_0 * t_0
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(1.0 / Float64(x * Float64(c * s))) return Float64(t_0 * t_0) end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
t_0 = 1.0 / (x * (c * s));
tmp = t_0 * t_0;
end
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(1.0 / N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * t$95$0), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := \frac{1}{x \cdot \left(c \cdot s\right)}\\
t_0 \cdot t_0
\end{array}
\end{array}
Initial program 63.8%
*-commutative63.8%
associate-*l*59.1%
associate-*r*59.8%
*-commutative59.8%
unpow259.8%
associate-*r*64.3%
associate-*r*66.1%
*-commutative66.1%
unpow266.1%
Simplified66.1%
Taylor expanded in x around 0 56.1%
unpow256.1%
associate-/r*56.0%
unpow256.0%
*-commutative56.0%
unpow256.0%
swap-sqr64.3%
unpow264.3%
associate-/r*64.3%
unpow264.3%
swap-sqr76.6%
unpow276.6%
associate-*r*77.3%
*-commutative77.3%
Simplified77.3%
associate-*r*77.2%
unpow-prod-down68.0%
pow268.0%
Applied egg-rr68.0%
add-sqr-sqrt68.0%
sqrt-div68.0%
metadata-eval68.0%
*-commutative68.0%
sqrt-prod68.0%
sqrt-prod29.7%
add-sqr-sqrt48.4%
unpow248.4%
sqrt-prod28.7%
add-sqr-sqrt53.3%
*-commutative53.3%
sqrt-div53.3%
metadata-eval53.3%
*-commutative53.3%
sqrt-prod53.2%
sqrt-prod27.6%
add-sqr-sqrt59.0%
unpow259.0%
sqrt-prod43.1%
Applied egg-rr77.2%
Final simplification77.2%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (let* ((t_0 (/ (/ 1.0 c) (* x s)))) (* t_0 t_0)))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = (1.0 / c) / (x * s);
return t_0 * t_0;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
t_0 = (1.0d0 / c) / (x * s)
code = t_0 * t_0
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = (1.0 / c) / (x * s);
return t_0 * t_0;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = (1.0 / c) / (x * s) return t_0 * t_0
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(Float64(1.0 / c) / Float64(x * s)) return Float64(t_0 * t_0) end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
t_0 = (1.0 / c) / (x * s);
tmp = t_0 * t_0;
end
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(N[(1.0 / c), $MachinePrecision] / N[(x * s), $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * t$95$0), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{1}{c}}{x \cdot s}\\
t_0 \cdot t_0
\end{array}
\end{array}
Initial program 63.8%
associate-/r*63.9%
unpow263.9%
*-commutative63.9%
unpow263.9%
Simplified63.9%
Taylor expanded in x around 0 59.0%
unpow259.0%
Simplified59.0%
Taylor expanded in x around 0 59.0%
unpow259.0%
associate-*l*63.1%
Simplified63.1%
inv-pow63.1%
pow-prod-down63.5%
inv-pow63.5%
inv-pow63.5%
Applied egg-rr63.5%
add-sqr-sqrt63.4%
sqrt-div63.5%
sqrt-prod29.5%
add-sqr-sqrt47.9%
associate-*r*47.9%
*-commutative47.9%
sqrt-prod27.5%
add-sqr-sqrt50.2%
*-commutative50.2%
sqrt-div50.2%
sqrt-prod24.2%
add-sqr-sqrt50.1%
associate-*r*51.8%
*-commutative51.8%
sqrt-prod37.8%
add-sqr-sqrt77.4%
*-commutative77.4%
Applied egg-rr77.4%
Final simplification77.4%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ 1.0 (* (* c (* x s)) (* s (* x c)))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return 1.0 / ((c * (x * s)) * (s * (x * c)));
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = 1.0d0 / ((c * (x * s)) * (s * (x * c)))
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return 1.0 / ((c * (x * s)) * (s * (x * c)));
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return 1.0 / ((c * (x * s)) * (s * (x * c)))
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(1.0 / Float64(Float64(c * Float64(x * s)) * Float64(s * Float64(x * c)))) end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = 1.0 / ((c * (x * s)) * (s * (x * c)));
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[(1.0 / N[(N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision] * N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{\left(c \cdot \left(x \cdot s\right)\right) \cdot \left(s \cdot \left(x \cdot c\right)\right)}
\end{array}
Initial program 63.8%
*-commutative63.8%
associate-*l*59.1%
associate-*r*59.8%
*-commutative59.8%
unpow259.8%
associate-*r*64.3%
associate-*r*66.1%
*-commutative66.1%
unpow266.1%
Simplified66.1%
Taylor expanded in x around 0 56.1%
unpow256.1%
associate-/r*56.0%
unpow256.0%
*-commutative56.0%
unpow256.0%
swap-sqr64.3%
unpow264.3%
associate-/r*64.3%
unpow264.3%
swap-sqr76.6%
unpow276.6%
associate-*r*77.3%
*-commutative77.3%
Simplified77.3%
*-commutative77.3%
associate-*r*76.6%
pow276.6%
Applied egg-rr76.6%
Taylor expanded in s around 0 75.5%
Final simplification75.5%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (let* ((t_0 (* s (* x c)))) (/ 1.0 (* t_0 t_0))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = s * (x * c);
return 1.0 / (t_0 * t_0);
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
t_0 = s * (x * c)
code = 1.0d0 / (t_0 * t_0)
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = s * (x * c);
return 1.0 / (t_0 * t_0);
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = s * (x * c) return 1.0 / (t_0 * t_0)
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(s * Float64(x * c)) return Float64(1.0 / Float64(t_0 * t_0)) end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
t_0 = s * (x * c);
tmp = 1.0 / (t_0 * t_0);
end
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]}, N[(1.0 / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := s \cdot \left(x \cdot c\right)\\
\frac{1}{t_0 \cdot t_0}
\end{array}
\end{array}
Initial program 63.8%
*-commutative63.8%
associate-*l*59.1%
associate-*r*59.8%
*-commutative59.8%
unpow259.8%
associate-*r*64.3%
associate-*r*66.1%
*-commutative66.1%
unpow266.1%
Simplified66.1%
Taylor expanded in x around 0 56.1%
unpow256.1%
associate-/r*56.0%
unpow256.0%
*-commutative56.0%
unpow256.0%
swap-sqr64.3%
unpow264.3%
associate-/r*64.3%
unpow264.3%
swap-sqr76.6%
unpow276.6%
associate-*r*77.3%
*-commutative77.3%
Simplified77.3%
*-commutative77.3%
associate-*r*76.6%
pow276.6%
Applied egg-rr76.6%
Final simplification76.6%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (let* ((t_0 (* s (* x c)))) (/ (/ 1.0 t_0) t_0)))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = s * (x * c);
return (1.0 / t_0) / t_0;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
t_0 = s * (x * c)
code = (1.0d0 / t_0) / t_0
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = s * (x * c);
return (1.0 / t_0) / t_0;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = s * (x * c) return (1.0 / t_0) / t_0
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(s * Float64(x * c)) return Float64(Float64(1.0 / t_0) / t_0) end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
t_0 = s * (x * c);
tmp = (1.0 / t_0) / t_0;
end
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := s \cdot \left(x \cdot c\right)\\
\frac{\frac{1}{t_0}}{t_0}
\end{array}
\end{array}
Initial program 63.8%
*-commutative63.8%
associate-*l*59.1%
associate-*r*59.8%
*-commutative59.8%
unpow259.8%
associate-*r*64.3%
associate-*r*66.1%
*-commutative66.1%
unpow266.1%
Simplified66.1%
add-cube-cbrt66.1%
times-frac66.1%
associate-*r*65.1%
swap-sqr83.8%
associate-*r*92.9%
*-commutative92.9%
times-frac92.5%
associate-*l*96.4%
add-cube-cbrt96.7%
associate-/r*97.1%
Applied egg-rr97.0%
un-div-inv97.1%
Applied egg-rr97.1%
Taylor expanded in x around 0 76.7%
Final simplification76.7%
herbie shell --seed 2023252
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))