This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

Re: single to double conversion


I have done some tests on a modified version:

      program main
      real*8 number,ran_u,ran_d
      number=ran_u()   !!number will be TRASH!! contain random memory bits, etc
      print *,number
      number=ran_d()   
      print *,number
      end
      function ran_u()
      real ran_u
      ran_u=42.42d0
      end
      function ran_d()
      real*8 ran_d
      ran_d=42.42d0
      end

All the compilers I have on my G5/OSX (g77, xlf, g95, gfortran) give
some variant of:

 42.4199981689453125
 42.4200000000000017

The same test on AMD give

  5.484265999324755E-315
   42.4200000000000     

for gfortran, g95, Portland Group Fortran
and

   42.4199981689453     
   42.4200000000000     

for g77, gfortran  -ff2c, and Intel Fortran.

Dominique


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