Boost logo

Boost :

From: Yuriy Koblents-Mishke (yurakm_at_[hidden])
Date: 2006-04-28 00:19:41


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.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk