Boost logo

Boost :

Subject: Re: [boost] [review][constrained_value] Review of Constrained Value Library begins today
From: Gordon Woodhull (gordon_at_[hidden])
Date: 2008-12-11 20:14:58


On Dec 11, 2008, at 11:45 AM, Thorsten Ottosen wrote:
> 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. Since the 80-bit floating
> point values are a superset, we know y can also be represented
> exactly in this format, and we know that truncation on y will have
> no effect.
>
> Basically, y will have the same value no matter if it is stored in a
> register or at some memory location.
>
> The question is know, can
>
> x < y
>
> pass, and then x is assigned to the a bounded_float
> (where it will be stored in x'), only to
> discover that
>
> x' < y
>
> ? We know y will always have the same value, so only x may
> switch location.
>
> Case 1: x is in memory, x' is in register. Then x == x' by the
> superset property.
>
> Case 2: x is in register, x' is register. Then x == x'.
>
> Case 3: x is in register, x' is in memory. Then we might have x' ==
> y, but not x' > y, since that would violate the fact that y is
> exactly representable in both formats.

Well said. It seems that a truncated bound is key. Surely it will be
if it's stored as a runtime field, I am not so sure when it's one of
those nice optimized-away functors.

So the next questions are
1. how to implement
0. how to test

I will inquire of a local float enthusiast, one of my profs at NYU.

Gordon


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