public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jvdelisle at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libfortran/48787] Invalid UP/DOWN rounding with F editing
Date: Mon, 04 Jul 2011 14:28:00 -0000	[thread overview]
Message-ID: <bug-48787-4-HOZbfX6ZaL@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-48787-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48787

--- Comment #28 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-07-04 14:27:06 UTC ---
(In reply to comment #26)
> Created attachment 24583 [details]
> More tests for rounding
> 
> If it helps, I added some more tests for this.
> 
> By removing the code lines in questions, all tests from this testcase pass
> except:
>     call checkfmt("(RU,F2.0)",     0.09,  "1.")     ! 0.
>     call checkfmt("(RD,F3.0)",     -0.09,  "-1.")     ! -0.

I have this issue fixed now.  What is happening is that the digit string for
theses cases comes in as "0900000000xxxxxx" or "0899999999xxxxx".  Its not
normalized in the usual way (why?), so the leading zero in the string is
throwing off the rounding logic.

[aside: I think we would be better off with our own float to decimal string
routine about now]

Using this:

  if (d == 0 && p == 0 && digits[0] == '0')
    {
      nbefore = 1;
      nafter = 0;
    }

in my current trunk (which has some other modifications in it) resolves this
problem for:

  print "(RU,F2.0)", 0.09 ! "1."
  print "(RD,F3.0)", -0.09 ! "-1."
  print "(RU,F2.0)", 0.009 ! "1."
  print "(RD,F3.0)", -0.009 ! "-1."
  print "(RU,F2.0)", 0.0009 ! "1."
  print "(RD,F3.0)", -0.0009 ! "-1."
  print "(RU,F2.0)", 0.00009 ! "1."
  print "(RD,F3.0)", -0.00009 ! "-1."

Which exhibit the issue.  All regression tests pass.  I have not tried this on
the current unfettered trunk yet and I am working on the p scaling issues.


  parent reply	other threads:[~2011-07-04 14:28 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-27  8:46 [Bug libfortran/48787] New: Invalid UP " thenlich at users dot sourceforge.net
2011-04-28  4:11 ` [Bug libfortran/48787] " jvdelisle at gcc dot gnu.org
2011-04-28  6:42 ` thenlich at users dot sourceforge.net
2011-04-29  6:05 ` jvdelisle at gcc dot gnu.org
2011-04-29  7:14 ` thenlich at users dot sourceforge.net
2011-04-29 15:55   ` Jerry DeLisle
2011-04-29 14:57 ` jvdelisle at gcc dot gnu.org
2011-04-29 15:15 ` jvdelisle at gcc dot gnu.org
2011-04-29 15:58 ` jvdelisle at frontier dot com
2011-04-30 12:00 ` thenlich at users dot sourceforge.net
2011-04-30 12:44 ` jvdelisle at gcc dot gnu.org
2011-04-30 15:58 ` thenlich at users dot sourceforge.net
2011-05-01 12:37 ` jvdelisle at gcc dot gnu.org
2011-05-01 12:56 ` jvdelisle at gcc dot gnu.org
2011-05-02  3:36 ` jvdelisle at gcc dot gnu.org
2011-05-02 13:35 ` thenlich at users dot sourceforge.net
2011-05-02 13:59 ` thenlich at users dot sourceforge.net
2011-05-02 19:08 ` jvdelisle at gcc dot gnu.org
2011-05-03 11:47 ` [Bug libfortran/48787] Invalid UP/DOWN " jvdelisle at gcc dot gnu.org
2011-05-04 16:59 ` jvdelisle at gcc dot gnu.org
2011-05-05  1:24 ` jvdelisle at gcc dot gnu.org
2011-05-05  1:31 ` jvdelisle at gcc dot gnu.org
2011-05-06 20:11 ` jvdelisle at gcc dot gnu.org
2011-06-17 13:23 ` thenlich at users dot sourceforge.net
2011-06-17 13:32 ` dominiq at lps dot ens.fr
2011-06-20  7:15 ` thenlich at users dot sourceforge.net
2011-06-21  2:52 ` jvdelisle at gcc dot gnu.org
2011-06-23  6:13 ` thenlich at users dot sourceforge.net
2011-06-27 23:27 ` jvdelisle at gcc dot gnu.org
2011-07-04 14:28 ` jvdelisle at gcc dot gnu.org [this message]
2014-01-18 17:46 ` dominiq at lps dot ens.fr

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=bug-48787-4-HOZbfX6ZaL@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).