Boost logo

Boost :

Subject: Re: [boost] [review][constrained_value] Review of Constrained Value Library begins today
From: Johan Råde (rade_at_[hidden])
Date: 2008-12-11 16:14:27

John Phillips wrote:
> Stjepan Rajko wrote:
>> On Thu, Dec 11, 2008 at 9:07 AM, Johan Råde <rade_at_[hidden]> wrote:
>>>> In other words, we always have to force at least one of x and y to
>>>> be truncated in order to have any guarantee. If we can do that we
>>>> might
>>>> as
>>>> well force both values to be truncated, right. I think that so far
>>>> in this discussion is has been assumed that the bounds are truncated.
>>> Forcing truncation may have a bad effect on performance.
>>> That will be unacceptable to some users.
>> I think the idea is to force truncation on the bounds when they are
>> set in the constraint object, which for many use cases happens only
>> once per bounded value.
>> Stjepan
> If you want to say it a different way, he wants the process of setting
> bounds to save something that is exactly representable in the floating
> point type that is being used for the bound. Then moving it from main
> memory to a register that may have more bits will not affect the value.
> This would add a little to the cost of runtime changes to the bounds,
> but that should be an uncommon enough operation to make the cost
> acceptable.

Yes, I think that if we force truncation of the bounds,
but not of the actual values,
and only allow <= and >= bounds,
then we should be fine.

We may also consider implementing < and > bounds in terms of <= and >= bounds
and the std::nextafter function.

--Johan Råde

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