This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: tr1::unordered_set<double> bizarre rounding behavior (x86)
On Tue, 2005-07-05 at 20:05 +0200, Gabriel Dos Reis wrote:
> Paolo Carlin
> It is definitely a good thing to use the full bits of value
> representation if we ever want to make all "interesting" bits part of
> the hash value. For reasonable or sane representations it suffices to
> get your hand on the object representation, e.g.:
>
> const int objsize = sizeof (double);
> typedef unsigned char objrep_t[objsize];
> double x = ....;
> objrep_t& p = reintepret_cast<objrep_t&>(x);
> // ...
>
> and let frexp and friends only for less obvious value representation.
most architectures have different bit representations for +0.0 and -0.0,
yet the two values compare equal.