Boost logo

Boost Users :

From: Guillaume Melquiond (guillaume.melquiond_at_[hidden])
Date: 2006-10-21 10:06:21


Le vendredi 20 octobre 2006 à 16:30 +0800, tirath a écrit :

> In general, when you have a 32-bit floating point representation of a
> real number, the precision is less than it would be with a 64-bit
> floating point representation of the number. Therefore when
> "promoting" a float to a double, say:
> interval<double> x;
> interval<float> y;
> ...
> y=x;
>
> shouldn't we (in the spirit of error propagation) acknowledge that
> the data assigned to y was of inferior precision? A range too small
> to be expressed in single precision may be large enough to be
> expressed in double precision, as single precision ulp ~ 1E-7 wheras
> double precision ulp ~ 1E-16.

This is not correct. If the range is too small to be represented in
single precision, it will be inflated until it can be represented. So
you don't have to inflate the range one more time when you convert it
back to double precision, as it already was.

But thanks to your testcase, I now understand where the confusion comes
from. There must be a bug somewhere, as the width of the single
precision interval should never have been zero. For now, I haven't found
anything obvious. I'm not even sure whether the bug is in the interval
library or not. I will have to investigate.

Best regards,

Guillaume


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net