This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
pending/987: [patch/rfc] Change floatformat's exp_bias to an int
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: gdb-gnats at sources dot redhat dot com
- Cc: binutils at sources dot redhat dot com, gcc-patches at gcc dot gnu dot org
- Date: Wed, 04 Dec 2002 11:53:00 -0500
- Subject: pending/987: [patch/rfc] Change floatformat's exp_bias to an int
>Number: 987
>Category: pending
>Synopsis: [patch/rfc] Change floatformat's exp_bias to an int
>Confidential: yes
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: change-request
>Submitter-Id: unknown
>Arrival-Date: Fri Jan 31 05:28:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:
>Release:
>Organization:
>Environment:
>Description:
This is a multi-part message in MIME format.
--------------040506010405060508030609
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Hello,
The attached addresses a problem with float format's exp_bias (the
_difference_ between a true and biased exponent). It was an unsigned,
instead of an int. Unfortunatly, due to the nature of C's conversion
rules, that unsigned can result in strange behavior. As the comment notes:
+ /* Bias added to a "true" exponent to form the biased exponent. It
+ is intentionally signed as, otherwize, -exp_bias can turn into a
+ very large number (e.g., given the exp_bias of 0x3fff and a 64
+ bit long, the equation (long)(1 - exp_bias) evaluates to
+ 4294950914) instead of -16382). */
Baring comment, I'll [double] commit this in a few days.
Andrew
--------------040506010405060508030609
Content-Type: text/plain;
name="diffs"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="diffs"
Wed Dec 4 11:36:04 2002 Andrew Cagney <cagney@redhat.com>
* floatformat.h (struct floatformat): Change exp_bias to an int.
Index: floatformat.h
===================================================================
RCS file: /cvs/src/src/include/floatformat.h,v
retrieving revision 1.5
diff -u -r1.5 floatformat.h
--- floatformat.h 6 Mar 2002 06:29:41 -0000 1.5
+++ floatformat.h 4 Dec 2002 16:47:54 -0000
@@ -61,8 +61,12 @@
unsigned int exp_start;
unsigned int exp_len;
- /* Amount added to "true" exponent. 0x3fff for many IEEE extendeds. */
- unsigned int exp_bias;
+ /* Bias added to a "true" exponent to form the biased exponent. It
+ is intentionally signed as, otherwize, -exp_bias can turn into a
+ very large number (e.g., given the exp_bias of 0x3fff and a 64
+ bit long, the equation (long)(1 - exp_bias) evaluates to
+ 4294950914) instead of -16382). */
+ int exp_bias;
/* Exponent value which indicates NaN. This is the actual value stored in
the float, not adjusted by the exp_bias. This usually consists of all
one bits. */
--------------040506010405060508030609--
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: