public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/45175]  New: In gfortran, the calculation of small differences seems to depend on optimization flags
@ 2010-08-04  2:03 CycleTimeChart at yahoo dot com
  2010-08-04  2:05 ` [Bug fortran/45175] " CycleTimeChart at yahoo dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: CycleTimeChart at yahoo dot com @ 2010-08-04  2:03 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/45175] In gfortran, the calculation of small differences seems to depend on optimization flags
  2010-08-04  2:03 [Bug fortran/45175] New: In gfortran, the calculation of small differences seems to depend on optimization flags CycleTimeChart at yahoo dot com
@ 2010-08-04  2:05 ` CycleTimeChart at yahoo dot com
  2010-08-04  2:06 ` CycleTimeChart at yahoo dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: CycleTimeChart at yahoo dot com @ 2010-08-04  2:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from CycleTimeChart at yahoo dot com  2010-08-04 02:05 -------
Created an attachment (id=21388)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21388&action=view)
Main program


-- 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/45175] In gfortran, the calculation of small differences seems to depend on optimization flags
  2010-08-04  2:03 [Bug fortran/45175] New: In gfortran, the calculation of small differences seems to depend on optimization flags CycleTimeChart at yahoo dot com
  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
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: CycleTimeChart at yahoo dot com @ 2010-08-04  2:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from CycleTimeChart at yahoo dot com  2010-08-04 02:06 -------
Created an attachment (id=21390)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21390&action=view)
Implicit typecasting include file


-- 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/45175] In gfortran, the calculation of small differences seems to depend on optimization flags
  2010-08-04  2:03 [Bug fortran/45175] New: In gfortran, the calculation of small differences seems to depend on optimization flags CycleTimeChart at yahoo dot com
  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
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: CycleTimeChart at yahoo dot com @ 2010-08-04  2:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from CycleTimeChart at yahoo dot com  2010-08-04 02:05 -------
Created an attachment (id=21389)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21389&action=view)
Support routines


-- 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/45175] In gfortran, the calculation of small differences seems to depend on optimization flags
  2010-08-04  2:03 [Bug fortran/45175] New: In gfortran, the calculation of small differences seems to depend on optimization flags CycleTimeChart at yahoo dot com
                   ` (2 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: CycleTimeChart at yahoo dot com @ 2010-08-04  2:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from CycleTimeChart at yahoo dot com  2010-08-04 02:22 -------
Created an attachment (id=21391)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21391&action=view)
Compilation batch file


-- 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/45175] In gfortran, the calculation of small differences seems to depend on optimization flags
  2010-08-04  2:03 [Bug fortran/45175] New: In gfortran, the calculation of small differences seems to depend on optimization flags CycleTimeChart at yahoo dot com
                   ` (3 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: dominiq at lps dot ens dot fr @ 2010-08-04  2:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from dominiq at lps dot ens dot fr  2010-08-04 02:38 -------
You do not say on which platform you did the tests (gfortran -v). From

C:\FI\Implicit4.inc

I assume that you are using some *86* processor under Windows. 

This is not a gfortran bug, but a duplicate of an infamous pr I cannot find the
number. You should try -ffloat-store or -mfpmath=sse and have a look at the gcc
manual

http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#Optimize-Options

under -ffloat-store and -fexcess-precision=style.


-- 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/45175] In gfortran, the calculation of small differences seems to depend on optimization flags
  2010-08-04  2:03 [Bug fortran/45175] New: In gfortran, the calculation of small differences seems to depend on optimization flags CycleTimeChart at yahoo dot com
                   ` (4 preceding siblings ...)
  2010-08-04  2:38 ` dominiq at lps dot ens dot fr
@ 2010-08-04  2:42 ` jvdelisle at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2010-08-04  2:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jvdelisle at gcc dot gnu dot org  2010-08-04 02:42 -------
This is a duplicate of PR 323

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

Just use -ffloat-store.



*** This bug has been marked as a duplicate of 323 ***


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-08-04  2:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-04  2:03 [Bug fortran/45175] New: In gfortran, the calculation of small differences seems to depend on optimization flags CycleTimeChart at yahoo dot com
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

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).