writing a double precission varibale with format f3.0 is not rounded

Hugo Mahr HugoMahr@web.de
Tue Jan 16 14:18:00 GMT 2007


Hello,
I realized that there is a rounding probelm:

Code:
  -> cat f0999.f
       program f0999
       double precision rdum
       rdum = 9.99999D-1
       write(*,'(F3.0)') rdum
       write(*,'(d24.6)') rdum
       end

compilation:
  -> gfortran f0999.f

execution:
  -> ./a.out
 0.
            0.999999D+00
I expect 1 as outcome instead of 0.999999d0.

With f77 that is working as expected - and this
is also according to the book fortran 95/2003 explained.
Can you please help me to clarify this.


fortran --version
GNU Fortran 95 (GCC) 4.1.0 (SUSE Linux)



More information about the Fortran mailing list