Boost logo

Boost :

Subject: Re: [boost] [review][constrained_value] Review of Constrained Value Library begins today
From: Robert Kawulak (robert.kawulak_at_[hidden])
Date: 2008-12-11 12:18:02


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.

And actually what "truncation" is -- really a truncation (rounding
towards 0), or rounding to the nearest representable value?

Regards,
Robert


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk