id summary reporter owner description type status milestone component version severity resolution keywords cc 567 rational.hpp::gcd returns a negative value sometimes dbenbenn Jonathan Turkanis "{{{ boost/rational.hpp provides a gcd function, which is supposed to be non-negative. It sometimes returns a negative value, which can cause problems in other parts of rational.hpp. For example, assuming long is a 4-byte type, boost::gcd(6, -2147483648) returns -2. As a result, boost::rational(-1073741821, 6) + boost::rational(-1073741827, 6) produces an invalid rational number, 1073741824/-3, instead of the correct answer -1073741824/3. Here is a small patch to fix the problem. Note that this is how boost/math/common_factor_rt.hpp calculates the greatest common divisor. }}}" Patches closed None None Fixed