This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

problem wirh real*8


Since I had some precision problem in some programs that I'm running,I compiled this simple example on Suse Linux 8.2 with gcc version 3.3 20030226 (prerelease).

program precision
   implicit none
   REAL*8 x,y,z
   x=0.123456789
   y=0.123456788
   z=(x-y)
   write(*,fmt='(a6,f19.17)')'x = ',x
   write(*,fmt='(a6,f19.17)')'y = ',y
   write(*,fmt='(a6,f19.17)') 'x-y = ',z
    end

The two double precisions real numbers x, y differ on the 9th digit, fully in the range of double precision.
The output was instead :


> precision
 x = 0.12345679104328156
 y = 0.12345679104328156
x-y = 0.00000000000000000

Where is my error? Please help me!

Best regards.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]