|
Boost : |
Subject: Re: [boost] [review][constrained_value] Review of Constrained Value Library begins today
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2008-12-11 16:27:17
Robert Kawulak skrev:
> 2008/12/11 Thorsten Ottosen <thorsten.ottosen_at_[hidden]>:
>> We need to make either x or y one of the bounds of our interval. Let us
>> assume it is y.
>>
>> Furthermore, we know y has been specified such that it is representable
>> exactly in float or double.
>
> Not necessarily:
>
> typedef bounded<float>::type bfloat;
>
> bfloat ouch( sin(x), bfloat::constraint_type( cos(y), tan(z) ) );
> ouch = log(7);
>
> Any of the bounds or the underlying value may be extended during
> computations involved in both the construction and the assignment (if
> I understand correctly), there's no guarantee that the compiler will
> not optimise away storage of the values.
Well, in most of my use cases the bounds are defined at compile time. As
for your example, then I hope we find a way to force this rounding.
> And actually what "truncation" is -- really a truncation (rounding
> towards 0), or rounding to the nearest representable value?
I think it is usually rounding towards nearest.
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk