rational.hpp requires working unary minus

28 Apr
2006
28 Apr
'06
4:19 a.m.
Test Code: std::numeric_limits<long> lm; boost::rational<long> mn( lm.min() ); std::cout << mn << '=' << mn / 1 << std::endl; Output: -2147483648/1=1/0 Reason: lm.min() == -2147483648 lm.max() == 2147483647 and unary minus is not well defined for lm.min(); on my system -lm.min() == -2147483648 The problem is expected with any computer representing negative integers using binary two's compliment.
6985
Age (days ago)
6985
Last active (days ago)
0 comments
1 participants
participants (1)
-
Yuriy Koblents-Mishke