From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26703 invoked by alias); 5 Jul 2005 18:42:17 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 26677 invoked by uid 22791); 5 Jul 2005 18:42:12 -0000 Received: from ns.suse.de (HELO mx1.suse.de) (195.135.220.2) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 05 Jul 2005 18:42:12 +0000 Received: from Relay2.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id E14F7ED62; Tue, 5 Jul 2005 20:42:03 +0200 (CEST) Message-ID: <42CAD4AC.6040008@suse.de> Date: Tue, 05 Jul 2005 18:42:00 -0000 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.7) Gecko/20050414 MIME-Version: 1.0 To: Gabriel Dos Reis Cc: Joe Buck , gcc@gcc.gnu.org Subject: Re: tr1::unordered_set bizarre rounding behavior (x86) References: <42CABDCC.3070508@suse.de> <20050705181025.GB2315@synopsys.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2005-07/txt/msg00183.txt.bz2 Gabriel Dos Reis wrote: >Joe Buck writes: > >| On Tue, Jul 05, 2005 at 08:05:39PM +0200, Gabriel Dos Reis wrote: >| > 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(x); >| > // ... >| > >| > and let frexp and friends only for less obvious value representation. >| >| I disagree; on an ILP32 machine, we pull out only 32 bits for the hash >| value, and if you aren't careful, your approach will wind up using the >| least significant bits of the mantissa. This will cause all values that >| are exactly representable as floats to collide. > >I'm not sure we're talking about the same thing. With the >representations I'm talking about, value repsentation == object representation. > ... still, the hash functions for float, double and long double that we need for TR1 must return a size_t (6.3.3). How do you get a size_t from an objrep_t? (fulfilling the various requirements briefly reminded by Joe in his first message) Paolo.