From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16104 invoked by alias); 26 Jan 2003 12:49:29 -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 16072 invoked from network); 26 Jan 2003 12:49:28 -0000 Received: from unknown (HELO monty-python.gnu.org) (199.232.76.173) by 172.16.49.205 with SMTP; 26 Jan 2003 12:49:28 -0000 Received: from nat-pool-rdu.redhat.com ([66.187.233.200] helo=lacrosse.corp.redhat.com) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18cmE2-00019k-00; Sun, 26 Jan 2003 07:49:26 -0500 Received: from free.redhat.lsd.ic.unicamp.br (aoliva.cipe.redhat.com [10.0.1.10]) by lacrosse.corp.redhat.com (8.11.6/8.9.3) with ESMTP id h0QCmJg07610; Sun, 26 Jan 2003 07:48:19 -0500 Received: from free.redhat.lsd.ic.unicamp.br (localhost.localdomain [127.0.0.1]) by free.redhat.lsd.ic.unicamp.br (8.12.7/8.12.7) with ESMTP id h0QCmIfZ019430; Sun, 26 Jan 2003 10:48:18 -0200 Received: (from aoliva@localhost) by free.redhat.lsd.ic.unicamp.br (8.12.7/8.12.7/Submit) id h0QCmIsL019426; Sun, 26 Jan 2003 10:48:18 -0200 To: "Kaveh R. Ghazi" Cc: gcc-bugs@gcc.gnu.org, gcc-patches@gcc.gnu.org, gcc@gcc.gnu.org, libstdc++@gcc.gnu.org, oldham@codesourcery.com, ro@TechFak.Uni-Bielefeld.DE, rth@redhat.com Subject: Re: Irix6 long doubles implemented wrong? (27_io/ostream_inserter_arith) References: <200212170531.AAA15561@caip.rutgers.edu> <200212241434.JAA22361@caip.rutgers.edu> <20030107221549.GR12992@redhat.com> <20030110011352.GF9245@redhat.com> <200301191731.MAA18215@caip.rutgers.edu> From: Alexandre Oliva Organization: GCC Team, Red Hat Date: Sun, 26 Jan 2003 16:14:00 -0000 In-Reply-To: Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SW-Source: 2003-01/txt/msg01279.txt.bz2 --=-=-= Content-length: 435 On Jan 26, 2003, Alexandre Oliva wrote: > * real.c (ibm_extended_format): Add 53 to minimum exponent. Turned out this got encode_ibm_extended very confused when presented with denormals, not only numbers that had to be represented as denormal doubles, but also those that could still use a normal double for the upper part. This new patch fixes it, and actually passes the numeric_limits test. Ok to install? --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=gcc-mips-tfmode-ibmext-minexp.patch Content-length: 1748 Index: gcc/ChangeLog from Alexandre Oliva * real.c (ibm_extended_format): Add 53 to minimum exponent. (encode_ibm_extended): Adjust. Index: gcc/real.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/real.c,v retrieving revision 1.105 diff -u -p -r1.105 real.c --- gcc/real.c 17 Nov 2002 20:20:39 -0000 1.105 +++ gcc/real.c 26 Jan 2003 12:43:40 -0000 @@ -1,6 +1,6 @@ /* real.c - software floating point emulation. Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2002 Free Software Foundation, Inc. + 1999, 2000, 2002, 2003 Free Software Foundation, Inc. Contributed by Stephen L. Moshier (moshier@world.std.com). Re-written by Richard Henderson @@ -3254,8 +3254,23 @@ encode_ibm_extended (fmt, buf, r) u = *r; clear_significand_below (&u, SIGNIFICAND_BITS - 53); - /* v = remainder containing additional 53 bits of significand. */ - do_add (&v, r, &u, 1); + normalize (&u); + /* If the upper double is zero, we have a denormal double, so + move it to the first double and leave the second as zero. */ + if (u.class == rvc_zero) + { + v = u; + u = *r; + normalize (&u); + } + else + { + /* v = remainder containing additional 53 bits of significand. */ + do_add (&v, r, &u, 1); + round_for_format (&ieee_double_format, &v); + } + + round_for_format (&ieee_double_format, &u); encode_ieee_double (&ieee_double_format, &buf[0], &u); encode_ieee_double (&ieee_double_format, &buf[2], &v); @@ -3292,7 +3307,7 @@ const struct real_format ibm_extended_fo 2, 1, 53 + 53, - -1021, + -1021 + 53, 1024, true, true, --=-=-= Content-length: 289 -- Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/ Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org} CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org} Free Software Evangelist Professional serial bug killer --=-=-=--