
26 Jun
2010
26 Jun
'10
4:22 p.m.
static_gcc and static_lcm have unsigned long parameters.
template < unsigned long Value1, unsigned long Value2 > struct boost::math::static_gcd;
Could these be changed to uintmax_t?
I would think so yes.
Is there any deep reason to don't define them for singed integers (intmax_t) also?
No, since the result for both functions is always taken as positive for one or more negative arguments. However.... unless we change the interface, it's hard to see how to accomplish this easily? Particularly as the unsigned version has a greater range? Note that if the arguments might be negative then you could just write: static_lcm<(arg1 < 0 ? -arg1 : arg1), (arg2 < 0 ? -arg2 : arg2)>::value to achieve the same effect. HTH, John.