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: [patch, libfortran] Implement KIND specific floating point formatted output


This patch breaks gfortran.dg/fmt_p_1.f90, gfortran.dg/output_exponents_1.f90,
and gfortran.dg/large_real_kind_form_io_1.f90 on PPC Darwin. For the first two tests
the failure comes from a truncated exponent:

     0.100E-99   0.200E-99                         
     1.000-10   2.000-10                         

instead of 

     0.100E-99   0.200E-99                         
     1.000-100   2.000-100                        

For the last test, the bug is less obvious: the last output is:

 .1000E+0000  .2000E+0000
 
giving the runtime error:

At line 28 of file large_real_kind_form_io_1_db.f90
Fortran runtime error: Bad value during floating point read

See http://gcc.gnu.org/ml/gcc-testresults/2007-08/msg01010.html for
results on Darwin.

Dominique

PS Note that gfortran.dg/edit_real_1.f90 now pass, but if I print the

 9 1.798+30z
 
instead of

 9 1.798+308z
 
Also the code

print *,  huge(1.0), -huge(1.0), huge(1.0d0), -huge(1.0d0)
print *,  nearest(huge(1.0),-1.0), nearest(-huge(1.0),1.0), nearest(huge(1.0d0),-1.0d0), nearest(-huge(1.0d0),1.0d0)
print *,  nearest(huge(1.0),1.0), nearest(-huge(1.0),-1.0), nearest(huge(1.0d0),1.0d0), nearest(-huge(1.0d0),-1.0d0)
end

gives

edit_real_1_red_3.f90:3.18:

print *,  nearest(huge(1.0),1.0), nearest(-huge(1.0),-1.0), nearest(huge(1.0d0)
                 1
Error: Result of NEAREST overflows its kind at (1)
edit_real_1_red_3.f90:3.42:

print *,  nearest(huge(1.0),1.0), nearest(-huge(1.0),-1.0), nearest(huge(1.0d0)
                                         1
Error: Result of NEAREST overflows its kind at (1)
edit_real_1_red_3.f90:3.68:

print *,  nearest(huge(1.0),1.0), nearest(-huge(1.0),-1.0), nearest(huge(1.0d0)
                                                                   1
Error: Result of NEAREST overflows its kind at (1)
edit_real_1_red_3.f90:3.96:

e(1.0),1.0), nearest(-huge(1.0),-1.0), nearest(huge(1.0d0),1.0d0), nearest(-hug
                                                                          1                     
Error: Result of NEAREST overflows its kind at (1)

I was expecting no errors and 

 3.4028235E+38 -3.4028235E+38 1.7976931348623157E+308 -1.7976931348623157E+308
 3.4028233E+38 -3.4028233E+38 1.7976931348623155E+308 -1.7976931348623155E+308
 +Inf -Inf +Inf -Inf

If I remove the offending line, the output is:

  3.4028235E+38 -3.4028235E+38  1.797693134862316E+30 -1.797693134862316E+30
  3.4028233E+38 -3.4028233E+38  1.797693134862316E+30 -1.797693134862316E+30


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