|
Boost : |
Subject: Re: [boost] [xint] Fourth release, requesting preliminary review again
From: Chad Nelson (chad.thecomfychair_at_[hidden])
Date: 2010-06-10 17:48:35
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 06/10/2010 03:49 PM, DE wrote:
>> [...] If you're doing anything more than simple addition and
>> subtraction, it probably will be.
>
> forgive me for repeating myself but yes, you did everything right
> i recalled that one ought to first measure and only then optimize
> (first shoot then ask questions...)
:-)
>> The library's fixed-size integers act like unsigned ints, as far as
>> modular arithmetic goes. Except, of course, that they're signed as well.
>> That's why I took pains to describe their behavior thoroughly, it's not
>> entirely obvious from knowledge of the built-in types.
>
> it's rather unusual for me
> so if i want to go unsigned bigint i just ignore the sign of fixed
> integers (in other words they're all positive)
> am i right?
In most cases, that will work, because overflows will be truncated to
the proper number of bits. I hadn't considered underflows though, until
you mentioned it in your next paragraph.
> one small issue i can think about is 'a - b' where a<b
> according to mod. arith. 'a - b' is equivalent to '(mod + a - b)%mod'
> is that case preserved by fixed_integer?
Not at present. It would be easy enough to add that to the current
design though, as yet another template parameter (Signed/Unsigned). I've
put that on the to-do list.
I'm not sure whether that will make the fifth release (which I hope to
have ready tomorrow, if all goes well, so people can play with it over
the weekend). If it doesn't, I'll add it as soon after that as I can.
> i misunderstood the docs and probably poorly expressed my thought
> sorry
I'm not sure you did. I hadn't considered how negative numbers would
affect that. If that's the cause of the misunderstanding, it was
entirely my fault, and I apologize.
- --
Chad Nelson
Oak Circle Software, Inc.
*
*
*
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkwRXbMACgkQp9x9jeZ9/wQj3ACg7xNVheu1v1Y30KtAZA4UWul7
W+kAn1gXiUfkjSJDPEQvbsunXx1gVu7+
=5dYy
-----END PGP SIGNATURE-----
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk