Re: 128 bit long double on AMD 64

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tim Prince <timothyprince@xxxxxxxxxxxxx> comments on my posting about
128-bit floating-point arithmetic support on AMD64 and other
architectures:

>> Several of those Fortran compilers support 128-bit floating point in
>> software.

I just made experiments with all of the Fortran compilers that I have
on AMD64: only icc was even willing to compile code with REAL*16
declarations, and it did indeed use 128-bit arithmetic with a 113-bit
significand.

Here are the versions of Fortran compilers that I just tried:

	g77		GNU Fortran (GCC) 3.3.5
			[won't compile REAL*16]

	gfortran	GNU Fortran 95 (GCC 4.0.2 20051130 (Red Hat 4.0.2-14.EL4))
			[won't compile REAL*16]

	ifort		Intel(R) Fortran Compiler for Intel(R) EM64T-based applications,
			Version 8.1 Build 20060606 Package ID: l_fce_pc_8.1.037

	pathf90		PathScale EKOPath(TM) Compiler Suite: Version 2.5
			[won't compile REAL*16]

	pgf90		5.2-1 and 6.2-3
			[won't compile REAL*16]

	sunf90		Sun Fortran 95 8.3 Linux_i386 Build27_2 2006/08/02
			[won't compile REAL*16]

For the record, here is the simple Fortran 77 test program that I
used:

% cat qeps.f
      REAL*16 store
      REAL*16 eps
      INTEGER k

      eps = 1.0q0
      k = 0
   10 IF (store(1.0q0 + eps/2.0q0) .NE. 1.0q0) THEN
          k = k - 1
          eps = eps/2.0q0
          GO TO 10
      END IF
      WRITE (6,'(2x, i6, 2x, 1pE45.35e4)') k, eps
      WRITE (6,'(2x, i6, 2x, z32.32)') k, eps

      END


      REAL*16 FUNCTION store(x)
      REAL*16 x
      store = x
      END

For Fortran 90/95 buffs, here is an alternate version:

% cat qeps.f90
      real (kind = 16) :: store
      real (kind = 16) :: eps
      INTEGER k

      eps = 1.0q0
      k = 0
   10 IF (store(1.0q0 + eps/2.0q0) .NE. 1.0q0) THEN
          k = k - 1
          eps = eps/2.0q0
          GO TO 10
      END IF
      WRITE (6,'(2x, i6, 2x, 1pE45.35e4)') k, eps
      WRITE (6,'(2x, i6, 2x, z32.32)') k, eps

      END


      FUNCTION  store(x)
      real (kind = 16) :: store
      real (kind = 16) :: x
      store = x
      END

There was no difference in the handling of the two versions of the
test program by the listed compilers: only Intel ifort compiled the
code.

Sun Solaris SPARC f77, f90, and f95 all happily accept the programs.

-------------------------------------------------------------------------------
- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- University of Utah                    FAX: +1 801 581 4148                  -
- Department of Mathematics, 110 LCB    Internet e-mail: beebe@xxxxxxxxxxxxx  -
- 155 S 1400 E RM 233                       beebe@xxxxxxx  beebe@xxxxxxxxxxxx -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux