Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: luisgpm@linux.vnet.ibm.com
Cc: gdb-patches@sourceware.org
Subject: Re: GDB/libiberty support for IBM long double
Date: Fri, 28 Dec 2007 12:29:00 -0000	[thread overview]
Message-ID: <jeprwrf6rp.fsf@sykes.suse.de> (raw)
In-Reply-To: <1198783208.7822.51.camel@gargoyle> (Luis Machado's message of 	"Thu\, 27 Dec 2007 17\:20\:07 -0200")

Luis Machado <luisgpm@linux.vnet.ibm.com> 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."


  reply	other threads:[~2007-12-28 10:33 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-26  0:25 Joseph S. Myers
2007-10-26  0:37 ` DJ Delorie
2007-10-29  1:31   ` Joseph S. Myers
2007-11-05 22:33     ` Ping " Joseph S. Myers
2007-11-07 22:43     ` Daniel Jacobowitz
2007-11-07 23:26       ` DJ Delorie
2007-11-09  1:07     ` Ulrich Weigand
2007-11-13  0:39       ` Joseph S. Myers
2007-11-13 13:56         ` Ulrich Weigand
2007-11-13 14:37           ` Joseph S. Myers
2007-11-13 15:15             ` DJ Delorie
2007-11-13 17:58               ` Ulrich Weigand
2007-12-28  1:20         ` Luis Machado
2007-12-28 12:29           ` Andreas Schwab [this message]
2007-12-28 21:40             ` Luis Machado
2007-12-30 11:25               ` Daniel Jacobowitz
2008-01-02 16:17                 ` Luis Machado
2008-01-02 17:01                   ` Daniel Jacobowitz
2008-01-02 18:12                     ` Luis Machado
2008-01-02 18:32                       ` Daniel Jacobowitz
2008-01-03 11:47                         ` Luis Machado
2007-10-26  8:05 ` Mark Kettenis
2007-10-26 15:01   ` Joseph S. Myers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jeprwrf6rp.fsf@sykes.suse.de \
    --to=schwab@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=luisgpm@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox