|
Boost : |
Subject: Re: [boost] [mp_int] Incorrect comparison with native types
From: Nathan Kitchen (nathan.kitchen_at_[hidden])
Date: 2009-01-11 00:04:08
Other operations with incorrect results:
(1)
mp_int<> a = "0x100000000";
a = -a;
cout << (a < -1) << endl;
This can be fixed by changing line 228 of
mp_math/mp_int/detail/integral_ops.hpp (in integral_ops_impl<...,
true>::less):
if (lhs.size() > q)
- return false;
+ return lhs.sign() == -1;
(2)
mp_int<> a = 13;
int b = -1;
cout << (a | b) << endl; // Should be -1, right?
Likewise for bitwise AND and XOR.
-- Nathan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk