Boost logo

Boost :

Subject: Re: [boost] [mp_int] Incorrect comparison with native types
From: Nathan Kitchen (nathan.kitchen_at_[hidden])
Date: 2009-01-13 11:45:50

On Tue, Jan 13, 2009 at 6:11 AM, Kevin Sopp <baraclese_at_[hidden]> wrote:
>> The interpretation of OR that you describe is consistent with
>> libtommath (of course) but not with other arbitrary-precision-integer
>> packages that I have tried. When I try either 13 OR -1 or (BIG(1) <<
>> 200) | -1, I get -1 from all of the following:
>> gmp
>> java.math.BigInteger
>> Python's built-in long type
>> Ruby's built-in Bignum type
>> Likewise, all of these give me -14 for (BIG(13) ^ -1), while
>> libtommath and mp_int give -12.
> Are you trying to say that you prefer the behavior of the other libraries?

Yes, I think the common behavior is the most natural expectation,
since it makes the behavior of mp_ints consistent with that of native
types, at least on platforms that use two's-complement for negative
numbers. I understand that two's-complement is not required by the
language standard, but as best I know it's used practically

-- Nathan

Boost list run by bdawes at, gregod at, cpdaniel at, john at