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, libgFortran] Increase the default precision for real(16) by one


Tobias Burnus wrote:
Using the current settings  write(*,*) x  sometimes does not print all
possible digits of real(16) variables on S/380.

The result is that gfortran.dg/default_format_2.f90 FAILs. That test
case contains effectively:

      x = 1.0_16
      do i = 0, 200
        write (s,*) x
        read (s,*) y
        if (y /= x) res = res + 1
        x = nearest(x,-huge(x))
      end do

On S/380 this fails 7 times with the current setting; for these abs(x-y)
= 9.6296497219361792652798897129246366E-0035.

The solution is to simply print one more digit by default; one
additionally has to enlarge then the size of one character string in the
test suite as it is otherwise to short. I don't know whether it solves
some of the other failures on REAL(16) systems such as Debian's SPARC;
presumably it won't help on PowerPCs where the glibc seems to have a bug
(if I read PR24685 correctly).

The following patch has been build on x86-64 by me and bootstrapped and
regtested on S/390 by Andreas Krebbel.
OK for the trunk?

Tobias


2008-01-17 Tobias Burnus <burnus@net-b.de>


* io/write.c (write_real): Increase default precision for REAL(16) by one.

2008-01-17 Tobias Burnus <burnus@net-b.de>

* gfortran.dg/large_real_kind_form_io_1.f90: Enlarge string for internal I/O.


This is OK, thanks.


Jerry


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