tr1::unordered_set<double> bizarre rounding behavior (x86)
Gabriel Dos Reis
gdr@integrable-solutions.net
Wed Jul 6 13:50:00 GMT 2005
Avi Kivity <avi@argo.co.il> writes:
| On Wed, 2005-07-06 at 15:54 +0300, Michael Veksler wrote:
|
| > > most architectures have different bit representations for +0.0 and -0.0,
| > > yet the two values compare equal.
| > >
| >
| > Yet, their sign bit is observable through things like
| > assert(a == 0.0);
| > assert(b == 0.0);
| > 1/(1/a+ 1/b)
| > which would give either NaN or 0 depending on the sign
| > of a and b.
| >
| > So do you want one or two copies in the set?
| >
| what matters is whether the sign bit is observable through the equality
| predicate. in the case of the operator==(double, double), it is not
| observable, so there should be only one copy in a set.
Yes.
That logical framework has some "problems" though. Assume x is NaN,
then you would end up with as many xs as you insert in the set.
-- Gaby
More information about the Gcc
mailing list