
(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 14 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 1.56e-41)
(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.56e-41) {
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.56d-41) 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.56e-41) {
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.56e-41: 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.56e-41) 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 <= 1.56e-41)
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.56e-41], 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 1.56 \cdot 10^{-41}:\\
\;\;\;\;{\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 < 1.5600000000000001e-41Initial program 64.1%
*-commutative64.1%
associate-*r*57.3%
associate-*r*57.4%
unpow257.4%
unswap-sqr75.7%
unpow275.7%
swap-sqr95.6%
*-commutative95.6%
*-commutative95.6%
*-commutative95.6%
*-commutative95.6%
Simplified95.6%
associate-/r*95.9%
div-inv95.9%
*-commutative95.9%
Applied egg-rr95.9%
un-div-inv95.9%
*-commutative95.9%
*-commutative95.9%
Applied egg-rr95.9%
Taylor expanded in x around 0 52.2%
associate-/r*52.2%
unpow-152.2%
unpow-152.2%
unpow252.2%
associate-/r*52.9%
*-rgt-identity52.9%
associate-*r/52.8%
unpow252.8%
unpow252.8%
swap-sqr68.3%
times-frac84.2%
associate-/r*84.2%
unpow-184.2%
associate-/r*84.2%
unpow-184.2%
pow-sqr84.2%
metadata-eval84.2%
Simplified84.2%
if 1.5600000000000001e-41 < x Initial program 75.7%
*-commutative75.7%
associate-*r*73.0%
associate-*r*72.9%
unpow272.9%
unswap-sqr83.3%
unpow283.3%
swap-sqr99.6%
*-commutative99.6%
*-commutative99.6%
*-commutative99.6%
*-commutative99.6%
Simplified99.6%
associate-/r*99.6%
div-inv99.6%
*-commutative99.6%
Applied egg-rr99.6%
un-div-inv99.6%
*-commutative99.6%
*-commutative99.6%
Applied egg-rr99.6%
Final simplification88.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 (* (pow (* c (* x s)) -2.0) (cos (* x 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) * cos((x * 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)) * cos((x * 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) * Math.cos((x * 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) * math.cos((x * 2.0))
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64((Float64(c * Float64(x * s)) ^ -2.0) * cos(Float64(x * 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) * cos((x * 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[(N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] * N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision]), $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} \cdot \cos \left(x \cdot 2\right)
\end{array}
Initial program 67.6%
*-commutative67.6%
associate-*r*62.0%
associate-*r*62.1%
unpow262.1%
unswap-sqr77.9%
unpow277.9%
swap-sqr96.8%
*-commutative96.8%
*-commutative96.8%
*-commutative96.8%
*-commutative96.8%
Simplified96.8%
Taylor expanded in x around inf 62.0%
*-commutative62.0%
unpow262.0%
unpow262.0%
unpow262.0%
*-commutative62.0%
swap-sqr77.1%
swap-sqr97.6%
unpow297.6%
rem-exp-log82.2%
log-div69.5%
log-pow48.9%
associate-*r*49.7%
*-commutative49.7%
*-commutative49.7%
cancel-sign-sub-inv49.7%
Simplified97.8%
Final simplification97.8%
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.12e-20)
(pow (* c (* x s)) -2.0)
(if (<= x 4.6e+151)
(/ t_0 (* s (* (* x x) (* c (* c s)))))
(if (<= x 8.8e+216)
(/ t_0 (* (* c c) (* x (* x (* s s)))))
(/ 1.0 (pow (* s (* x c)) 2.0)))))))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.12e-20) {
tmp = pow((c * (x * s)), -2.0);
} else if (x <= 4.6e+151) {
tmp = t_0 / (s * ((x * x) * (c * (c * s))));
} else if (x <= 8.8e+216) {
tmp = t_0 / ((c * c) * (x * (x * (s * s))));
} else {
tmp = 1.0 / pow((s * (x * c)), 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) :: t_0
real(8) :: tmp
t_0 = cos((x * 2.0d0))
if (x <= 1.12d-20) then
tmp = (c * (x * s)) ** (-2.0d0)
else if (x <= 4.6d+151) then
tmp = t_0 / (s * ((x * x) * (c * (c * s))))
else if (x <= 8.8d+216) then
tmp = t_0 / ((c * c) * (x * (x * (s * s))))
else
tmp = 1.0d0 / ((s * (x * c)) ** 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 t_0 = Math.cos((x * 2.0));
double tmp;
if (x <= 1.12e-20) {
tmp = Math.pow((c * (x * s)), -2.0);
} else if (x <= 4.6e+151) {
tmp = t_0 / (s * ((x * x) * (c * (c * s))));
} else if (x <= 8.8e+216) {
tmp = t_0 / ((c * c) * (x * (x * (s * s))));
} else {
tmp = 1.0 / Math.pow((s * (x * c)), 2.0);
}
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.12e-20: tmp = math.pow((c * (x * s)), -2.0) elif x <= 4.6e+151: tmp = t_0 / (s * ((x * x) * (c * (c * s)))) elif x <= 8.8e+216: tmp = t_0 / ((c * c) * (x * (x * (s * s)))) else: tmp = 1.0 / math.pow((s * (x * c)), 2.0) 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.12e-20) tmp = Float64(c * Float64(x * s)) ^ -2.0; elseif (x <= 4.6e+151) tmp = Float64(t_0 / Float64(s * Float64(Float64(x * x) * Float64(c * Float64(c * s))))); elseif (x <= 8.8e+216) tmp = Float64(t_0 / Float64(Float64(c * c) * Float64(x * Float64(x * Float64(s * s))))); else tmp = Float64(1.0 / (Float64(s * Float64(x * c)) ^ 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)
t_0 = cos((x * 2.0));
tmp = 0.0;
if (x <= 1.12e-20)
tmp = (c * (x * s)) ^ -2.0;
elseif (x <= 4.6e+151)
tmp = t_0 / (s * ((x * x) * (c * (c * s))));
elseif (x <= 8.8e+216)
tmp = t_0 / ((c * c) * (x * (x * (s * s))));
else
tmp = 1.0 / ((s * (x * c)) ^ 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_] := Block[{t$95$0 = N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 1.12e-20], N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], If[LessEqual[x, 4.6e+151], N[(t$95$0 / N[(s * N[(N[(x * x), $MachinePrecision] * N[(c * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.8e+216], N[(t$95$0 / N[(N[(c * c), $MachinePrecision] * N[(x * N[(x * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Power[N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision], 2.0], $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.12 \cdot 10^{-20}:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{+151}:\\
\;\;\;\;\frac{t_0}{s \cdot \left(\left(x \cdot x\right) \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)}\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{+216}:\\
\;\;\;\;\frac{t_0}{\left(c \cdot c\right) \cdot \left(x \cdot \left(x \cdot \left(s \cdot s\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{\left(s \cdot \left(x \cdot c\right)\right)}^{2}}\\
\end{array}
\end{array}
if x < 1.12000000000000002e-20Initial program 64.5%
*-commutative64.5%
associate-*r*57.9%
associate-*r*58.0%
unpow258.0%
unswap-sqr75.8%
unpow275.8%
swap-sqr95.7%
*-commutative95.7%
*-commutative95.7%
*-commutative95.7%
*-commutative95.7%
Simplified95.7%
associate-/r*96.0%
div-inv96.0%
*-commutative96.0%
Applied egg-rr96.0%
un-div-inv96.0%
*-commutative96.0%
*-commutative96.0%
Applied egg-rr96.0%
Taylor expanded in x around 0 53.0%
associate-/r*53.0%
unpow-153.0%
unpow-153.0%
unpow253.0%
associate-/r*53.6%
*-rgt-identity53.6%
associate-*r/53.6%
unpow253.6%
unpow253.6%
swap-sqr68.6%
times-frac84.6%
associate-/r*84.6%
unpow-184.6%
associate-/r*84.6%
unpow-184.6%
pow-sqr84.7%
metadata-eval84.7%
Simplified84.7%
if 1.12000000000000002e-20 < x < 4.6000000000000002e151Initial program 74.3%
*-commutative74.3%
associate-*l*74.3%
associate-*r*76.3%
*-commutative76.3%
unpow276.3%
associate-*r*81.0%
associate-*r*83.0%
*-commutative83.0%
unpow283.0%
Simplified83.0%
Taylor expanded in c around 0 83.0%
*-commutative83.0%
unpow283.0%
associate-*l*95.6%
Simplified95.6%
if 4.6000000000000002e151 < x < 8.8e216Initial program 89.8%
unpow289.8%
*-commutative89.8%
unpow289.8%
Simplified89.8%
if 8.8e216 < x Initial program 70.9%
*-commutative70.9%
associate-*r*64.7%
associate-*r*64.7%
unpow264.7%
unswap-sqr94.0%
unpow294.0%
swap-sqr99.8%
*-commutative99.8%
*-commutative99.8%
*-commutative99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around 0 64.7%
unpow264.7%
unpow264.7%
unpow264.7%
Simplified64.7%
Taylor expanded in c around 0 64.7%
unpow264.7%
unpow264.7%
unpow264.7%
swap-sqr77.9%
swap-sqr83.6%
unpow283.6%
Simplified83.6%
Final simplification86.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 5.5e-42) (pow (* c (* x s)) -2.0) (/ (cos (* x 2.0)) (* s (* (* x x) (* c (* 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 <= 5.5e-42) {
tmp = pow((c * (x * s)), -2.0);
} else {
tmp = cos((x * 2.0)) / (s * ((x * x) * (c * (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 <= 5.5d-42) then
tmp = (c * (x * s)) ** (-2.0d0)
else
tmp = cos((x * 2.0d0)) / (s * ((x * x) * (c * (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 <= 5.5e-42) {
tmp = Math.pow((c * (x * s)), -2.0);
} else {
tmp = Math.cos((x * 2.0)) / (s * ((x * x) * (c * (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 <= 5.5e-42: tmp = math.pow((c * (x * s)), -2.0) else: tmp = math.cos((x * 2.0)) / (s * ((x * x) * (c * (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 <= 5.5e-42) tmp = Float64(c * Float64(x * s)) ^ -2.0; else tmp = Float64(cos(Float64(x * 2.0)) / Float64(s * Float64(Float64(x * x) * Float64(c * 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 <= 5.5e-42)
tmp = (c * (x * s)) ^ -2.0;
else
tmp = cos((x * 2.0)) / (s * ((x * x) * (c * (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, 5.5e-42], N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(s * N[(N[(x * x), $MachinePrecision] * N[(c * 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 5.5 \cdot 10^{-42}:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)}\\
\end{array}
\end{array}
if x < 5.5e-42Initial program 64.1%
*-commutative64.1%
associate-*r*57.3%
associate-*r*57.4%
unpow257.4%
unswap-sqr75.7%
unpow275.7%
swap-sqr95.6%
*-commutative95.6%
*-commutative95.6%
*-commutative95.6%
*-commutative95.6%
Simplified95.6%
associate-/r*95.9%
div-inv95.9%
*-commutative95.9%
Applied egg-rr95.9%
un-div-inv95.9%
*-commutative95.9%
*-commutative95.9%
Applied egg-rr95.9%
Taylor expanded in x around 0 52.2%
associate-/r*52.2%
unpow-152.2%
unpow-152.2%
unpow252.2%
associate-/r*52.9%
*-rgt-identity52.9%
associate-*r/52.8%
unpow252.8%
unpow252.8%
swap-sqr68.3%
times-frac84.2%
associate-/r*84.2%
unpow-184.2%
associate-/r*84.2%
unpow-184.2%
pow-sqr84.2%
metadata-eval84.2%
Simplified84.2%
if 5.5e-42 < x Initial program 75.7%
*-commutative75.7%
associate-*l*73.0%
associate-*r*74.2%
*-commutative74.2%
unpow274.2%
associate-*r*78.3%
associate-*r*79.5%
*-commutative79.5%
unpow279.5%
Simplified79.5%
Taylor expanded in c around 0 79.5%
*-commutative79.5%
unpow279.5%
associate-*l*89.5%
Simplified89.5%
Final simplification85.8%
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 1e-20) (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 <= 1e-20) {
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 <= 1d-20) 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 <= 1e-20) {
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 <= 1e-20: 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 <= 1e-20) 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 <= 1e-20)
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, 1e-20], 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 10^{-20}:\\
\;\;\;\;{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 < 9.99999999999999945e-21Initial program 64.5%
*-commutative64.5%
associate-*r*57.9%
associate-*r*58.0%
unpow258.0%
unswap-sqr75.8%
unpow275.8%
swap-sqr95.7%
*-commutative95.7%
*-commutative95.7%
*-commutative95.7%
*-commutative95.7%
Simplified95.7%
associate-/r*96.0%
div-inv96.0%
*-commutative96.0%
Applied egg-rr96.0%
un-div-inv96.0%
*-commutative96.0%
*-commutative96.0%
Applied egg-rr96.0%
Taylor expanded in x around 0 53.0%
associate-/r*53.0%
unpow-153.0%
unpow-153.0%
unpow253.0%
associate-/r*53.6%
*-rgt-identity53.6%
associate-*r/53.6%
unpow253.6%
unpow253.6%
swap-sqr68.6%
times-frac84.6%
associate-/r*84.6%
unpow-184.6%
associate-/r*84.6%
unpow-184.6%
pow-sqr84.7%
metadata-eval84.7%
Simplified84.7%
if 9.99999999999999945e-21 < x Initial program 75.4%
*-commutative75.4%
associate-*r*72.5%
associate-*r*72.4%
unpow272.4%
unswap-sqr83.5%
unpow283.5%
swap-sqr99.6%
*-commutative99.6%
*-commutative99.6%
*-commutative99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in s around 0 99.7%
Final simplification88.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 (* s (* x c)))) (if (<= x 8e-21) (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 <= 8e-21) {
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 <= 8d-21) 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 <= 8e-21) {
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 <= 8e-21: 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 <= 8e-21) 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 <= 8e-21)
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, 8e-21], 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 8 \cdot 10^{-21}:\\
\;\;\;\;{\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 < 7.99999999999999926e-21Initial program 64.5%
*-commutative64.5%
associate-*r*57.9%
associate-*r*58.0%
unpow258.0%
unswap-sqr75.8%
unpow275.8%
swap-sqr95.7%
*-commutative95.7%
*-commutative95.7%
*-commutative95.7%
*-commutative95.7%
Simplified95.7%
associate-/r*96.0%
div-inv96.0%
*-commutative96.0%
Applied egg-rr96.0%
un-div-inv96.0%
*-commutative96.0%
*-commutative96.0%
Applied egg-rr96.0%
Taylor expanded in x around 0 53.0%
associate-/r*53.0%
unpow-153.0%
unpow-153.0%
unpow253.0%
associate-/r*53.6%
*-rgt-identity53.6%
associate-*r/53.6%
unpow253.6%
unpow253.6%
swap-sqr68.6%
times-frac84.6%
associate-/r*84.6%
unpow-184.6%
associate-/r*84.6%
unpow-184.6%
pow-sqr84.7%
metadata-eval84.7%
Simplified84.7%
if 7.99999999999999926e-21 < x Initial program 75.4%
*-commutative75.4%
associate-*r*72.5%
associate-*r*72.4%
unpow272.4%
unswap-sqr83.5%
unpow283.5%
swap-sqr99.6%
*-commutative99.6%
*-commutative99.6%
*-commutative99.6%
*-commutative99.6%
Simplified99.6%
Final simplification88.8%
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 67.6%
*-commutative67.6%
associate-*r*62.0%
associate-*r*62.1%
unpow262.1%
unswap-sqr77.9%
unpow277.9%
swap-sqr96.8%
*-commutative96.8%
*-commutative96.8%
*-commutative96.8%
*-commutative96.8%
Simplified96.8%
associate-/r*97.0%
div-inv97.0%
*-commutative97.0%
Applied egg-rr97.0%
un-div-inv97.0%
*-commutative97.0%
*-commutative97.0%
Applied egg-rr97.0%
Taylor expanded in x around 0 55.8%
associate-/r*55.8%
unpow-155.8%
unpow-155.8%
unpow255.8%
associate-/r*56.3%
*-rgt-identity56.3%
associate-*r/56.2%
unpow256.2%
unpow256.2%
swap-sqr67.6%
times-frac80.3%
associate-/r*80.3%
unpow-180.3%
associate-/r*80.3%
unpow-180.3%
pow-sqr80.3%
metadata-eval80.3%
Simplified80.3%
Final simplification80.3%
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 1.35e+154) (/ 1.0 (* (* c c) (* (* x x) (* s s)))) (/ -2.0 (* (* c c) (* s s)))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (s <= 1.35e+154) {
tmp = 1.0 / ((c * c) * ((x * x) * (s * s)));
} else {
tmp = -2.0 / ((c * 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) :: tmp
if (s <= 1.35d+154) then
tmp = 1.0d0 / ((c * c) * ((x * x) * (s * s)))
else
tmp = (-2.0d0) / ((c * 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 tmp;
if (s <= 1.35e+154) {
tmp = 1.0 / ((c * c) * ((x * x) * (s * s)));
} else {
tmp = -2.0 / ((c * c) * (s * 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 s <= 1.35e+154: tmp = 1.0 / ((c * c) * ((x * x) * (s * s))) else: tmp = -2.0 / ((c * c) * (s * 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 (s <= 1.35e+154) tmp = Float64(1.0 / Float64(Float64(c * c) * Float64(Float64(x * x) * Float64(s * s)))); else tmp = Float64(-2.0 / Float64(Float64(c * 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)
tmp = 0.0;
if (s <= 1.35e+154)
tmp = 1.0 / ((c * c) * ((x * x) * (s * s)));
else
tmp = -2.0 / ((c * 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_] := If[LessEqual[s, 1.35e+154], N[(1.0 / N[(N[(c * c), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 / N[(N[(c * c), $MachinePrecision] * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;s \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{\left(c \cdot c\right) \cdot \left(\left(x \cdot x\right) \cdot \left(s \cdot s\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2}{\left(c \cdot c\right) \cdot \left(s \cdot s\right)}\\
\end{array}
\end{array}
if s < 1.35000000000000003e154Initial program 70.0%
*-commutative70.0%
associate-*r*63.8%
associate-*r*64.0%
unpow264.0%
unswap-sqr80.6%
unpow280.6%
swap-sqr96.7%
*-commutative96.7%
*-commutative96.7%
*-commutative96.7%
*-commutative96.7%
Simplified96.7%
Taylor expanded in x around 0 56.4%
unpow256.4%
unpow256.4%
unpow256.4%
Simplified56.4%
if 1.35000000000000003e154 < s Initial program 55.4%
*-commutative55.4%
associate-*r*52.7%
associate-*r*52.4%
unpow252.4%
unswap-sqr64.4%
unpow264.4%
swap-sqr97.4%
*-commutative97.4%
*-commutative97.4%
*-commutative97.4%
*-commutative97.4%
Simplified97.4%
associate-/r*97.6%
div-inv97.5%
*-commutative97.5%
Applied egg-rr97.5%
Taylor expanded in x around 0 81.5%
Taylor expanded in x around -inf 55.9%
Taylor expanded in x around 0 55.4%
unpow255.4%
unpow255.4%
Simplified55.4%
Final simplification56.3%
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 1.85e+215) (/ 1.0 (* (* c c) (* (* x x) (* s s)))) (/ (* -2.0 (/ x (* c s))) (* x (* 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 (s <= 1.85e+215) {
tmp = 1.0 / ((c * c) * ((x * x) * (s * s)));
} else {
tmp = (-2.0 * (x / (c * s))) / (x * (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 (s <= 1.85d+215) then
tmp = 1.0d0 / ((c * c) * ((x * x) * (s * s)))
else
tmp = ((-2.0d0) * (x / (c * s))) / (x * (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 (s <= 1.85e+215) {
tmp = 1.0 / ((c * c) * ((x * x) * (s * s)));
} else {
tmp = (-2.0 * (x / (c * s))) / (x * (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 s <= 1.85e+215: tmp = 1.0 / ((c * c) * ((x * x) * (s * s))) else: tmp = (-2.0 * (x / (c * s))) / (x * (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 (s <= 1.85e+215) tmp = Float64(1.0 / Float64(Float64(c * c) * Float64(Float64(x * x) * Float64(s * s)))); else tmp = Float64(Float64(-2.0 * Float64(x / Float64(c * s))) / Float64(x * 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 (s <= 1.85e+215)
tmp = 1.0 / ((c * c) * ((x * x) * (s * s)));
else
tmp = (-2.0 * (x / (c * s))) / (x * (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[s, 1.85e+215], N[(1.0 / N[(N[(c * c), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-2.0 * N[(x / N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;s \leq 1.85 \cdot 10^{+215}:\\
\;\;\;\;\frac{1}{\left(c \cdot c\right) \cdot \left(\left(x \cdot x\right) \cdot \left(s \cdot s\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2 \cdot \frac{x}{c \cdot s}}{x \cdot \left(c \cdot s\right)}\\
\end{array}
\end{array}
if s < 1.84999999999999986e215Initial program 69.1%
*-commutative69.1%
associate-*r*63.2%
associate-*r*63.3%
unpow263.3%
unswap-sqr79.3%
unpow279.3%
swap-sqr96.8%
*-commutative96.8%
*-commutative96.8%
*-commutative96.8%
*-commutative96.8%
Simplified96.8%
Taylor expanded in x around 0 56.2%
unpow256.2%
unpow256.2%
unpow256.2%
Simplified56.2%
if 1.84999999999999986e215 < s Initial program 56.9%
*-commutative56.9%
associate-*r*53.4%
associate-*r*53.1%
unpow253.1%
unswap-sqr68.8%
unpow268.8%
swap-sqr96.8%
*-commutative96.8%
*-commutative96.8%
*-commutative96.8%
*-commutative96.8%
Simplified96.8%
associate-/r*96.9%
div-inv96.8%
*-commutative96.8%
Applied egg-rr96.8%
Taylor expanded in x around 0 78.8%
Taylor expanded in x around -inf 57.6%
un-div-inv57.6%
associate-*r*66.6%
*-commutative66.6%
associate-*r*57.7%
Applied egg-rr57.7%
Final simplification56.3%
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(1.0 / Float64(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[(1.0 / N[(c * N[(x * 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}{c \cdot \left(x \cdot s\right)}\\
t_0 \cdot t_0
\end{array}
\end{array}
Initial program 67.6%
*-commutative67.6%
associate-*r*62.0%
associate-*r*62.1%
unpow262.1%
unswap-sqr77.9%
unpow277.9%
swap-sqr96.8%
*-commutative96.8%
*-commutative96.8%
*-commutative96.8%
*-commutative96.8%
Simplified96.8%
associate-/r*97.0%
div-inv97.0%
*-commutative97.0%
Applied egg-rr97.0%
Taylor expanded in x around 0 66.9%
Taylor expanded in s around 0 69.4%
Taylor expanded in x around 0 80.3%
Final simplification80.3%
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 s) (* (* x c) (* 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 / s) / ((x * c) * (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 / s) / ((x * c) * (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 / s) / ((x * c) * (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 / s) / ((x * c) * (s * (x * c)))
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(Float64(1.0 / s) / Float64(Float64(x * c) * 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 / s) / ((x * c) * (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[(N[(1.0 / s), $MachinePrecision] / N[(N[(x * c), $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{\frac{1}{s}}{\left(x \cdot c\right) \cdot \left(s \cdot \left(x \cdot c\right)\right)}
\end{array}
Initial program 67.6%
*-commutative67.6%
associate-*r*62.0%
associate-*r*62.1%
unpow262.1%
unswap-sqr77.9%
unpow277.9%
swap-sqr96.8%
*-commutative96.8%
*-commutative96.8%
*-commutative96.8%
*-commutative96.8%
Simplified96.8%
associate-/r*97.0%
div-inv97.0%
*-commutative97.0%
Applied egg-rr97.0%
*-commutative97.0%
associate-/r*97.0%
frac-times93.6%
*-un-lft-identity93.6%
*-commutative93.6%
*-commutative93.6%
Applied egg-rr93.6%
Taylor expanded in x around 0 77.8%
Final simplification77.8%
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 67.6%
*-commutative67.6%
associate-*r*62.0%
associate-*r*62.1%
unpow262.1%
unswap-sqr77.9%
unpow277.9%
swap-sqr96.8%
*-commutative96.8%
*-commutative96.8%
*-commutative96.8%
*-commutative96.8%
Simplified96.8%
associate-/r*97.0%
div-inv97.0%
*-commutative97.0%
Applied egg-rr97.0%
un-div-inv97.0%
*-commutative97.0%
*-commutative97.0%
Applied egg-rr97.0%
Taylor expanded in x around 0 79.6%
Final simplification79.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 (/ (/ (/ 1.0 (* x c)) 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 / (x * c)) / 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 / (x * c)) / 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 / (x * c)) / 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 / (x * c)) / 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(Float64(Float64(1.0 / Float64(x * c)) / 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 / (x * c)) / 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[(N[(N[(1.0 / N[(x * c), $MachinePrecision]), $MachinePrecision] / s), $MachinePrecision] / N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{\frac{\frac{1}{x \cdot c}}{s}}{s \cdot \left(x \cdot c\right)}
\end{array}
Initial program 67.6%
*-commutative67.6%
associate-*r*62.0%
associate-*r*62.1%
unpow262.1%
unswap-sqr77.9%
unpow277.9%
swap-sqr96.8%
*-commutative96.8%
*-commutative96.8%
*-commutative96.8%
*-commutative96.8%
Simplified96.8%
associate-/r*97.0%
div-inv97.0%
*-commutative97.0%
Applied egg-rr97.0%
un-div-inv97.0%
*-commutative97.0%
*-commutative97.0%
Applied egg-rr97.0%
Taylor expanded in x around 0 79.6%
associate-/l/79.6%
Simplified79.6%
Final simplification79.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 (/ -2.0 (* (* c c) (* s s))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return -2.0 / ((c * c) * (s * s));
}
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 = (-2.0d0) / ((c * c) * (s * s))
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 -2.0 / ((c * c) * (s * s));
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return -2.0 / ((c * c) * (s * s))
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(-2.0 / Float64(Float64(c * c) * Float64(s * s))) end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = -2.0 / ((c * c) * (s * s));
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[(-2.0 / N[(N[(c * c), $MachinePrecision] * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{-2}{\left(c \cdot c\right) \cdot \left(s \cdot s\right)}
\end{array}
Initial program 67.6%
*-commutative67.6%
associate-*r*62.0%
associate-*r*62.1%
unpow262.1%
unswap-sqr77.9%
unpow277.9%
swap-sqr96.8%
*-commutative96.8%
*-commutative96.8%
*-commutative96.8%
*-commutative96.8%
Simplified96.8%
associate-/r*97.0%
div-inv97.0%
*-commutative97.0%
Applied egg-rr97.0%
Taylor expanded in x around 0 66.9%
Taylor expanded in x around -inf 35.0%
Taylor expanded in x around 0 34.0%
unpow234.0%
unpow234.0%
Simplified34.0%
Final simplification34.0%
herbie shell --seed 2023256
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))