|
Boost : |
Subject: Re: [boost] [mp_int] Incorrect comparison with native types
From: Kevin Sopp (baraclese_at_[hidden])
Date: 2009-01-11 08:58:33
> (2)
>
> mp_int<> a = 13;
> int b = -1;
> cout << (a | b) << endl; // Should be -1, right?
No, -13 is the correct answer here. You're ORing the magnitude of both
numbers when using mp_ints. Unlike the built in integral types for
which the answer depends on the internal binary representation of
numbers (usually it's two's complement).
I fixed the other bugs now.
Kevin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk