Differences in Accuracy Between VS FORTRAN and UNIX FORTRAN

How much accuracy did you obtain from your VS FORTRAN programs? How much accuracy will you obtain from these same programs when run on the UNIX system? What do you need to do, if anything, to bring the UNIX programs up to the same accuracy as you obtained under VS FORTRAN? This tip sheet answers these and other related questions.

This tip sheet assumes that you have some idea how numbers are stored on a computer; that you understand what floating point numbers are. For a brief introductory discussion of these concepts you may want to read "How Precise Are the Numerical Values Stored on Computers", the Programmer's Corner article in the March 1992 issue of the Computing News. This article is available on U-Discover!

The accuracy of a computer may be stated in terms of the smallest significant change that can be made to a number and stored. The ratio of this change to the number itself is defined as the "Relative Accuracy" of the computer and is equivalent to the computer's machine epsilon. Here is a comparison of the accuracy of VS FORTRAN programs and UNIX FORTRAN programs. The "UNIX" designation refers to Strauss.

Machine        Precision         Machine Epsilon     
-------        ---------         ----------------                              
                                           -7
UNIX           single            1.19  x 10                        
                                                                              
                                           -16                         
UNIX           double            2.22  x 10                       
                                                                       
                                           -34                         
UNIX           quadruple         1.92  x 10             

                                           -7
UDelVM/MVS     single            9.54  x 10                           
                                                                              
                                           -16                         
UDelVM/MVS     double            2.22  x 10                         
                                                                              
                                           -33                         
UDelVM/MVS     quadruple         3.08  x 10        
From the exponent of "machine epsilon," we see that you get about 7 decimal digits of accuracy on UNIX using single precision variables as compared to about 6 digits on UDelVM and about 16 digits using double precision on both systems and finally, 34 digits using quadruple precision on UNIX compared to about 33 on UDelVM. So, programs moved over to the UNIX system should obtain about the same if not slightly more accuracy than on UDelVM.

Finally, we consider the maximum and minmum range of numbers on each system.

                                   
Machine        Precision         Smallest/Largest Positive Number
-------        ---------         --------------------------------

UNIX           integer           [0,2147483647]

UNIX           real*4            [1.175494e-38,3.402823e+38]
                        
UNIX           real*8            [2.225074d-308,1.797393d+308]

UNIX           real*16           [3.362q-4932,1.20q+4932]

UDelVM/MVS     integer           [0,2147483647]               

UDelVM/MVS     real*4            [1.0e-78,1.0e+75]            

UDelVM/MVS     real*8            [1.0d-78,1.0d+75]
                                
UDelVM/MVS     real*16           [1.0q-78,1.0q+75]

Thus, if you have programs on UDelVM which generate data values of the order of 10e75, you will need to convert such programs to real*8 on UNIX, to obtain the same range of values.



  ******************************************************************
  *                                                                *
  *                Correspondence to VS FORTRAN                    *
  *                                                                *
  ****************************************************************** 
  *                                                                *
  *        VS FORTRAN                           UNIX               *
  *        ==========                           ====               *
  *                                                                *
  *                       Relative Accuracy                        *
  *                       =================                        *
  *                                                                *            
  *    sp: 9.54e-7                     sp: 1.19e-7                 *
  *    dp: 2.22d-16                    dp: 2.22d-16                *
  *    qp: 3.08q-33                    qp: 1.92q-34                * 
  *                                                                *    
  *            (No changes required..accuracy on UNIX as           *
  *             good as or slightly better than UDelVM)            *
  *                                                                *
  *                                                                *
  *                       Range of Numbers                         *
  *                       =================                        *
  *                                                                *
  *    int: [0,2147483647]        int: [0,2147483647]              *
  *    sp:  [1.0e-78,1.0e+75]     sp: [1.175494e-38,3.402823e+38]  *
  *    dp:  [1.0d-78,1.0d+75]     dp: [2.225074d-308,1.797393d+308]*
  *    qp:  [1.0q-78,1.0q+75]     qp: [3.362q-4932,1.20q+4932]     *     
  *                                                                *
  *           (Programs on UDelVM that generate values in the      *
  *            range of [1.0e-78,1.0e+75] need to be converted     *
  *            to double precision on UNIX)                        *
  *                                                                *
  ******************************************************************

University of Delaware
Last updated March 24, 1998