public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "CycleTimeChart at yahoo dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/45175]  New: In gfortran, the calculation of small differences seems to depend on optimization flags
Date: Wed, 04 Aug 2010 02:03:00 -0000	[thread overview]
Message-ID: <bug-45175-19521@http.gcc.gnu.org/bugzilla/> (raw)

Just a little background:

I wrote a program that does high accuracy factorials.  It saves a given
factorial for later use as a double precision real between 1 and 2 and an
integer power of 2.  It does this by calculating the factorial to a practically
unlimited number of bits, rounding it to 53 bits only as the final step,
thereby avoiding the cumulative round off errors that occur.

I wanted to compare the accuracy of this method to a straight-forward way of
calculating factorials.  So I also scaled factorials calculated in a
straight-forward way the same way as above, that is as a double precision real
between 1 and 2 and an integer power of 2.

In the comparison, the integer power of 2 can be ignored, as it is practically
always the same.  As to the real portion, the difference between the two reals
should always be an integer multiple of 2**(-52).  The crux of the bug is that
when I compiled using the flag -O, this was true.  Using -O2, it was not. 
Stated another way, the calculation of small differences seems to depend on
optimization flags.


-- 
           Summary: In gfortran, the calculation of small differences seems
                    to depend on optimization flags
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: CycleTimeChart at yahoo dot com


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


             reply	other threads:[~2010-08-04  2:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-04  2:03 CycleTimeChart at yahoo dot com [this message]
2010-08-04  2:05 ` [Bug fortran/45175] " CycleTimeChart at yahoo dot com
2010-08-04  2:06 ` CycleTimeChart at yahoo dot com
2010-08-04  2:06 ` CycleTimeChart at yahoo dot com
2010-08-04  2:22 ` CycleTimeChart at yahoo dot com
2010-08-04  2:38 ` dominiq at lps dot ens dot fr
2010-08-04  2:42 ` jvdelisle at gcc dot gnu dot 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-45175-19521@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).