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 10:42:15

Thorsten Ottosen wrote:
> Johan RÃ¥de skrev:
>> Robert Kawulak wrote:
>>>> From: Johan Rade
>>>> The statement is
>>>> "x <= y before truncation implies x <= y after truncation".
>>> Or more specifically:
>>> "x < y before truncation implies x <= y after truncation"
>>> Is this right?
>>> _______________________________________________
>>> Unsubscribe & other changes:
>> Thought about it again.
>> None if these statements are true, unfortunately,
>> if you consider the case when one number is truncated to 64 bits
>> and the other is kept at 80 bits.
>> Then you can even have x < y before and x > y after.
> Hm. This sucks.
> Do we know if that 80-bit floating point values are guaranteed to be a
> superset of 64-bit and 32-bit floats (or if 64-bit is a superset of
> 32-bit floats).
> I suspect the answer might be yes. If so, I don't think
> x < y before ==> x > y after
> can be true. If x is rounded upwards, y would be an upper bound.

Imagine the following case,

1) x and y are stored in 80-bit registers
2) x < y
3) both x and y are just below 1.0,
so close that they would be rounded to 1.0 if truncated to 64 bits

If now x is truncated to 64 bits, and then moved back to an 80-bit register,
while y is unchanged, then x > y.

--Johan RÃ¥de

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