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/48906] Wrong rounding results with -m32
Date: Fri, 10 Jun 2011 16:16:00 -0000	[thread overview]
Message-ID: <bug-48906-4-lfHXkiDRqa@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-48906-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #33 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-06-10 16:16:19 UTC ---
The last test case I am working is fmt_g0_6.f08. 

The apparent failing case is:

      print "(rc,g15.2)", 0.995000_8

Which is resulting in 0.99 and we expect it to be 1.0.

However, the raw internal representation of 0.995 is not exact and is:

99499999999999999555

This places the value less then the threshold given in the table in the
Standard, giving the correct F format as:

      print "(f11.2,4x)", 0.995000_8  ! 0.99

Instead of 

      print "(f11.1,4x)", 0.995000_8  ! 1.0


Our F formatting in the test case is using the f11.1 and the logic does not
look at the third digit and dutifully rounds the value as it should.  The new G
formatting is using exact integer logic and dutifully does look at the third
digit.

If we do:

print "(rc,g15.2)", 0.9950001_8

The internal value does cross the 0.995 threshold and we do get the 1.0
results.

I think this issues is one of those splitting hairs things.  We could
artificially round the digits string early before we process it, but this would
effectively be rounding twice to get there.  I would prefer to revise the test
case like so:

  call check_all(0.995000000001_RT, 15, 2, 0)

and be done with this.


  parent reply	other threads:[~2011-06-10 16:16 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-06  1:31 [Bug libfortran/48906] New: " jvdelisle at gcc dot gnu.org
2011-05-06 21:33 ` [Bug libfortran/48906] " jvdelisle at gcc dot gnu.org
2011-05-06 21:52 ` kargl at gcc dot gnu.org
2011-05-10 13:05 ` jvdelisle at gcc dot gnu.org
2011-05-10 17:21 ` thenlich at users dot sourceforge.net
2011-05-19  5:55 ` jvdelisle at gcc dot gnu.org
2011-05-19  8:36 ` thenlich at users dot sourceforge.net
2011-05-19 13:21 ` jvdelisle at gcc dot gnu.org
2011-05-23 19:27 ` jvdelisle at gcc dot gnu.org
2011-05-26 13:02 ` jvdelisle at gcc dot gnu.org
2011-05-27  7:21 ` thenlich at users dot sourceforge.net
2011-05-27  8:56 ` thenlich at users dot sourceforge.net
2011-05-27 13:14 ` thenlich at users dot sourceforge.net
2011-05-27 14:34 ` jvdelisle at gcc dot gnu.org
2011-05-30 18:53 ` jvdelisle at gcc dot gnu.org
2011-05-31  6:28 ` thenlich at users dot sourceforge.net
2011-05-31  6:41 ` thenlich at users dot sourceforge.net
2011-05-31 12:38 ` jvdelisle at gcc dot gnu.org
2011-06-01  5:09 ` jvdelisle at gcc dot gnu.org
2011-06-01  6:26 ` thenlich at users dot sourceforge.net
2011-06-01  8:13 ` thenlich at users dot sourceforge.net
2011-06-01 12:27 ` jvdelisle at gcc dot gnu.org
2011-06-02  3:58 ` jvdelisle at gcc dot gnu.org
2011-06-03 12:56 ` jvdelisle at gcc dot gnu.org
2011-06-06  8:38 ` thenlich at users dot sourceforge.net
2011-06-06 12:09   ` jerry DeLisle
2011-06-06 12:10 ` jvdelisle at charter dot net
2011-06-06 12:27 ` thenlich at users dot sourceforge.net
2011-06-06 12:36 ` jvdelisle at charter dot net
2011-06-06 12:42 ` thenlich at users dot sourceforge.net
2011-06-06 12:48 ` thenlich at users dot sourceforge.net
2011-06-07  6:56 ` thenlich at users dot sourceforge.net
2011-06-07  6:57 ` thenlich at users dot sourceforge.net
2011-06-07 17:06 ` jvdelisle at gcc dot gnu.org
2011-06-10 16:16 ` jvdelisle at gcc dot gnu.org [this message]
2011-06-10 16:22 ` jvdelisle at gcc dot gnu.org
2011-06-10 16:56 ` thenlich at users dot sourceforge.net
2011-06-10 17:02 ` thenlich at users dot sourceforge.net
2011-06-10 17:30 ` jvdelisle at gcc dot gnu.org
2011-07-01  9:23 ` thenlich at users dot sourceforge.net
2011-07-02  1:33 ` jvdelisle at gcc dot gnu.org
2013-06-16 16:56 ` dominiq at lps dot ens.fr
2014-01-11 21:44 ` jvdelisle at gcc dot gnu.org

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-48906-4-lfHXkiDRqa@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).