From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21228 invoked by alias); 28 Dec 2007 10:33:40 -0000 Received: (qmail 21218 invoked by uid 22791); 28 Dec 2007 10:33:39 -0000 X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 28 Dec 2007 10:33:33 +0000 Received: from Relay2.suse.de (relay-ext.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 2CEC42F6FD; Fri, 28 Dec 2007 11:33:31 +0100 (CET) From: Andreas Schwab To: luisgpm@linux.vnet.ibm.com Cc: gdb-patches@sourceware.org Subject: Re: GDB/libiberty support for IBM long double References: <200711090107.lA917ZGs027733@d12av02.megacenter.de.ibm.com> <1198783208.7822.51.camel@gargoyle> X-Yow: Are we on STRIKE yet? Date: Fri, 28 Dec 2007 12:29:00 -0000 In-Reply-To: <1198783208.7822.51.camel@gargoyle> (Luis Machado's message of "Thu\, 27 Dec 2007 17\:20\:07 -0200") Message-ID: User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-12/txt/msg00434.txt.bz2 Luis Machado writes: > Removing this condition fixes the problem, but i'm not sure this is 100% > safe as this condition must have a purpose. > > Any ideas? That part of the function can be simplified quite a bit. For example, NaNs and infinities are already handled at this point, thus special_exponent can only be true when the biased exponent is zero. --- libiberty/floatformat.c.~1.25.~ 2007-11-16 11:17:29.000000000 +0100 +++ libiberty/floatformat.c 2007-12-28 11:26:21.000000000 +0100 @@ -487,9 +487,9 @@ floatformat_to_double (const struct floa mant_off = fmt->man_start; dto = 0.0; - special_exponent = exponent == 0 || (unsigned long) exponent == fmt->exp_nan; + special_exponent = exponent == 0; - /* Don't bias zero's, denorms or NaNs. */ + /* Don't bias zeros or denorms. */ if (!special_exponent) exponent -= fmt->exp_bias; @@ -516,16 +516,15 @@ floatformat_to_double (const struct floa /* Handle denormalized numbers. FIXME: What should we do for non-IEEE formats? */ - if (special_exponent && exponent == 0 && mant != 0) - dto += ldexp ((double)mant, + if (special_exponent) + dto += ldexp ((double) mant, (- fmt->exp_bias - mant_bits - (mant_off - fmt->man_start) + 1)); else - dto += ldexp ((double)mant, exponent - mant_bits); - if (exponent != 0) - exponent -= mant_bits; + dto += ldexp ((double) mant, exponent - mant_bits); + exponent -= mant_bits; mant_off += mant_bits; mant_bits_left -= mant_bits; } Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."