|
Boost : |
Subject: Re: [boost] New Boost.XInt Library, request preliminary review
From: Jeffrey Lee Hellrung, Jr. (jhellrung_at_[hidden])
Date: 2010-04-03 22:22:36
Chad Nelson wrote:
[...]
>> Well, hopefully whatever zero (whether it's +0 or -0) "falls out" of an
>> operation will suffice. I don't think you want to guarantee every
>> result equal to either +0 and -0 (save a unary minus) will be fixed to
>> +0. That defeats the whole point of my proposal.
>
> I thought the whole point of your proposal was to make it easier for
> people writing code on top of XInt? If the point is just to save the one
> or two clock cycles that are used for flipping the sign, it's hardly
> worth the effort.
I'd want the signed zero arithmetic for integers to be compatible with
the signed zero arithmetic for floats. Otherwise the wrapping floating
point class would have to "undo" whatever work the enclosed integer
class did to enforce only +0's.
The (second) point was (hopefully) to simplify the implementation, but
as it looks like that will take some time to work out, and it won't make
an immediate difference at this point (with the lack of a floating point
type built on top), I would be satisfied with revisiting this issue later.
- Jeff
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk