NAGware Fortran 95 compiler


        The Numerical Algorithms Group Ltd
        Wilkinson House
        Jordan Hill Road
        Oxford OX2 8DR      Tel: +44 1865 511245
                                Fax: +44 1865 310139
NAG offers a Fortran 95 system which behaves as a compiler but in reality translates to C (except for the PC version). The compiler is now in version 4.0 for both UNIX and MS-DOS. Both work well and include extended error checking both under compilation and execution. For early experiences please see the article "A First Encounter With F90" by Michael Metcalf in Fortran Forum, vol. 11, No. 1, pp. 24-32, March 1992. CERN had at that time a total of 80 000 code lines working with NAG's Fortran 90 compiler, version 1.1. A good service is obtained from the NAG Response Centre using electronic mail. The system is available for many systems.

Link to NAGWare Fortran 90/95 Compilers.

Compilation and execution with the NAG compiler:

You run Fortran 90/95 in about the same way as you run Fortran 77. The usual commands are, if the source code code1.f90 is in the new free form and source code code2.f is in the old fixed form.

           % f95 code1.f90 code2.f
and if you have a complete program it can be given an execution name.
          % f95 -o program program.f90
Using MS-DOS the compilation command is FTN90 and the source code is *.F90 for new free form and *.FOR for old fixed form. In order to get immediate execution you add /LGO as below.
          FTN90 PROGRAM.F90 /LGO
When you have the program in more than one file you have to first compile the various parts separately, and then link with the LINK77 command and obtain an executable program. We now show how to deal with the two program files PART1.F90 and PART2.FOR and creating a ready to run program WHOLE.EXE.
          FTN90 PART1.F90
          FTN90 PART2.FOR
          $LOAD PART1
          $LOAD PART2
          $FILE WHOLE.EXE
The symbol $ above is created automatically by the system. For additional information about f90 under UNIX we recommend the manual command
          % man f90
I here list the most important switches to the compilation command
   -c               compilation only (no linking)
   -C               index control
   -fixed           the old form of the source code
   -free            the new form of the source code
   -f77             calling convention consistent with 
		    the UNIX f77
   -g               generates information for debugging
   -Ipathname       Fortran 90 looks automatically for 
		    modules in the present directory, 
		    in directories in the I-list and in 
   -l               linking of a library
   -Ldir            Add dir to the list of directories 
		    for library routines
   -o               naming the output file
   -pg              generating execution profile
   -S               produces source code in the language C
   -v               give comment about how the compilation 
		    is proceeding
   -version         gives the compiler's version number
   -w               suppresses warnings

Peculiarities in the NAG compiler

System parameters

Running the NAG compiler on DEC station ULTRIX, Sun SPARC and IBM PC (MS-DOS) gives in all cases the following parameters for logical variables, integers, floating-point numbers and complex numbers. The identical values are obtained on all the three systems since all these architectures are based on the IEEE-754. Compare with the numerical inquiry functions in Appendix 5.8.

Please note that NAG has somewhat changed the system parameters in Version 2.1.

As you see NAG uses the digits 1, 2, and 3 for the KIND numbers. In order to improve the portability NAG has introduced an additional compiler switch -kind. If you use -kind=byte you will obtain the number of bytes as the KIND number, if you do not use this switch or use -kind=sequential you will use the NAG convention.

  LOGICAL            Default             byte            word
Before release 2.1
     KIND number =         2                1               2
From release 2.1
     KIND number =         3                1               3

  INTEGER            Default           int8          int16   int32
     KIND number =         3              1              2       3
          digits =        31              7             15      31
           radix =         2              2              2       2
           range =         9              2              4       9
     huge =       2147483647            127          32767  2147483647
     bit_size =           32              8             16      32

     REAL            Default           single        double
       KIND number =       1                1             2
            digits =      24               24            53
      maxexponent =      128              128          1024
      minexponent =     -125             -125         -1021
        precision =        6                6            15
            radix =        2                2             2
            range =       37               37           307
          epsilon =  0.11920929e-06  0.11920929e-06   0.2224460e-15
             tiny =  0.11754944E-37  0.11754944E-37   0.22250739-307
             huge =  0.34028235E+39  0.34028235E+39   0.17976931+309

       COMPLEX        Default          single         double
          KIND number =     1               1              2
            precision =     6               6             15
                range =    37              37            307
Back to Appendix 6
Last modified: 6 July 2000