public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: jerry DeLisle <jvdelisle@charter.net>
To: Thomas Henlich <thenlich@users.sourceforge.net>
Cc: Janne Blomqvist <blomqvist.janne@gmail.com>,
	 gfortran <fortran@gcc.gnu.org>,
	gcc patches <gcc-patches@gcc.gnu.org>
Subject: Re: [patch, libgfortran] PR48906 Wrong rounding results with -m32
Date: Sat, 11 Jun 2011 14:19:00 -0000	[thread overview]
Message-ID: <4DF3626B.6070404@charter.net> (raw)
In-Reply-To: <BANLkTikMUeELyUbHnbf_AL49xnfKVzD4qg@mail.gmail.com>

On 06/11/2011 12:23 AM, Thomas Henlich wrote:
>> I don't agree with this; with the patch we now output 10 significant
>> digits, whereas 9 is sufficient for a binary->ascii->binary roundtrip.
>> So please retain the "reduce d by one when E editing is used" thing
>> for list format and G0. This is just a side effect of using 1PGw.d
>> format for list format and G0 in order to avoid duplicating code, but
>> we don't need to follow this particular craziness that is due to how
>> the scale factor is specified in the standard.
>
> I hadn't noticed this, but I agree with Janne.
>
> It should be easy to implement:
>
> After the switch between F and E editing, we just need to shift the
> decimal point and decrement the exponent. No new rounding is required,
> because we keep the number of significant digits.
>

Our default formats for kind=4 are:

static void
set_fnode_default (st_parameter_dt *dtp, fnode *f, int length)
{
   f->format = FMT_G;
   switch (length)
     {
     case 4:
       f->u.real.w = 16;
       f->u.real.d = 9;
       f->u.real.e = 2;
       break;

This was established as solution to PR48488 where we had two choices for 
selecting the significant digits. Nine significant digits was established as a 
requirement to guarantee round trip in all cases. The char4_iunit_1.f03 test 
case was revised because after we corrected the formatting in PR48906, it 
started to fail and I observed the test case was looking for the wrong number of 
significant digits.

Based on this, I would suggest we leave it as I have it, which is correct.

Jerry

  reply	other threads:[~2011-06-11 12:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-03 12:51 [patch, libgfortran] " jerry DeLisle
2011-06-10 17:39 ` [patch, libgfortran] PR48906 " jerry DeLisle
2011-06-11  8:24   ` Janne Blomqvist
2011-06-11  9:13     ` Thomas Henlich
2011-06-11 14:19       ` jerry DeLisle [this message]
2011-06-11 16:05         ` Thomas Henlich
2011-06-14  6:14       ` jerry DeLisle
2011-06-14  8:30         ` Thomas Henlich
2011-06-11 20:01 jvdelisle

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=4DF3626B.6070404@charter.net \
    --to=jvdelisle@charter.net \
    --cc=blomqvist.janne@gmail.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=thenlich@users.sourceforge.net \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).