
(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 20 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: 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 (* s x)))) (* (/ 1.0 t_0) (/ (- (pow (cos x) 4.0) (pow (sin x) 4.0)) t_0))))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = c * (s * x);
return (1.0 / t_0) * ((pow(cos(x), 4.0) - pow(sin(x), 4.0)) / t_0);
}
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 * (s * x)
code = (1.0d0 / t_0) * (((cos(x) ** 4.0d0) - (sin(x) ** 4.0d0)) / t_0)
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = c * (s * x);
return (1.0 / t_0) * ((Math.pow(Math.cos(x), 4.0) - Math.pow(Math.sin(x), 4.0)) / t_0);
}
s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = c * (s * x) return (1.0 / t_0) * ((math.pow(math.cos(x), 4.0) - math.pow(math.sin(x), 4.0)) / t_0)
s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(c * Float64(s * x)) return Float64(Float64(1.0 / t_0) * Float64(Float64((cos(x) ^ 4.0) - (sin(x) ^ 4.0)) / t_0)) end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
t_0 = c * (s * x);
tmp = (1.0 / t_0) * (((cos(x) ^ 4.0) - (sin(x) ^ 4.0)) / t_0);
end
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[(s * x), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(N[(N[Power[N[Cos[x], $MachinePrecision], 4.0], $MachinePrecision] - N[Power[N[Sin[x], $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := c \cdot \left(s \cdot x\right)\\
\frac{1}{t_0} \cdot \frac{{\cos x}^{4} - {\sin x}^{4}}{t_0}
\end{array}
\end{array}
Initial program 64.1%
associate-/r*63.8%
remove-double-neg63.8%
distribute-lft-neg-out63.8%
distribute-lft-neg-out63.8%
distribute-rgt-neg-out63.8%
associate-/r*64.1%
unpow264.1%
*-commutative64.1%
associate-*r*58.2%
sqr-neg58.2%
associate-*r*64.1%
unpow264.1%
Simplified64.1%
associate-*r*58.2%
*-commutative58.2%
associate-*l*59.0%
swap-sqr76.3%
*-commutative76.3%
add-sqr-sqrt76.3%
*-un-lft-identity76.3%
times-frac76.3%
Applied egg-rr97.7%
*-commutative97.7%
cos-298.0%
flip--98.0%
pow298.0%
pow298.0%
pow298.0%
pow298.0%
pow298.0%
pow298.0%
Applied egg-rr98.0%
pow-sqr98.0%
metadata-eval98.0%
pow-sqr98.0%
metadata-eval98.0%
unpow298.0%
unpow298.0%
cos-sin-sum98.0%
Simplified98.0%
Final simplification98.0%
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 6e-40)
(* (/ (/ 1.0 c) (* s x)) (* (/ 1.0 c) (/ (/ 1.0 s) x)))
(if (<= x 5e+30)
(/ t_0 (* (* x x) (* (* c s) (* c s))))
(/ t_0 (* x (* (* s s) (* c (* c x)))))))))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 <= 6e-40) {
tmp = ((1.0 / c) / (s * x)) * ((1.0 / c) * ((1.0 / s) / x));
} else if (x <= 5e+30) {
tmp = t_0 / ((x * x) * ((c * s) * (c * s)));
} else {
tmp = t_0 / (x * ((s * s) * (c * (c * x))));
}
return tmp;
}
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 <= 6d-40) then
tmp = ((1.0d0 / c) / (s * x)) * ((1.0d0 / c) * ((1.0d0 / s) / x))
else if (x <= 5d+30) then
tmp = t_0 / ((x * x) * ((c * s) * (c * s)))
else
tmp = t_0 / (x * ((s * s) * (c * (c * x))))
end if
code = tmp
end function
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 <= 6e-40) {
tmp = ((1.0 / c) / (s * x)) * ((1.0 / c) * ((1.0 / s) / x));
} else if (x <= 5e+30) {
tmp = t_0 / ((x * x) * ((c * s) * (c * s)));
} else {
tmp = t_0 / (x * ((s * s) * (c * (c * x))));
}
return tmp;
}
s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = math.cos((x * 2.0)) tmp = 0 if x <= 6e-40: tmp = ((1.0 / c) / (s * x)) * ((1.0 / c) * ((1.0 / s) / x)) elif x <= 5e+30: tmp = t_0 / ((x * x) * ((c * s) * (c * s))) else: tmp = t_0 / (x * ((s * s) * (c * (c * x)))) return tmp
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 <= 6e-40) tmp = Float64(Float64(Float64(1.0 / c) / Float64(s * x)) * Float64(Float64(1.0 / c) * Float64(Float64(1.0 / s) / x))); elseif (x <= 5e+30) tmp = Float64(t_0 / Float64(Float64(x * x) * Float64(Float64(c * s) * Float64(c * s)))); else tmp = Float64(t_0 / Float64(x * Float64(Float64(s * s) * Float64(c * Float64(c * x))))); end return tmp end
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 <= 6e-40)
tmp = ((1.0 / c) / (s * x)) * ((1.0 / c) * ((1.0 / s) / x));
elseif (x <= 5e+30)
tmp = t_0 / ((x * x) * ((c * s) * (c * s)));
else
tmp = t_0 / (x * ((s * s) * (c * (c * x))));
end
tmp_2 = tmp;
end
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, 6e-40], N[(N[(N[(1.0 / c), $MachinePrecision] / N[(s * x), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / c), $MachinePrecision] * N[(N[(1.0 / s), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5e+30], N[(t$95$0 / N[(N[(x * x), $MachinePrecision] * N[(N[(c * s), $MachinePrecision] * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(x * N[(N[(s * s), $MachinePrecision] * N[(c * N[(c * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := \cos \left(x \cdot 2\right)\\
\mathbf{if}\;x \leq 6 \cdot 10^{-40}:\\
\;\;\;\;\frac{\frac{1}{c}}{s \cdot x} \cdot \left(\frac{1}{c} \cdot \frac{\frac{1}{s}}{x}\right)\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+30}:\\
\;\;\;\;\frac{t_0}{\left(x \cdot x\right) \cdot \left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{x \cdot \left(\left(s \cdot s\right) \cdot \left(c \cdot \left(c \cdot x\right)\right)\right)}\\
\end{array}
\end{array}
if x < 6.00000000000000039e-40Initial program 63.5%
associate-/r*63.5%
remove-double-neg63.5%
distribute-lft-neg-out63.5%
distribute-lft-neg-out63.5%
distribute-rgt-neg-out63.5%
associate-/r*63.5%
unpow263.5%
*-commutative63.5%
associate-*r*55.9%
sqr-neg55.9%
associate-*r*63.5%
unpow263.5%
Simplified63.5%
associate-*r*55.9%
*-commutative55.9%
associate-*l*57.0%
swap-sqr74.4%
*-commutative74.4%
add-sqr-sqrt74.4%
*-un-lft-identity74.4%
times-frac74.4%
Applied egg-rr97.0%
Taylor expanded in x around 0 85.4%
*-commutative85.4%
associate-/r*85.5%
Simplified85.5%
*-un-lft-identity85.5%
associate-/r*85.5%
Applied egg-rr85.5%
div-inv85.5%
associate-/r*85.5%
Applied egg-rr85.5%
if 6.00000000000000039e-40 < x < 4.9999999999999998e30Initial program 90.8%
associate-/r*90.8%
*-commutative90.8%
associate-*l*90.8%
unpow290.8%
unpow290.8%
associate-*r*90.8%
associate-/r*91.1%
associate-/l/91.1%
associate-/l/91.2%
*-commutative91.2%
associate-*l*91.4%
unpow291.4%
associate-*l*90.8%
unpow290.8%
unswap-sqr99.9%
*-commutative99.9%
*-commutative99.9%
Simplified99.9%
if 4.9999999999999998e30 < x Initial program 61.3%
associate-/r*59.7%
remove-double-neg59.7%
distribute-lft-neg-out59.7%
distribute-lft-neg-out59.7%
distribute-rgt-neg-out59.7%
associate-/l/61.3%
distribute-rgt-neg-out61.3%
distribute-lft-neg-out61.3%
associate-*l*62.7%
distribute-lft-neg-in62.7%
distribute-lft-neg-out62.7%
remove-double-neg62.7%
associate-*r*62.8%
*-commutative62.8%
associate-*r*61.2%
Simplified71.0%
Taylor expanded in x around 0 62.8%
unpow262.8%
unpow262.8%
associate-*r*72.5%
Simplified72.5%
Final simplification83.0%
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 5e-43) (* (/ (/ 1.0 c) (* s x)) (* (/ 1.0 c) (/ (/ 1.0 s) x))) (/ (cos (* x 2.0)) (* x (* x (* c (* c (* s s))))))))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (x <= 5e-43) {
tmp = ((1.0 / c) / (s * x)) * ((1.0 / c) * ((1.0 / s) / x));
} else {
tmp = cos((x * 2.0)) / (x * (x * (c * (c * (s * s)))));
}
return tmp;
}
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 <= 5d-43) then
tmp = ((1.0d0 / c) / (s * x)) * ((1.0d0 / c) * ((1.0d0 / s) / x))
else
tmp = cos((x * 2.0d0)) / (x * (x * (c * (c * (s * s)))))
end if
code = tmp
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double tmp;
if (x <= 5e-43) {
tmp = ((1.0 / c) / (s * x)) * ((1.0 / c) * ((1.0 / s) / x));
} else {
tmp = Math.cos((x * 2.0)) / (x * (x * (c * (c * (s * s)))));
}
return tmp;
}
s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): tmp = 0 if x <= 5e-43: tmp = ((1.0 / c) / (s * x)) * ((1.0 / c) * ((1.0 / s) / x)) else: tmp = math.cos((x * 2.0)) / (x * (x * (c * (c * (s * s))))) return tmp
s = abs(s) c, s = sort([c, s]) function code(x, c, s) tmp = 0.0 if (x <= 5e-43) tmp = Float64(Float64(Float64(1.0 / c) / Float64(s * x)) * Float64(Float64(1.0 / c) * Float64(Float64(1.0 / s) / x))); else tmp = Float64(cos(Float64(x * 2.0)) / Float64(x * Float64(x * Float64(c * Float64(c * Float64(s * s)))))); end return tmp end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
tmp = 0.0;
if (x <= 5e-43)
tmp = ((1.0 / c) / (s * x)) * ((1.0 / c) * ((1.0 / s) / x));
else
tmp = cos((x * 2.0)) / (x * (x * (c * (c * (s * s)))));
end
tmp_2 = tmp;
end
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, 5e-43], N[(N[(N[(1.0 / c), $MachinePrecision] / N[(s * x), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / c), $MachinePrecision] * N[(N[(1.0 / s), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(x * N[(x * N[(c * N[(c * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5 \cdot 10^{-43}:\\
\;\;\;\;\frac{\frac{1}{c}}{s \cdot x} \cdot \left(\frac{1}{c} \cdot \frac{\frac{1}{s}}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{x \cdot \left(x \cdot \left(c \cdot \left(c \cdot \left(s \cdot s\right)\right)\right)\right)}\\
\end{array}
\end{array}
if x < 5.00000000000000019e-43Initial program 63.3%
associate-/r*63.3%
remove-double-neg63.3%
distribute-lft-neg-out63.3%
distribute-lft-neg-out63.3%
distribute-rgt-neg-out63.3%
associate-/r*63.3%
unpow263.3%
*-commutative63.3%
associate-*r*55.6%
sqr-neg55.6%
associate-*r*63.3%
unpow263.3%
Simplified63.3%
associate-*r*55.6%
*-commutative55.6%
associate-*l*56.8%
swap-sqr74.3%
*-commutative74.3%
add-sqr-sqrt74.3%
*-un-lft-identity74.3%
times-frac74.3%
Applied egg-rr97.0%
Taylor expanded in x around 0 85.3%
*-commutative85.3%
associate-/r*85.4%
Simplified85.4%
*-un-lft-identity85.4%
associate-/r*85.4%
Applied egg-rr85.4%
div-inv85.4%
associate-/r*85.4%
Applied egg-rr85.4%
if 5.00000000000000019e-43 < x Initial program 66.3%
associate-/r*64.9%
remove-double-neg64.9%
distribute-lft-neg-out64.9%
distribute-lft-neg-out64.9%
distribute-rgt-neg-out64.9%
associate-/l/66.3%
distribute-rgt-neg-out66.3%
distribute-lft-neg-out66.3%
associate-*l*67.5%
distribute-lft-neg-in67.5%
distribute-lft-neg-out67.5%
remove-double-neg67.5%
associate-*r*67.5%
*-commutative67.5%
associate-*r*66.1%
Simplified74.3%
Final simplification82.3%
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 5e-43) (* (/ (/ 1.0 c) (* s x)) (* (/ 1.0 c) (/ (/ 1.0 s) x))) (/ (cos (* x 2.0)) (* x (* x (* c (* s (* c s))))))))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (x <= 5e-43) {
tmp = ((1.0 / c) / (s * x)) * ((1.0 / c) * ((1.0 / s) / x));
} else {
tmp = cos((x * 2.0)) / (x * (x * (c * (s * (c * s)))));
}
return tmp;
}
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 <= 5d-43) then
tmp = ((1.0d0 / c) / (s * x)) * ((1.0d0 / c) * ((1.0d0 / s) / x))
else
tmp = cos((x * 2.0d0)) / (x * (x * (c * (s * (c * s)))))
end if
code = tmp
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double tmp;
if (x <= 5e-43) {
tmp = ((1.0 / c) / (s * x)) * ((1.0 / c) * ((1.0 / s) / x));
} else {
tmp = Math.cos((x * 2.0)) / (x * (x * (c * (s * (c * s)))));
}
return tmp;
}
s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): tmp = 0 if x <= 5e-43: tmp = ((1.0 / c) / (s * x)) * ((1.0 / c) * ((1.0 / s) / x)) else: tmp = math.cos((x * 2.0)) / (x * (x * (c * (s * (c * s))))) return tmp
s = abs(s) c, s = sort([c, s]) function code(x, c, s) tmp = 0.0 if (x <= 5e-43) tmp = Float64(Float64(Float64(1.0 / c) / Float64(s * x)) * Float64(Float64(1.0 / c) * Float64(Float64(1.0 / s) / x))); else tmp = Float64(cos(Float64(x * 2.0)) / Float64(x * Float64(x * Float64(c * Float64(s * Float64(c * s)))))); end return tmp end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
tmp = 0.0;
if (x <= 5e-43)
tmp = ((1.0 / c) / (s * x)) * ((1.0 / c) * ((1.0 / s) / x));
else
tmp = cos((x * 2.0)) / (x * (x * (c * (s * (c * s)))));
end
tmp_2 = tmp;
end
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, 5e-43], N[(N[(N[(1.0 / c), $MachinePrecision] / N[(s * x), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / c), $MachinePrecision] * N[(N[(1.0 / s), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(x * N[(x * N[(c * N[(s * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5 \cdot 10^{-43}:\\
\;\;\;\;\frac{\frac{1}{c}}{s \cdot x} \cdot \left(\frac{1}{c} \cdot \frac{\frac{1}{s}}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{x \cdot \left(x \cdot \left(c \cdot \left(s \cdot \left(c \cdot s\right)\right)\right)\right)}\\
\end{array}
\end{array}
if x < 5.00000000000000019e-43Initial program 63.3%
associate-/r*63.3%
remove-double-neg63.3%
distribute-lft-neg-out63.3%
distribute-lft-neg-out63.3%
distribute-rgt-neg-out63.3%
associate-/r*63.3%
unpow263.3%
*-commutative63.3%
associate-*r*55.6%
sqr-neg55.6%
associate-*r*63.3%
unpow263.3%
Simplified63.3%
associate-*r*55.6%
*-commutative55.6%
associate-*l*56.8%
swap-sqr74.3%
*-commutative74.3%
add-sqr-sqrt74.3%
*-un-lft-identity74.3%
times-frac74.3%
Applied egg-rr97.0%
Taylor expanded in x around 0 85.3%
*-commutative85.3%
associate-/r*85.4%
Simplified85.4%
*-un-lft-identity85.4%
associate-/r*85.4%
Applied egg-rr85.4%
div-inv85.4%
associate-/r*85.4%
Applied egg-rr85.4%
if 5.00000000000000019e-43 < x Initial program 66.3%
associate-/r*64.9%
remove-double-neg64.9%
distribute-lft-neg-out64.9%
distribute-lft-neg-out64.9%
distribute-rgt-neg-out64.9%
associate-/l/66.3%
distribute-rgt-neg-out66.3%
distribute-lft-neg-out66.3%
associate-*l*67.5%
distribute-lft-neg-in67.5%
distribute-lft-neg-out67.5%
remove-double-neg67.5%
associate-*r*67.5%
*-commutative67.5%
associate-*r*66.1%
Simplified74.3%
Taylor expanded in c around 0 74.3%
unpow256.8%
associate-*r*64.9%
Simplified86.5%
Final simplification85.7%
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 9.5e+146) (/ (cos (* x 2.0)) (* x (* (* s s) (* c (* c x))))) (* (/ (/ 1.0 c) (* s x)) (* (/ 1.0 c) (/ (/ 1.0 s) x)))))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (s <= 9.5e+146) {
tmp = cos((x * 2.0)) / (x * ((s * s) * (c * (c * x))));
} else {
tmp = ((1.0 / c) / (s * x)) * ((1.0 / c) * ((1.0 / s) / x));
}
return tmp;
}
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 <= 9.5d+146) then
tmp = cos((x * 2.0d0)) / (x * ((s * s) * (c * (c * x))))
else
tmp = ((1.0d0 / c) / (s * x)) * ((1.0d0 / c) * ((1.0d0 / s) / x))
end if
code = tmp
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double tmp;
if (s <= 9.5e+146) {
tmp = Math.cos((x * 2.0)) / (x * ((s * s) * (c * (c * x))));
} else {
tmp = ((1.0 / c) / (s * x)) * ((1.0 / c) * ((1.0 / s) / x));
}
return tmp;
}
s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): tmp = 0 if s <= 9.5e+146: tmp = math.cos((x * 2.0)) / (x * ((s * s) * (c * (c * x)))) else: tmp = ((1.0 / c) / (s * x)) * ((1.0 / c) * ((1.0 / s) / x)) return tmp
s = abs(s) c, s = sort([c, s]) function code(x, c, s) tmp = 0.0 if (s <= 9.5e+146) tmp = Float64(cos(Float64(x * 2.0)) / Float64(x * Float64(Float64(s * s) * Float64(c * Float64(c * x))))); else tmp = Float64(Float64(Float64(1.0 / c) / Float64(s * x)) * Float64(Float64(1.0 / c) * Float64(Float64(1.0 / s) / x))); end return tmp end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
tmp = 0.0;
if (s <= 9.5e+146)
tmp = cos((x * 2.0)) / (x * ((s * s) * (c * (c * x))));
else
tmp = ((1.0 / c) / (s * x)) * ((1.0 / c) * ((1.0 / s) / x));
end
tmp_2 = tmp;
end
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, 9.5e+146], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(x * N[(N[(s * s), $MachinePrecision] * N[(c * N[(c * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / c), $MachinePrecision] / N[(s * x), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / c), $MachinePrecision] * N[(N[(1.0 / s), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;s \leq 9.5 \cdot 10^{+146}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{x \cdot \left(\left(s \cdot s\right) \cdot \left(c \cdot \left(c \cdot x\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{c}}{s \cdot x} \cdot \left(\frac{1}{c} \cdot \frac{\frac{1}{s}}{x}\right)\\
\end{array}
\end{array}
if s < 9.49999999999999926e146Initial program 65.0%
associate-/r*64.6%
remove-double-neg64.6%
distribute-lft-neg-out64.6%
distribute-lft-neg-out64.6%
distribute-rgt-neg-out64.6%
associate-/l/65.0%
distribute-rgt-neg-out65.0%
distribute-lft-neg-out65.0%
associate-*l*66.4%
distribute-lft-neg-in66.4%
distribute-lft-neg-out66.4%
remove-double-neg66.4%
associate-*r*67.3%
*-commutative67.3%
associate-*r*66.1%
Simplified74.3%
Taylor expanded in x around 0 67.3%
unpow267.3%
unpow267.3%
associate-*r*74.8%
Simplified74.8%
if 9.49999999999999926e146 < s Initial program 55.0%
associate-/r*54.6%
remove-double-neg54.6%
distribute-lft-neg-out54.6%
distribute-lft-neg-out54.6%
distribute-rgt-neg-out54.6%
associate-/r*55.0%
unpow255.0%
*-commutative55.0%
associate-*r*45.8%
sqr-neg45.8%
associate-*r*55.0%
unpow255.0%
Simplified55.0%
associate-*r*45.8%
*-commutative45.8%
associate-*l*45.8%
swap-sqr86.5%
*-commutative86.5%
add-sqr-sqrt86.5%
*-un-lft-identity86.5%
times-frac86.5%
Applied egg-rr99.8%
Taylor expanded in x around 0 91.1%
*-commutative91.1%
associate-/r*91.1%
Simplified91.1%
*-un-lft-identity91.1%
associate-/r*91.1%
Applied egg-rr91.1%
div-inv91.1%
associate-/r*91.1%
Applied egg-rr91.1%
Final simplification76.2%
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 (* s x)))) (* (/ 1.0 t_0) (/ (cos (* x 2.0)) t_0))))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = c * (s * x);
return (1.0 / t_0) * (cos((x * 2.0)) / t_0);
}
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 * (s * x)
code = (1.0d0 / t_0) * (cos((x * 2.0d0)) / t_0)
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = c * (s * x);
return (1.0 / t_0) * (Math.cos((x * 2.0)) / t_0);
}
s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = c * (s * x) return (1.0 / t_0) * (math.cos((x * 2.0)) / t_0)
s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(c * Float64(s * x)) return Float64(Float64(1.0 / t_0) * Float64(cos(Float64(x * 2.0)) / t_0)) end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
t_0 = c * (s * x);
tmp = (1.0 / t_0) * (cos((x * 2.0)) / t_0);
end
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[(s * x), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := c \cdot \left(s \cdot x\right)\\
\frac{1}{t_0} \cdot \frac{\cos \left(x \cdot 2\right)}{t_0}
\end{array}
\end{array}
Initial program 64.1%
associate-/r*63.8%
remove-double-neg63.8%
distribute-lft-neg-out63.8%
distribute-lft-neg-out63.8%
distribute-rgt-neg-out63.8%
associate-/r*64.1%
unpow264.1%
*-commutative64.1%
associate-*r*58.2%
sqr-neg58.2%
associate-*r*64.1%
unpow264.1%
Simplified64.1%
associate-*r*58.2%
*-commutative58.2%
associate-*l*59.0%
swap-sqr76.3%
*-commutative76.3%
add-sqr-sqrt76.3%
*-un-lft-identity76.3%
times-frac76.3%
Applied egg-rr97.7%
Final simplification97.7%
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 (* s x))) (/ (/ (cos (* x 2.0)) (* s x)) c)))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return (1.0 / (c * (s * x))) * ((cos((x * 2.0)) / (s * x)) / c);
}
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 * (s * x))) * ((cos((x * 2.0d0)) / (s * x)) / c)
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return (1.0 / (c * (s * x))) * ((Math.cos((x * 2.0)) / (s * x)) / c);
}
s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return (1.0 / (c * (s * x))) * ((math.cos((x * 2.0)) / (s * x)) / c)
s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(Float64(1.0 / Float64(c * Float64(s * x))) * Float64(Float64(cos(Float64(x * 2.0)) / Float64(s * x)) / c)) end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = (1.0 / (c * (s * x))) * ((cos((x * 2.0)) / (s * x)) / c);
end
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 / N[(c * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(s * x), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{c \cdot \left(s \cdot x\right)} \cdot \frac{\frac{\cos \left(x \cdot 2\right)}{s \cdot x}}{c}
\end{array}
Initial program 64.1%
associate-/r*63.8%
remove-double-neg63.8%
distribute-lft-neg-out63.8%
distribute-lft-neg-out63.8%
distribute-rgt-neg-out63.8%
associate-/r*64.1%
unpow264.1%
*-commutative64.1%
associate-*r*58.2%
sqr-neg58.2%
associate-*r*64.1%
unpow264.1%
Simplified64.1%
associate-*r*58.2%
*-commutative58.2%
associate-*l*59.0%
swap-sqr76.3%
*-commutative76.3%
add-sqr-sqrt76.3%
*-un-lft-identity76.3%
times-frac76.3%
Applied egg-rr97.7%
*-un-lft-identity97.7%
times-frac97.7%
Applied egg-rr97.7%
associate-*l/97.8%
*-un-lft-identity97.8%
*-commutative97.8%
Applied egg-rr97.8%
Final simplification97.8%
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) (* s x)) (* (/ 1.0 c) (/ (/ 1.0 s) x))))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return ((1.0 / c) / (s * x)) * ((1.0 / c) * ((1.0 / s) / x));
}
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) / (s * x)) * ((1.0d0 / c) * ((1.0d0 / s) / x))
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return ((1.0 / c) / (s * x)) * ((1.0 / c) * ((1.0 / s) / x));
}
s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return ((1.0 / c) / (s * x)) * ((1.0 / c) * ((1.0 / s) / x))
s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(Float64(Float64(1.0 / c) / Float64(s * x)) * Float64(Float64(1.0 / c) * Float64(Float64(1.0 / s) / x))) end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = ((1.0 / c) / (s * x)) * ((1.0 / c) * ((1.0 / s) / x));
end
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 / c), $MachinePrecision] / N[(s * x), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / c), $MachinePrecision] * N[(N[(1.0 / s), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{\frac{1}{c}}{s \cdot x} \cdot \left(\frac{1}{c} \cdot \frac{\frac{1}{s}}{x}\right)
\end{array}
Initial program 64.1%
associate-/r*63.8%
remove-double-neg63.8%
distribute-lft-neg-out63.8%
distribute-lft-neg-out63.8%
distribute-rgt-neg-out63.8%
associate-/r*64.1%
unpow264.1%
*-commutative64.1%
associate-*r*58.2%
sqr-neg58.2%
associate-*r*64.1%
unpow264.1%
Simplified64.1%
associate-*r*58.2%
*-commutative58.2%
associate-*l*59.0%
swap-sqr76.3%
*-commutative76.3%
add-sqr-sqrt76.3%
*-un-lft-identity76.3%
times-frac76.3%
Applied egg-rr97.7%
Taylor expanded in x around 0 80.0%
*-commutative80.0%
associate-/r*80.0%
Simplified80.0%
*-un-lft-identity80.0%
associate-/r*80.0%
Applied egg-rr80.0%
div-inv80.0%
associate-/r*80.0%
Applied egg-rr80.0%
Final simplification80.0%
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 (<= c 6e-77) (/ 1.0 (* x (* x (* c (* s (* c s)))))) (/ 1.0 (* s (* x (* s (* c (* c x))))))))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (c <= 6e-77) {
tmp = 1.0 / (x * (x * (c * (s * (c * s)))));
} else {
tmp = 1.0 / (s * (x * (s * (c * (c * x)))));
}
return tmp;
}
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 (c <= 6d-77) then
tmp = 1.0d0 / (x * (x * (c * (s * (c * s)))))
else
tmp = 1.0d0 / (s * (x * (s * (c * (c * x)))))
end if
code = tmp
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double tmp;
if (c <= 6e-77) {
tmp = 1.0 / (x * (x * (c * (s * (c * s)))));
} else {
tmp = 1.0 / (s * (x * (s * (c * (c * x)))));
}
return tmp;
}
s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): tmp = 0 if c <= 6e-77: tmp = 1.0 / (x * (x * (c * (s * (c * s))))) else: tmp = 1.0 / (s * (x * (s * (c * (c * x))))) return tmp
s = abs(s) c, s = sort([c, s]) function code(x, c, s) tmp = 0.0 if (c <= 6e-77) tmp = Float64(1.0 / Float64(x * Float64(x * Float64(c * Float64(s * Float64(c * s)))))); else tmp = Float64(1.0 / Float64(s * Float64(x * Float64(s * Float64(c * Float64(c * x)))))); end return tmp end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
tmp = 0.0;
if (c <= 6e-77)
tmp = 1.0 / (x * (x * (c * (s * (c * s)))));
else
tmp = 1.0 / (s * (x * (s * (c * (c * x)))));
end
tmp_2 = tmp;
end
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[c, 6e-77], N[(1.0 / N[(x * N[(x * N[(c * N[(s * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(s * N[(x * N[(s * N[(c * N[(c * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;c \leq 6 \cdot 10^{-77}:\\
\;\;\;\;\frac{1}{x \cdot \left(x \cdot \left(c \cdot \left(s \cdot \left(c \cdot s\right)\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{s \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot x\right)\right)\right)\right)}\\
\end{array}
\end{array}
if c < 6.00000000000000033e-77Initial program 66.4%
associate-/r*65.8%
remove-double-neg65.8%
distribute-lft-neg-out65.8%
distribute-lft-neg-out65.8%
distribute-rgt-neg-out65.8%
associate-/l/66.4%
distribute-rgt-neg-out66.4%
distribute-lft-neg-out66.4%
associate-*l*67.5%
distribute-lft-neg-in67.5%
distribute-lft-neg-out67.5%
remove-double-neg67.5%
associate-*r*68.2%
*-commutative68.2%
associate-*r*67.7%
Simplified76.3%
Taylor expanded in x around 0 67.6%
Taylor expanded in c around 0 67.6%
unpow267.6%
associate-*r*74.8%
Simplified74.8%
if 6.00000000000000033e-77 < c Initial program 59.1%
associate-/r*59.3%
remove-double-neg59.3%
distribute-lft-neg-out59.3%
distribute-lft-neg-out59.3%
distribute-rgt-neg-out59.3%
associate-/l/59.1%
distribute-rgt-neg-out59.1%
distribute-lft-neg-out59.1%
associate-*l*60.7%
distribute-lft-neg-in60.7%
distribute-lft-neg-out60.7%
remove-double-neg60.7%
associate-*r*62.0%
*-commutative62.0%
associate-*r*59.5%
Simplified69.5%
Taylor expanded in x around 0 61.5%
*-commutative61.5%
associate-*r*52.7%
associate-*r*55.0%
*-commutative55.0%
associate-*r*53.8%
*-commutative53.8%
associate-*r*52.2%
add-sqr-sqrt52.2%
pow252.2%
Applied egg-rr82.3%
associate-*r*83.5%
*-commutative83.5%
unpow-prod-down66.5%
pow266.5%
associate-*l*71.4%
unpow271.4%
swap-sqr52.7%
associate-*r*55.0%
associate-*r*63.6%
associate-*l*70.3%
associate-*l*71.7%
Applied egg-rr71.7%
Final simplification73.8%
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 (* s x))))) (* t_0 t_0)))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = 1.0 / (c * (s * x));
return t_0 * t_0;
}
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 * (s * x))
code = t_0 * t_0
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = 1.0 / (c * (s * x));
return t_0 * t_0;
}
s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = 1.0 / (c * (s * x)) return t_0 * t_0
s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(1.0 / Float64(c * Float64(s * x))) return Float64(t_0 * t_0) end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
t_0 = 1.0 / (c * (s * x));
tmp = t_0 * t_0;
end
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[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * t$95$0), $MachinePrecision]]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := \frac{1}{c \cdot \left(s \cdot x\right)}\\
t_0 \cdot t_0
\end{array}
\end{array}
Initial program 64.1%
associate-/r*63.8%
remove-double-neg63.8%
distribute-lft-neg-out63.8%
distribute-lft-neg-out63.8%
distribute-rgt-neg-out63.8%
associate-/r*64.1%
unpow264.1%
*-commutative64.1%
associate-*r*58.2%
sqr-neg58.2%
associate-*r*64.1%
unpow264.1%
Simplified64.1%
associate-*r*58.2%
*-commutative58.2%
associate-*l*59.0%
swap-sqr76.3%
*-commutative76.3%
add-sqr-sqrt76.3%
*-un-lft-identity76.3%
times-frac76.3%
Applied egg-rr97.7%
Taylor expanded in x around 0 80.0%
Final simplification80.0%
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 (* s x))) (/ (/ 1.0 c) (* s x))))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return (1.0 / (c * (s * x))) * ((1.0 / c) / (s * x));
}
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 * (s * x))) * ((1.0d0 / c) / (s * x))
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return (1.0 / (c * (s * x))) * ((1.0 / c) / (s * x));
}
s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return (1.0 / (c * (s * x))) * ((1.0 / c) / (s * x))
s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(Float64(1.0 / Float64(c * Float64(s * x))) * Float64(Float64(1.0 / c) / Float64(s * x))) end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = (1.0 / (c * (s * x))) * ((1.0 / c) / (s * x));
end
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 / N[(c * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / c), $MachinePrecision] / N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{c \cdot \left(s \cdot x\right)} \cdot \frac{\frac{1}{c}}{s \cdot x}
\end{array}
Initial program 64.1%
associate-/r*63.8%
remove-double-neg63.8%
distribute-lft-neg-out63.8%
distribute-lft-neg-out63.8%
distribute-rgt-neg-out63.8%
associate-/r*64.1%
unpow264.1%
*-commutative64.1%
associate-*r*58.2%
sqr-neg58.2%
associate-*r*64.1%
unpow264.1%
Simplified64.1%
associate-*r*58.2%
*-commutative58.2%
associate-*l*59.0%
swap-sqr76.3%
*-commutative76.3%
add-sqr-sqrt76.3%
*-un-lft-identity76.3%
times-frac76.3%
Applied egg-rr97.7%
*-un-lft-identity97.7%
times-frac97.7%
Applied egg-rr97.7%
associate-*l/97.8%
*-un-lft-identity97.8%
*-commutative97.8%
Applied egg-rr97.8%
Taylor expanded in x around 0 80.0%
associate-/r*80.0%
Simplified80.0%
Final simplification80.0%
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 (* s x))) (/ (/ (/ 1.0 x) s) c)))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return (1.0 / (c * (s * x))) * (((1.0 / x) / s) / c);
}
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 * (s * x))) * (((1.0d0 / x) / s) / c)
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return (1.0 / (c * (s * x))) * (((1.0 / x) / s) / c);
}
s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return (1.0 / (c * (s * x))) * (((1.0 / x) / s) / c)
s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(Float64(1.0 / Float64(c * Float64(s * x))) * Float64(Float64(Float64(1.0 / x) / s) / c)) end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = (1.0 / (c * (s * x))) * (((1.0 / x) / s) / c);
end
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 / N[(c * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1.0 / x), $MachinePrecision] / s), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{c \cdot \left(s \cdot x\right)} \cdot \frac{\frac{\frac{1}{x}}{s}}{c}
\end{array}
Initial program 64.1%
associate-/r*63.8%
remove-double-neg63.8%
distribute-lft-neg-out63.8%
distribute-lft-neg-out63.8%
distribute-rgt-neg-out63.8%
associate-/r*64.1%
unpow264.1%
*-commutative64.1%
associate-*r*58.2%
sqr-neg58.2%
associate-*r*64.1%
unpow264.1%
Simplified64.1%
associate-*r*58.2%
*-commutative58.2%
associate-*l*59.0%
swap-sqr76.3%
*-commutative76.3%
add-sqr-sqrt76.3%
*-un-lft-identity76.3%
times-frac76.3%
Applied egg-rr97.7%
*-un-lft-identity97.7%
times-frac97.7%
Applied egg-rr97.7%
associate-*l/97.8%
*-un-lft-identity97.8%
*-commutative97.8%
Applied egg-rr97.8%
Taylor expanded in x around 0 80.0%
associate-/l/80.0%
Simplified80.0%
Final simplification80.0%
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 (* s x))) (/ (/ (/ 1.0 s) x) c)))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return (1.0 / (c * (s * x))) * (((1.0 / s) / x) / c);
}
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 * (s * x))) * (((1.0d0 / s) / x) / c)
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return (1.0 / (c * (s * x))) * (((1.0 / s) / x) / c);
}
s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return (1.0 / (c * (s * x))) * (((1.0 / s) / x) / c)
s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(Float64(1.0 / Float64(c * Float64(s * x))) * Float64(Float64(Float64(1.0 / s) / x) / c)) end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = (1.0 / (c * (s * x))) * (((1.0 / s) / x) / c);
end
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 / N[(c * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1.0 / s), $MachinePrecision] / x), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{c \cdot \left(s \cdot x\right)} \cdot \frac{\frac{\frac{1}{s}}{x}}{c}
\end{array}
Initial program 64.1%
associate-/r*63.8%
remove-double-neg63.8%
distribute-lft-neg-out63.8%
distribute-lft-neg-out63.8%
distribute-rgt-neg-out63.8%
associate-/r*64.1%
unpow264.1%
*-commutative64.1%
associate-*r*58.2%
sqr-neg58.2%
associate-*r*64.1%
unpow264.1%
Simplified64.1%
associate-*r*58.2%
*-commutative58.2%
associate-*l*59.0%
swap-sqr76.3%
*-commutative76.3%
add-sqr-sqrt76.3%
*-un-lft-identity76.3%
times-frac76.3%
Applied egg-rr97.7%
Taylor expanded in x around 0 80.0%
*-commutative80.0%
associate-/r*80.0%
Simplified80.0%
*-un-lft-identity80.0%
associate-/r*80.0%
Applied egg-rr80.0%
Final simplification80.0%
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 (* (* c s) (* c (* x x))))))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return 1.0 / (s * ((c * s) * (c * (x * x))));
}
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 * ((c * s) * (c * (x * x))))
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return 1.0 / (s * ((c * s) * (c * (x * x))));
}
s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return 1.0 / (s * ((c * s) * (c * (x * x))))
s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(1.0 / Float64(s * Float64(Float64(c * s) * Float64(c * Float64(x * x))))) end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = 1.0 / (s * ((c * s) * (c * (x * x))));
end
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[(s * N[(N[(c * s), $MachinePrecision] * N[(c * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{s \cdot \left(\left(c \cdot s\right) \cdot \left(c \cdot \left(x \cdot x\right)\right)\right)}
\end{array}
Initial program 64.1%
associate-/r*63.8%
remove-double-neg63.8%
distribute-lft-neg-out63.8%
distribute-lft-neg-out63.8%
distribute-rgt-neg-out63.8%
associate-/l/64.1%
distribute-rgt-neg-out64.1%
distribute-lft-neg-out64.1%
associate-*l*65.4%
distribute-lft-neg-in65.4%
distribute-lft-neg-out65.4%
remove-double-neg65.4%
associate-*r*66.3%
*-commutative66.3%
associate-*r*65.2%
Simplified74.2%
Taylor expanded in x around 0 65.7%
*-commutative65.7%
associate-*r*58.1%
associate-*r*58.9%
*-commutative58.9%
associate-*r*58.5%
*-commutative58.5%
associate-*r*57.5%
add-sqr-sqrt57.5%
pow257.5%
Applied egg-rr79.6%
unpow279.6%
associate-*r*78.9%
*-commutative78.9%
associate-*r*80.2%
*-commutative80.2%
swap-sqr67.2%
unpow267.2%
associate-*l*74.9%
unpow274.9%
swap-sqr58.1%
associate-*r*58.9%
associate-*r*65.6%
associate-*r*68.1%
associate-*l*66.0%
associate-*l*72.7%
*-commutative72.7%
Applied egg-rr72.7%
associate-*l*74.4%
*-commutative74.4%
associate-*l*67.8%
Simplified67.8%
Final simplification67.8%
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 (* s (* c (* c x)))))))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return 1.0 / (s * (x * (s * (c * (c * x)))));
}
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 * (s * (c * (c * x)))))
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return 1.0 / (s * (x * (s * (c * (c * x)))));
}
s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return 1.0 / (s * (x * (s * (c * (c * x)))))
s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(1.0 / Float64(s * Float64(x * Float64(s * Float64(c * Float64(c * x)))))) end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = 1.0 / (s * (x * (s * (c * (c * x)))));
end
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[(s * N[(x * N[(s * N[(c * N[(c * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{s \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot x\right)\right)\right)\right)}
\end{array}
Initial program 64.1%
associate-/r*63.8%
remove-double-neg63.8%
distribute-lft-neg-out63.8%
distribute-lft-neg-out63.8%
distribute-rgt-neg-out63.8%
associate-/l/64.1%
distribute-rgt-neg-out64.1%
distribute-lft-neg-out64.1%
associate-*l*65.4%
distribute-lft-neg-in65.4%
distribute-lft-neg-out65.4%
remove-double-neg65.4%
associate-*r*66.3%
*-commutative66.3%
associate-*r*65.2%
Simplified74.2%
Taylor expanded in x around 0 65.7%
*-commutative65.7%
associate-*r*58.1%
associate-*r*58.9%
*-commutative58.9%
associate-*r*58.5%
*-commutative58.5%
associate-*r*57.5%
add-sqr-sqrt57.5%
pow257.5%
Applied egg-rr79.6%
associate-*r*80.2%
*-commutative80.2%
unpow-prod-down67.2%
pow267.2%
associate-*l*74.9%
unpow274.9%
swap-sqr58.1%
associate-*r*58.9%
associate-*r*65.6%
associate-*l*71.5%
associate-*l*72.1%
Applied egg-rr72.1%
Final simplification72.1%
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 s) (* x (* c (* s x))))))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return 1.0 / ((c * s) * (x * (c * (s * x))));
}
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 * s) * (x * (c * (s * x))))
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return 1.0 / ((c * s) * (x * (c * (s * x))));
}
s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return 1.0 / ((c * s) * (x * (c * (s * x))))
s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(1.0 / Float64(Float64(c * s) * Float64(x * Float64(c * Float64(s * x))))) end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = 1.0 / ((c * s) * (x * (c * (s * x))));
end
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 * s), $MachinePrecision] * N[(x * N[(c * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{\left(c \cdot s\right) \cdot \left(x \cdot \left(c \cdot \left(s \cdot x\right)\right)\right)}
\end{array}
Initial program 64.1%
associate-/r*63.8%
remove-double-neg63.8%
distribute-lft-neg-out63.8%
distribute-lft-neg-out63.8%
distribute-rgt-neg-out63.8%
associate-/l/64.1%
distribute-rgt-neg-out64.1%
distribute-lft-neg-out64.1%
associate-*l*65.4%
distribute-lft-neg-in65.4%
distribute-lft-neg-out65.4%
remove-double-neg65.4%
associate-*r*66.3%
*-commutative66.3%
associate-*r*65.2%
Simplified74.2%
Taylor expanded in x around 0 65.7%
*-commutative65.7%
associate-*r*58.1%
associate-*r*58.9%
*-commutative58.9%
associate-*r*58.5%
*-commutative58.5%
associate-*r*57.5%
add-sqr-sqrt57.5%
pow257.5%
Applied egg-rr79.6%
unpow279.6%
associate-*r*78.9%
*-commutative78.9%
associate-*l*77.4%
*-commutative77.4%
Applied egg-rr77.4%
Final simplification77.4%
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 (* s x)))) (/ 1.0 (* t_0 t_0))))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = c * (s * x);
return 1.0 / (t_0 * t_0);
}
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 * (s * x)
code = 1.0d0 / (t_0 * t_0)
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = c * (s * x);
return 1.0 / (t_0 * t_0);
}
s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = c * (s * x) return 1.0 / (t_0 * t_0)
s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(c * Float64(s * x)) return Float64(1.0 / Float64(t_0 * t_0)) end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
t_0 = c * (s * x);
tmp = 1.0 / (t_0 * t_0);
end
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[(s * x), $MachinePrecision]), $MachinePrecision]}, N[(1.0 / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := c \cdot \left(s \cdot x\right)\\
\frac{1}{t_0 \cdot t_0}
\end{array}
\end{array}
Initial program 64.1%
associate-/r*63.8%
remove-double-neg63.8%
distribute-lft-neg-out63.8%
distribute-lft-neg-out63.8%
distribute-rgt-neg-out63.8%
associate-/l/64.1%
distribute-rgt-neg-out64.1%
distribute-lft-neg-out64.1%
associate-*l*65.4%
distribute-lft-neg-in65.4%
distribute-lft-neg-out65.4%
remove-double-neg65.4%
associate-*r*66.3%
*-commutative66.3%
associate-*r*65.2%
Simplified74.2%
Taylor expanded in x around 0 65.7%
*-commutative65.7%
associate-*r*58.1%
associate-*r*58.9%
*-commutative58.9%
associate-*r*58.5%
*-commutative58.5%
associate-*r*57.5%
add-sqr-sqrt57.5%
pow257.5%
Applied egg-rr79.6%
unpow279.6%
Applied egg-rr79.6%
Final simplification79.6%
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 (* (* s x) (* c (* s x))))))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return 1.0 / (c * ((s * x) * (c * (s * x))));
}
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 * ((s * x) * (c * (s * x))))
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return 1.0 / (c * ((s * x) * (c * (s * x))));
}
s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return 1.0 / (c * ((s * x) * (c * (s * x))))
s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(1.0 / Float64(c * Float64(Float64(s * x) * Float64(c * Float64(s * x))))) end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = 1.0 / (c * ((s * x) * (c * (s * x))));
end
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[(c * N[(N[(s * x), $MachinePrecision] * N[(c * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{c \cdot \left(\left(s \cdot x\right) \cdot \left(c \cdot \left(s \cdot x\right)\right)\right)}
\end{array}
Initial program 64.1%
associate-/r*63.8%
remove-double-neg63.8%
distribute-lft-neg-out63.8%
distribute-lft-neg-out63.8%
distribute-rgt-neg-out63.8%
associate-/l/64.1%
distribute-rgt-neg-out64.1%
distribute-lft-neg-out64.1%
associate-*l*65.4%
distribute-lft-neg-in65.4%
distribute-lft-neg-out65.4%
remove-double-neg65.4%
associate-*r*66.3%
*-commutative66.3%
associate-*r*65.2%
Simplified74.2%
Taylor expanded in x around 0 65.7%
*-commutative65.7%
associate-*r*58.1%
associate-*r*58.9%
*-commutative58.9%
associate-*r*58.5%
*-commutative58.5%
associate-*r*57.5%
add-sqr-sqrt57.5%
pow257.5%
Applied egg-rr79.6%
unpow279.6%
*-commutative79.6%
associate-*r*79.4%
Applied egg-rr79.4%
Final simplification79.4%
NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ 1.0 (/ (/ (* c (- x)) x) (- c))))
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return 1.0 / (((c * -x) / x) / -c);
}
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) / x) / -c)
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return 1.0 / (((c * -x) / x) / -c);
}
s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return 1.0 / (((c * -x) / x) / -c)
s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(1.0 / Float64(Float64(Float64(c * Float64(-x)) / x) / Float64(-c))) end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = 1.0 / (((c * -x) / x) / -c);
end
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[(N[(c * (-x)), $MachinePrecision] / x), $MachinePrecision] / (-c)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{\frac{\frac{c \cdot \left(-x\right)}{x}}{-c}}
\end{array}
Initial program 64.1%
associate-/r*63.8%
remove-double-neg63.8%
distribute-lft-neg-out63.8%
distribute-lft-neg-out63.8%
distribute-rgt-neg-out63.8%
associate-/l/64.1%
distribute-rgt-neg-out64.1%
distribute-lft-neg-out64.1%
associate-*l*65.4%
distribute-lft-neg-in65.4%
distribute-lft-neg-out65.4%
remove-double-neg65.4%
associate-*r*66.3%
*-commutative66.3%
associate-*r*65.2%
Simplified74.2%
Taylor expanded in x around 0 65.7%
Taylor expanded in c around 0 65.7%
unpow265.7%
associate-*r*73.8%
Simplified73.8%
Taylor expanded in x around 0 58.9%
*-commutative58.9%
associate-*r*58.5%
unpow258.5%
unpow258.5%
Simplified58.5%
Applied egg-rr22.9%
times-frac26.7%
*-inverses26.7%
associate-*l/26.7%
*-rgt-identity26.7%
Simplified26.7%
Final simplification26.7%
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 = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return 1.0;
}
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
end function
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return 1.0;
}
s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return 1.0
s = abs(s) c, s = sort([c, s]) function code(x, c, s) return 1.0 end
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = 1.0;
end
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_] := 1.0
\begin{array}{l}
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
1
\end{array}
Initial program 64.1%
associate-/r*63.8%
remove-double-neg63.8%
distribute-lft-neg-out63.8%
distribute-lft-neg-out63.8%
distribute-rgt-neg-out63.8%
associate-/l/64.1%
distribute-rgt-neg-out64.1%
distribute-lft-neg-out64.1%
associate-*l*65.4%
distribute-lft-neg-in65.4%
distribute-lft-neg-out65.4%
remove-double-neg65.4%
associate-*r*66.3%
*-commutative66.3%
associate-*r*65.2%
Simplified74.2%
Taylor expanded in x around 0 65.7%
Taylor expanded in c around 0 65.7%
unpow265.7%
associate-*r*73.8%
Simplified73.8%
Taylor expanded in x around 0 58.9%
*-commutative58.9%
associate-*r*58.5%
unpow258.5%
unpow258.5%
Simplified58.5%
Applied egg-rr22.9%
associate-/r/24.0%
associate-*l/8.1%
associate-*r*2.3%
*-inverses3.6%
metadata-eval3.6%
Simplified3.6%
Final simplification3.6%
herbie shell --seed 2023279
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))