Something strange with g77 ...

From: Arjen Markus (arjen.markus_at_wldelft.nl)
Date: 10/27/03


Date: Mon, 27 Oct 2003 15:51:46 +0100

Hello,

I was trying a few things concerning double and single precision.
Can anyone clarify the result I get with this little program
under Linux using g77:

        implicit none
        real*8 PI, x
        parameter (PI = 3.1415926535897932384)

        write(*,*) pi

        x = pi
        call diff(x)

        write(*,*) x
        stop
        end
        subroutine diff(x)
        real*4 PI4
        parameter (PI4 = 3.1415926535897932384)

        real*8 x

        x = x - pi4
        return
        end

When I run this, the answer is (note the last two
digits):

  3.14159274
  0.

When, instead, I use f77 on a Sun/Solaris machine:

     3.1415926535898
   0.

Much more as I would expect! (even though the exact
zero still puzzles me).

g77 on that Solaris machine gives the same answer
by the way as g77 on Linux.

Regards,

Arjen



Relevant Pages

  • Re: Fortran files
    ... I use G77 on both Linux and Windows, it works fine for my need. ... on the Linux box you can get free Intel compilers for non-comm. ...
    (comp.soft-sys.matlab)
  • Re: porting program from vms-vax to linux
    ... >> I want to comlile a program, which was original written in vax-fortran ... >> 77, under linux using g77. ...
    (comp.lang.fortran)
  • Re: Something strange with g77 ...
    ... > I was trying a few things concerning double and single precision. ... > Can anyone clarify the result I get with this little program ... > g77 on that Solaris machine gives the same answer ... > by the way as g77 on Linux. ...
    (comp.lang.fortran)
  • writing to binary
    ... I'm trying to help a colleague write to binary, and it's been awhile ... OS is linux and compiler is g77. ...
    (comp.lang.fortran)
  • g77: 32-bit to 64-bit
    ... They communicate with each other via binary input/output files. ... the 2GB addressing limit of 32-bit linux. ... Is it possible to compile a program with 64-bit g77 so it ... Our hardware is dual-cpu/dual-core Opterons with 2GB of RAM per cpu (total ...
    (comp.lang.fortran)