
(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 (cos (* x 2.0))) (t_1 (* c (* x s))))
(if (<= x 7.4e+44)
(/ t_0 (* t_1 t_1))
(* (/ 1.0 s) (/ t_0 (* (* 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) {
double t_0 = cos((x * 2.0));
double t_1 = c * (x * s);
double tmp;
if (x <= 7.4e+44) {
tmp = t_0 / (t_1 * t_1);
} else {
tmp = (1.0 / s) * (t_0 / ((x * c) * (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) :: t_1
real(8) :: tmp
t_0 = cos((x * 2.0d0))
t_1 = c * (x * s)
if (x <= 7.4d+44) then
tmp = t_0 / (t_1 * t_1)
else
tmp = (1.0d0 / s) * (t_0 / ((x * c) * (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 = Math.cos((x * 2.0));
double t_1 = c * (x * s);
double tmp;
if (x <= 7.4e+44) {
tmp = t_0 / (t_1 * t_1);
} else {
tmp = (1.0 / s) * (t_0 / ((x * c) * (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 = math.cos((x * 2.0)) t_1 = c * (x * s) tmp = 0 if x <= 7.4e+44: tmp = t_0 / (t_1 * t_1) else: tmp = (1.0 / s) * (t_0 / ((x * c) * (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 = cos(Float64(x * 2.0)) t_1 = Float64(c * Float64(x * s)) tmp = 0.0 if (x <= 7.4e+44) tmp = Float64(t_0 / Float64(t_1 * t_1)); else tmp = Float64(Float64(1.0 / s) * Float64(t_0 / Float64(Float64(x * c) * 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 = cos((x * 2.0));
t_1 = c * (x * s);
tmp = 0.0;
if (x <= 7.4e+44)
tmp = t_0 / (t_1 * t_1);
else
tmp = (1.0 / s) * (t_0 / ((x * c) * (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[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 7.4e+44], N[(t$95$0 / N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / s), $MachinePrecision] * N[(t$95$0 / N[(N[(x * c), $MachinePrecision] * N[(s * N[(x * c), $MachinePrecision]), $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)\\
t_1 := c \cdot \left(x \cdot s\right)\\
\mathbf{if}\;x \leq 7.4 \cdot 10^{+44}:\\
\;\;\;\;\frac{t_0}{t_1 \cdot t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{s} \cdot \frac{t_0}{\left(x \cdot c\right) \cdot \left(s \cdot \left(x \cdot c\right)\right)}\\
\end{array}
\end{array}
if x < 7.4000000000000002e44Initial program 62.0%
*-commutative62.0%
associate-*r*58.2%
associate-*r*59.3%
unpow259.3%
unswap-sqr75.0%
unpow275.0%
swap-sqr98.0%
*-commutative98.0%
*-commutative98.0%
*-commutative98.0%
*-commutative98.0%
Simplified98.0%
Taylor expanded in s around 0 95.9%
Taylor expanded in s around 0 97.2%
if 7.4000000000000002e44 < x Initial program 64.3%
*-commutative64.3%
associate-*r*56.7%
associate-*r*58.5%
unpow258.5%
unswap-sqr71.7%
unpow271.7%
swap-sqr98.1%
*-commutative98.1%
*-commutative98.1%
*-commutative98.1%
*-commutative98.1%
Simplified98.1%
*-un-lft-identity98.1%
associate-*l*97.9%
times-frac98.0%
*-commutative98.0%
Applied egg-rr98.0%
Final simplification97.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 (if (<= x 4.1e-5) (/ 1.0 (pow (* c (* x s)) 2.0)) (/ (cos (* x 2.0)) (* s (* s (* x (* c (* x c))))))))
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.1e-5) {
tmp = 1.0 / pow((c * (x * s)), 2.0);
} else {
tmp = cos((x * 2.0)) / (s * (s * (x * (c * (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) :: tmp
if (x <= 4.1d-5) then
tmp = 1.0d0 / ((c * (x * s)) ** 2.0d0)
else
tmp = cos((x * 2.0d0)) / (s * (s * (x * (c * (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 tmp;
if (x <= 4.1e-5) {
tmp = 1.0 / Math.pow((c * (x * s)), 2.0);
} else {
tmp = Math.cos((x * 2.0)) / (s * (s * (x * (c * (x * c)))));
}
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.1e-5: tmp = 1.0 / math.pow((c * (x * s)), 2.0) else: tmp = math.cos((x * 2.0)) / (s * (s * (x * (c * (x * c))))) 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.1e-5) tmp = Float64(1.0 / (Float64(c * Float64(x * s)) ^ 2.0)); else tmp = Float64(cos(Float64(x * 2.0)) / Float64(s * Float64(s * Float64(x * Float64(c * 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)
tmp = 0.0;
if (x <= 4.1e-5)
tmp = 1.0 / ((c * (x * s)) ^ 2.0);
else
tmp = cos((x * 2.0)) / (s * (s * (x * (c * (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_] := If[LessEqual[x, 4.1e-5], N[(1.0 / N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(s * N[(s * N[(x * N[(c * N[(x * c), $MachinePrecision]), $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.1 \cdot 10^{-5}:\\
\;\;\;\;\frac{1}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{s \cdot \left(s \cdot \left(x \cdot \left(c \cdot \left(x \cdot c\right)\right)\right)\right)}\\
\end{array}
\end{array}
if x < 4.10000000000000005e-5Initial program 60.5%
*-commutative60.5%
associate-*r*56.6%
associate-*r*57.7%
unpow257.7%
unswap-sqr74.2%
unpow274.2%
swap-sqr97.9%
*-commutative97.9%
*-commutative97.9%
*-commutative97.9%
*-commutative97.9%
Simplified97.9%
Taylor expanded in x around 0 53.2%
unpow253.2%
associate-*r*54.7%
*-commutative54.7%
associate-*r*54.7%
*-commutative54.7%
unpow254.7%
unpow254.7%
swap-sqr69.6%
swap-sqr88.4%
unpow288.4%
associate-*r*88.0%
*-commutative88.0%
*-commutative88.0%
*-commutative88.0%
Simplified88.0%
if 4.10000000000000005e-5 < x Initial program 68.3%
*-commutative68.3%
associate-*l*61.8%
associate-*r*63.2%
*-commutative63.2%
unpow263.2%
associate-*r*69.5%
associate-*r*71.3%
*-commutative71.3%
unpow271.3%
Simplified71.3%
Taylor expanded in x around 0 71.4%
*-commutative71.4%
unpow271.4%
associate-*r*80.6%
unpow280.6%
associate-*r*87.1%
*-commutative87.1%
Simplified87.1%
Final simplification87.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))))
(if (<= x 2e-19)
(/ 1.0 (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 <= 2e-19) {
tmp = 1.0 / 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 <= 2d-19) then
tmp = 1.0d0 / ((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 <= 2e-19) {
tmp = 1.0 / 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 <= 2e-19: tmp = 1.0 / 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 <= 2e-19) tmp = Float64(1.0 / (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 <= 2e-19)
tmp = 1.0 / ((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, 2e-19], N[(1.0 / N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $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 2 \cdot 10^{-19}:\\
\;\;\;\;\frac{1}{{\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 < 2e-19Initial program 60.3%
*-commutative60.3%
associate-*r*56.4%
associate-*r*57.5%
unpow257.5%
unswap-sqr74.1%
unpow274.1%
swap-sqr97.9%
*-commutative97.9%
*-commutative97.9%
*-commutative97.9%
*-commutative97.9%
Simplified97.9%
Taylor expanded in x around 0 52.9%
unpow252.9%
associate-*r*54.4%
*-commutative54.4%
associate-*r*54.5%
*-commutative54.5%
unpow254.5%
unpow254.5%
swap-sqr69.5%
swap-sqr88.3%
unpow288.3%
associate-*r*87.9%
*-commutative87.9%
*-commutative87.9%
*-commutative87.9%
Simplified87.9%
if 2e-19 < x Initial program 68.7%
*-commutative68.7%
associate-*r*62.4%
associate-*r*63.9%
unpow263.9%
unswap-sqr74.9%
unpow274.9%
swap-sqr98.4%
*-commutative98.4%
*-commutative98.4%
*-commutative98.4%
*-commutative98.4%
Simplified98.4%
Final simplification90.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 (* c (* x s)))) (/ (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 = c * (x * s);
return cos((x * 2.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 = c * (x * s)
code = cos((x * 2.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 = c * (x * s);
return Math.cos((x * 2.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 = c * (x * s) return math.cos((x * 2.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(c * Float64(x * s)) return Float64(cos(Float64(x * 2.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 = c * (x * s);
tmp = cos((x * 2.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[(c * N[(x * s), $MachinePrecision]), $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 := c \cdot \left(x \cdot s\right)\\
\frac{\cos \left(x \cdot 2\right)}{t_0 \cdot t_0}
\end{array}
\end{array}
Initial program 62.5%
*-commutative62.5%
associate-*r*57.9%
associate-*r*59.1%
unpow259.1%
unswap-sqr74.3%
unpow274.3%
swap-sqr98.0%
*-commutative98.0%
*-commutative98.0%
*-commutative98.0%
*-commutative98.0%
Simplified98.0%
Taylor expanded in s around 0 95.3%
Taylor expanded in s around 0 96.7%
Final simplification96.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 (/ 1.0 (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 1.0 / 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 = 1.0d0 / ((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 1.0 / 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 1.0 / 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(1.0 / (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 = 1.0 / ((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[(1.0 / N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], 2.0], $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)}^{2}}
\end{array}
Initial program 62.5%
*-commutative62.5%
associate-*r*57.9%
associate-*r*59.1%
unpow259.1%
unswap-sqr74.3%
unpow274.3%
swap-sqr98.0%
*-commutative98.0%
*-commutative98.0%
*-commutative98.0%
*-commutative98.0%
Simplified98.0%
Taylor expanded in x around 0 52.8%
unpow252.8%
associate-*r*53.9%
*-commutative53.9%
associate-*r*54.0%
*-commutative54.0%
unpow254.0%
unpow254.0%
swap-sqr66.6%
swap-sqr82.7%
unpow282.7%
associate-*r*82.2%
*-commutative82.2%
*-commutative82.2%
*-commutative82.2%
Simplified82.2%
Final simplification82.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 (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 62.5%
*-commutative62.5%
associate-*r*57.9%
associate-*r*59.1%
unpow259.1%
unswap-sqr74.3%
unpow274.3%
swap-sqr98.0%
*-commutative98.0%
*-commutative98.0%
*-commutative98.0%
*-commutative98.0%
Simplified98.0%
Taylor expanded in x around 0 52.8%
unpow252.8%
unpow252.8%
*-commutative52.8%
unpow252.8%
Simplified52.8%
*-commutative52.8%
*-commutative52.8%
pow252.8%
pow252.8%
pow-prod-down65.0%
pow265.0%
unpow-prod-down82.2%
associate-*r*82.7%
pow-flip82.7%
metadata-eval82.7%
Applied egg-rr82.7%
Taylor expanded in s around 0 82.2%
Final simplification82.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 (<= x 1.38e-191) (/ 1.0 (* (* c c) (* (* x s) (* x s)))) (* (/ 1.0 (* c s)) (/ (/ 1.0 (* s (* x c))) x))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (x <= 1.38e-191) {
tmp = 1.0 / ((c * c) * ((x * s) * (x * s)));
} else {
tmp = (1.0 / (c * s)) * ((1.0 / (s * (x * c))) / x);
}
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 <= 1.38d-191) then
tmp = 1.0d0 / ((c * c) * ((x * s) * (x * s)))
else
tmp = (1.0d0 / (c * s)) * ((1.0d0 / (s * (x * c))) / x)
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 <= 1.38e-191) {
tmp = 1.0 / ((c * c) * ((x * s) * (x * s)));
} else {
tmp = (1.0 / (c * s)) * ((1.0 / (s * (x * c))) / x);
}
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 <= 1.38e-191: tmp = 1.0 / ((c * c) * ((x * s) * (x * s))) else: tmp = (1.0 / (c * s)) * ((1.0 / (s * (x * c))) / x) 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 <= 1.38e-191) tmp = Float64(1.0 / Float64(Float64(c * c) * Float64(Float64(x * s) * Float64(x * s)))); else tmp = Float64(Float64(1.0 / Float64(c * s)) * Float64(Float64(1.0 / Float64(s * Float64(x * c))) / x)); 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 <= 1.38e-191)
tmp = 1.0 / ((c * c) * ((x * s) * (x * s)));
else
tmp = (1.0 / (c * s)) * ((1.0 / (s * (x * c))) / x);
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, 1.38e-191], N[(1.0 / N[(N[(c * c), $MachinePrecision] * N[(N[(x * s), $MachinePrecision] * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(c * s), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.38 \cdot 10^{-191}:\\
\;\;\;\;\frac{1}{\left(c \cdot c\right) \cdot \left(\left(x \cdot s\right) \cdot \left(x \cdot s\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{c \cdot s} \cdot \frac{\frac{1}{s \cdot \left(x \cdot c\right)}}{x}\\
\end{array}
\end{array}
if x < 1.38000000000000003e-191Initial program 62.0%
*-commutative62.0%
associate-*r*57.4%
associate-*r*57.5%
unpow257.5%
unswap-sqr74.2%
unpow274.2%
swap-sqr97.4%
*-commutative97.4%
*-commutative97.4%
*-commutative97.4%
*-commutative97.4%
Simplified97.4%
Taylor expanded in s around 0 95.6%
associate-*r*97.5%
*-commutative97.5%
swap-sqr74.8%
*-commutative74.8%
*-commutative74.8%
swap-sqr57.4%
associate-*r*62.0%
/-rgt-identity62.0%
clear-num61.4%
div-inv61.4%
clear-num61.4%
div-inv61.1%
frac-times62.0%
associate-*r*57.4%
swap-sqr74.8%
*-commutative74.8%
*-commutative74.8%
swap-sqr97.5%
*-commutative97.5%
associate-*r*95.6%
*-commutative95.6%
associate-*r*97.4%
Applied egg-rr97.4%
Taylor expanded in x around 0 52.8%
unpow252.8%
unpow252.8%
associate-*l*59.3%
associate-*l*60.5%
*-commutative60.5%
unpow260.5%
associate-*r*60.7%
unpow260.7%
*-commutative60.7%
associate-*r*54.1%
unpow254.1%
associate-*r*52.8%
unpow252.8%
unpow252.8%
swap-sqr66.9%
Simplified66.9%
if 1.38000000000000003e-191 < x Initial program 63.1%
associate-/r*61.4%
unpow261.4%
*-commutative61.4%
unpow261.4%
Simplified61.4%
Taylor expanded in x around 0 54.3%
unpow254.3%
Simplified54.3%
div-inv54.3%
frac-times55.1%
associate-*r*52.8%
swap-sqr62.7%
*-commutative62.7%
*-commutative62.7%
swap-sqr78.4%
*-commutative78.4%
associate-*r*78.5%
*-commutative78.5%
associate-*r*80.4%
frac-times80.3%
associate-*l/80.3%
associate-*r*78.5%
*-commutative78.5%
associate-*r*80.3%
times-frac79.5%
Applied egg-rr79.5%
Final simplification72.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 (if (<= x 115000.0) (/ 1.0 (* (* c c) (* (* x s) (* x s)))) (/ (/ 1.0 (* s (* x s))) (* c (* x c)))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (x <= 115000.0) {
tmp = 1.0 / ((c * c) * ((x * s) * (x * s)));
} else {
tmp = (1.0 / (s * (x * s))) / (c * (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) :: tmp
if (x <= 115000.0d0) then
tmp = 1.0d0 / ((c * c) * ((x * s) * (x * s)))
else
tmp = (1.0d0 / (s * (x * s))) / (c * (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 tmp;
if (x <= 115000.0) {
tmp = 1.0 / ((c * c) * ((x * s) * (x * s)));
} else {
tmp = (1.0 / (s * (x * s))) / (c * (x * c));
}
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 <= 115000.0: tmp = 1.0 / ((c * c) * ((x * s) * (x * s))) else: tmp = (1.0 / (s * (x * s))) / (c * (x * c)) 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 <= 115000.0) tmp = Float64(1.0 / Float64(Float64(c * c) * Float64(Float64(x * s) * Float64(x * s)))); else tmp = Float64(Float64(1.0 / Float64(s * Float64(x * s))) / Float64(c * 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)
tmp = 0.0;
if (x <= 115000.0)
tmp = 1.0 / ((c * c) * ((x * s) * (x * s)));
else
tmp = (1.0 / (s * (x * s))) / (c * (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_] := If[LessEqual[x, 115000.0], N[(1.0 / N[(N[(c * c), $MachinePrecision] * N[(N[(x * s), $MachinePrecision] * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(s * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(c * N[(x * c), $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 115000:\\
\;\;\;\;\frac{1}{\left(c \cdot c\right) \cdot \left(\left(x \cdot s\right) \cdot \left(x \cdot s\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{s \cdot \left(x \cdot s\right)}}{c \cdot \left(x \cdot c\right)}\\
\end{array}
\end{array}
if x < 115000Initial program 60.9%
*-commutative60.9%
associate-*r*57.0%
associate-*r*58.1%
unpow258.1%
unswap-sqr74.5%
unpow274.5%
swap-sqr97.9%
*-commutative97.9%
*-commutative97.9%
*-commutative97.9%
*-commutative97.9%
Simplified97.9%
Taylor expanded in s around 0 95.7%
associate-*r*97.1%
*-commutative97.1%
swap-sqr72.4%
*-commutative72.4%
*-commutative72.4%
swap-sqr57.0%
associate-*r*60.9%
/-rgt-identity60.9%
clear-num60.5%
div-inv60.5%
clear-num60.5%
div-inv60.3%
frac-times60.9%
associate-*r*57.0%
swap-sqr72.4%
*-commutative72.4%
*-commutative72.4%
swap-sqr97.1%
*-commutative97.1%
associate-*r*95.7%
*-commutative95.7%
associate-*r*98.0%
Applied egg-rr98.0%
Taylor expanded in x around 0 53.7%
unpow253.7%
unpow253.7%
associate-*l*60.5%
associate-*l*62.8%
*-commutative62.8%
unpow262.8%
associate-*r*61.1%
unpow261.1%
*-commutative61.1%
associate-*r*55.2%
unpow255.2%
associate-*r*53.7%
unpow253.7%
unpow253.7%
swap-sqr66.6%
Simplified66.6%
if 115000 < x Initial program 67.2%
unpow267.2%
*-commutative67.2%
unpow267.2%
Simplified67.2%
*-un-lft-identity67.2%
associate-*r*68.8%
times-frac68.8%
*-commutative68.8%
*-commutative68.8%
Applied egg-rr68.8%
associate-*l/68.8%
*-lft-identity68.8%
associate-/r*68.8%
unpow268.8%
*-commutative68.8%
unpow268.8%
associate-*l*72.3%
Simplified72.3%
Taylor expanded in x around 0 56.2%
unpow256.2%
associate-*l*61.9%
Simplified61.9%
Final simplification65.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 (if (<= x 4e+56) (/ 1.0 (* (* c c) (* (* x s) (* x s)))) (/ (/ (/ 1.0 x) (* s s)) (* c (* x c)))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (x <= 4e+56) {
tmp = 1.0 / ((c * c) * ((x * s) * (x * s)));
} else {
tmp = ((1.0 / x) / (s * s)) / (c * (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) :: tmp
if (x <= 4d+56) then
tmp = 1.0d0 / ((c * c) * ((x * s) * (x * s)))
else
tmp = ((1.0d0 / x) / (s * s)) / (c * (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 tmp;
if (x <= 4e+56) {
tmp = 1.0 / ((c * c) * ((x * s) * (x * s)));
} else {
tmp = ((1.0 / x) / (s * s)) / (c * (x * c));
}
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 <= 4e+56: tmp = 1.0 / ((c * c) * ((x * s) * (x * s))) else: tmp = ((1.0 / x) / (s * s)) / (c * (x * c)) 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 <= 4e+56) tmp = Float64(1.0 / Float64(Float64(c * c) * Float64(Float64(x * s) * Float64(x * s)))); else tmp = Float64(Float64(Float64(1.0 / x) / Float64(s * s)) / Float64(c * 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)
tmp = 0.0;
if (x <= 4e+56)
tmp = 1.0 / ((c * c) * ((x * s) * (x * s)));
else
tmp = ((1.0 / x) / (s * s)) / (c * (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_] := If[LessEqual[x, 4e+56], N[(1.0 / N[(N[(c * c), $MachinePrecision] * N[(N[(x * s), $MachinePrecision] * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] / N[(s * s), $MachinePrecision]), $MachinePrecision] / N[(c * N[(x * c), $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 \cdot 10^{+56}:\\
\;\;\;\;\frac{1}{\left(c \cdot c\right) \cdot \left(\left(x \cdot s\right) \cdot \left(x \cdot s\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{x}}{s \cdot s}}{c \cdot \left(x \cdot c\right)}\\
\end{array}
\end{array}
if x < 4.00000000000000037e56Initial program 62.2%
*-commutative62.2%
associate-*r*58.4%
associate-*r*59.5%
unpow259.5%
unswap-sqr75.1%
unpow275.1%
swap-sqr98.0%
*-commutative98.0%
*-commutative98.0%
*-commutative98.0%
*-commutative98.0%
Simplified98.0%
Taylor expanded in s around 0 95.9%
associate-*r*97.2%
*-commutative97.2%
swap-sqr73.2%
*-commutative73.2%
*-commutative73.2%
swap-sqr58.4%
associate-*r*62.2%
/-rgt-identity62.2%
clear-num61.8%
div-inv61.8%
clear-num61.8%
div-inv61.6%
frac-times62.2%
associate-*r*58.4%
swap-sqr73.2%
*-commutative73.2%
*-commutative73.2%
swap-sqr97.2%
*-commutative97.2%
associate-*r*95.9%
*-commutative95.9%
associate-*r*98.0%
Applied egg-rr98.1%
Taylor expanded in x around 0 53.9%
unpow253.9%
unpow253.9%
associate-*l*60.4%
associate-*l*62.7%
*-commutative62.7%
unpow262.7%
associate-*r*61.0%
unpow261.0%
*-commutative61.0%
associate-*r*55.3%
unpow255.3%
associate-*r*53.9%
unpow253.9%
unpow253.9%
swap-sqr66.2%
Simplified66.2%
if 4.00000000000000037e56 < x Initial program 63.7%
unpow263.7%
*-commutative63.7%
unpow263.7%
Simplified63.7%
*-un-lft-identity63.7%
associate-*r*65.5%
times-frac65.5%
*-commutative65.5%
*-commutative65.5%
Applied egg-rr65.5%
associate-*l/65.5%
*-lft-identity65.5%
associate-/r*65.5%
unpow265.5%
*-commutative65.5%
unpow265.5%
associate-*l*69.5%
Simplified69.5%
Taylor expanded in x around 0 55.8%
*-commutative55.8%
associate-/r*55.8%
unpow255.8%
Simplified55.8%
Final simplification64.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. (FPCore (x c s) :precision binary64 (let* ((t_0 (/ 1.0 (* s (* x c))))) (* 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 / (s * (x * c));
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 / (s * (x * c))
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 / (s * (x * c));
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 / (s * (x * c)) 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(s * Float64(x * c))) 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 / (s * (x * c));
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[(s * N[(x * c), $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}{s \cdot \left(x \cdot c\right)}\\
t_0 \cdot t_0
\end{array}
\end{array}
Initial program 62.5%
associate-/r*61.4%
unpow261.4%
*-commutative61.4%
unpow261.4%
Simplified61.4%
Taylor expanded in x around 0 55.5%
unpow255.5%
Simplified55.5%
div-inv55.3%
frac-times56.2%
associate-*r*52.8%
swap-sqr65.0%
*-commutative65.0%
*-commutative65.0%
swap-sqr82.2%
*-commutative82.2%
associate-*r*81.5%
*-commutative81.5%
associate-*r*82.7%
frac-times82.6%
Applied egg-rr82.6%
Final simplification82.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 (* (* c c) (* (* x s) (* x s)))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return 1.0 / ((c * c) * ((x * s) * (x * 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 = 1.0d0 / ((c * c) * ((x * s) * (x * 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 1.0 / ((c * c) * ((x * s) * (x * s)));
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return 1.0 / ((c * c) * ((x * s) * (x * s)))
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 * c) * Float64(Float64(x * s) * Float64(x * s)))) 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 * c) * ((x * s) * (x * 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[(1.0 / N[(N[(c * c), $MachinePrecision] * N[(N[(x * s), $MachinePrecision] * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{\left(c \cdot c\right) \cdot \left(\left(x \cdot s\right) \cdot \left(x \cdot s\right)\right)}
\end{array}
Initial program 62.5%
*-commutative62.5%
associate-*r*57.9%
associate-*r*59.1%
unpow259.1%
unswap-sqr74.3%
unpow274.3%
swap-sqr98.0%
*-commutative98.0%
*-commutative98.0%
*-commutative98.0%
*-commutative98.0%
Simplified98.0%
Taylor expanded in s around 0 95.3%
associate-*r*96.7%
*-commutative96.7%
swap-sqr75.3%
*-commutative75.3%
*-commutative75.3%
swap-sqr57.9%
associate-*r*62.5%
/-rgt-identity62.5%
clear-num61.4%
div-inv61.4%
clear-num61.4%
div-inv61.3%
frac-times62.5%
associate-*r*57.9%
swap-sqr75.3%
*-commutative75.3%
*-commutative75.3%
swap-sqr96.7%
*-commutative96.7%
associate-*r*95.3%
*-commutative95.3%
associate-*r*98.0%
Applied egg-rr98.0%
Taylor expanded in x around 0 52.8%
unpow252.8%
unpow252.8%
associate-*l*59.6%
associate-*l*61.4%
*-commutative61.4%
unpow261.4%
associate-*r*60.0%
unpow260.0%
*-commutative60.0%
associate-*r*53.9%
unpow253.9%
associate-*r*52.8%
unpow252.8%
unpow252.8%
swap-sqr65.0%
Simplified65.0%
Final simplification65.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. (FPCore (x c s) :precision binary64 (* (/ 1.0 s) (/ -2.0 (* c (* c s)))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return (1.0 / s) * (-2.0 / (c * (c * 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 = (1.0d0 / s) * ((-2.0d0) / (c * (c * 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 (1.0 / s) * (-2.0 / (c * (c * s)));
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return (1.0 / s) * (-2.0 / (c * (c * s)))
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(-2.0 / Float64(c * Float64(c * s)))) 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) * (-2.0 / (c * (c * 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[(N[(1.0 / s), $MachinePrecision] * N[(-2.0 / N[(c * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{s} \cdot \frac{-2}{c \cdot \left(c \cdot s\right)}
\end{array}
Initial program 62.5%
*-commutative62.5%
associate-*r*57.9%
associate-*r*59.1%
unpow259.1%
unswap-sqr74.3%
unpow274.3%
swap-sqr98.0%
*-commutative98.0%
*-commutative98.0%
*-commutative98.0%
*-commutative98.0%
Simplified98.0%
*-un-lft-identity98.0%
associate-*l*94.8%
times-frac94.8%
*-commutative94.8%
Applied egg-rr94.8%
Taylor expanded in x around 0 40.6%
associate-*r*40.1%
*-commutative40.1%
associate-*r*40.5%
associate-/r*40.4%
unpow240.4%
unpow240.4%
associate-*r/40.4%
metadata-eval40.4%
*-commutative40.4%
unpow240.4%
Simplified40.4%
Taylor expanded in x around inf 27.8%
unpow227.8%
associate-*l*25.5%
Simplified25.5%
Final simplification25.5%
herbie shell --seed 2023199
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))