Computable Performance Metrics

 

Module 1: Floating Point Precision

MACHAR – Test for IEEE 754

 

Final

 

 

Module Author

 

Kris Stewart

Computer Science Department

San Diego State University

stewart@sdsu.edu

stewart.sdsu.edu/

 

 

 

 

 

W.M. Keck Foundation

This file: ComputablePerformanceMetrics1.htm


Overview:

 

Module 0: Floating Point Precision covered the task to find a “computable” way to detect the actual manner in which a computer performed arithmetic, developed by W.J. Cody [1] in 1988.  In that module, a minimal test was examined to compute a machine’s unit round-off, the value eps so that 1.0 + eps = 1.0.  Considering the extent to which the FORTRAN subroutine MACHAR can compute the properties of a processor, some may wish to examine the full range of values computed.  This can be used to test if the user’s computer platform actually follows the IEEE 754 Floating Point Standard [2]. 

 

Introduction to problem:

 

There are several properties that characterize the behavior of a floating processing unit (FPU) in performing arithmetic.  Module 0 focused on the machine round-off and for most situations this is adequate as a background for Module 2: Computing Error and Work Estimators.  Given the effort the numerical analysis community put into debating and then specifying the IEEE-754 Floating-point standard, the acceptance by most computer floating point chip manufacturers of IEEE-754 and the current reconsideration of the 21 year old standard [3], an interesting class exploration of Cody’s computational experiment to determine the processor’s behavior on the system students actually use can be valuable.  The FORTRAN code for MACHAR.F is available online from NETLIB [4] and can be used to determine the performance of the compute system you may use in your own courses or research.

 

Statement of the problem:

 

What are the floating point properties of the machine rohan.sdsu.edu which is used for classes at San Diego State University?  NOTE: The portable routine MACHAR.F can be used to extend to other platforms with a FORTRAN compiler.

 

Background Information:

 

The reader should review the information presented in Module 0: Floating Point Precision and its references.

 

Explanation of the module used to solve the problem:

 

We will compile and run the MACHAR.F program from W.F. Cody.

 

Conceptual questions to examine student’s understanding:

 

Does your own computer satisfy the IEEE 754 Floating-point standard?

Does the Studio 11 FORTRAN 95 compiler, version 8.2, show that rohan.sdsu.edu satisfies IEEE 754 floating-point arithmetic?

 

Problems and projects:

 

Download the routine MACHAR.F from NETLIB [4] and write your own driver program to call the subroutine and print out its results.

 

Solutions:

 

We provide a zip file containing MACHAR.F from NETLIB and a simple driver program, MACHAR_DRIVER.F.  This routine was successfully compiled using

 

  f90 machar_driver.f machar.f -o machar

  machar > machar_out.txt

 

on the system rohan.sdsu.edu and resulted in the following output:

  using machar_driver.f with call to machar.f

  machar.f actually "computes" the machine constants

MACHAR CONSTANTS

 IBETA =     2 radix

 IT    =    24 number of base ibeta digits in fraction

 IRND  =     5 0 if fl pt add chops; 1 if rounds

 NGRD  =     0 number guard digits for multiply

 MACHEP =   -23 largest negative integer 1+ibeta**macheps != 1.   [!= means not equal]

 NEGEP =   -24 1-ibeta**negeps != 1.

 IEXP =     8 number of bits in exponent

 MINEXP =  -126 largest negative integer ibeta^minexp for valid fl pt number

 MAXEXP =   128 largest positive integer exponent for fl pt number

 EPS =  1.1920929E-07 fl pt unit round-off of machine               Note: This is the same value as our simple loop in Module 0

 EPSNEG =  5.9604645E-08

 XMIN =  1.1754944E-38 smallest nonvanishing fl pt power of radix

 XMAX =  3.4028235E+38 largest finite fl pt number

===========================================================

Suggestions to instructors for using the module:

 

The author was in the position of writing mathematical software for the Zilog Z80 chip, one of the first floating point chips that was produced for computer hobbyists in the years before the IBM PC arrived.  She built her own computer from a kit distributed by IMSAI in 1978 as the compute platform for her Masters Thesis at SDSU.  The codes developed for her thesis were translations into BASIC of the software in Computer Methods for Mathematical Computations [5] , a useful library for numerical analysis published in 1977.   This was a demonstration that small systems could be used for numerical analysis on the 16 bit architecture of the Z80 Floating Point Unit.  The codes in BASIC are archived in the Guide to Available Mathematical Software (GAMS) at NIST [6].  With her Masters, she began to work with Fred Krogh at the Jet Propulsion Laboratory, who had very strong feelings on the process of writing quality mathematical software that would run effectively on a wide range of computing platforms [7].

 

For anyone who wrote scientific software in the days before the standardization of the IEEE 754, the care that was needed to write code to be portable over the wide variety of computing platforms was important.  Before the 1980’s, it might take a large investment of  program designer time to move a code from, for example, an octal-based UNIVAC machine and have it run effectively on a hexadecimal-based IBM system.  Luckily this is now history that supports the importance of standards and user-community involvement with the computer-producing marketplace.  The IEEE 754-1985 standard was in place well before most current college students were born.  One could say that the continued increase in performance predicted by Dr. Moore in 1965 is assisted by the tremendous reduction in cost by commoditization of the components of computers now.  For those who wish to examine this exercise using the C programming language, a version of MACHAR.C is also available from NETLIB [8].  Additional background on the Anatomy of a Floating Point Number, with diagrams such as

 

 

and more are available, online, from WIKIPEDIA [9].  The author feels the class discussion can be completed in one 50 minute lecture, but it is an individual decision for each instructor how to weight the usefulness of this information.  As John Seely Brown, former Chief Scientist at XEROX PARC, says our students are “Growing Up Digital” [10].  Our students studying computational science were born IEEE floating-point digital!

 

References:

 

[1] W.J. Cody, Jr., Algorithm 665: {MACHAR}: A Subroutine to Dynamically Determine Machine Parameters". ACM Trans. on Mathematical Software (14), 1988.

 

[2] IEEE 754 Floating-point Standard FAQ (Frequently Asked Questions) is available online from http://grouper.ieee.org/groups/754/faq.html

 

[3] IEEE has a group discussing updating the 21 year old 754 standard.  Available online from http://grouper.ieee.org/groups/754/index.html

 

[4] NETLIB is the numerical analysis community collection of mathematical software, papers and databases available online from http://www.netlib.org/

 

MACHAR.F is part of the Basic Linear Algebra Subroutines (BLAS) in FORTRAN.  Available online from http://www.netlib.org/blas/machar.f

 

[5] G.E. Forsythe, M.A. Malcolm and C.B. Moler, Computer Methods for Mathematical Computations, Prentice-Hall, Englewood Cliffs, NY, 1977.

 

[6] http://gams.nist.gov/serve.cgi/Package/SCRUNCH/

K. Stewart, Master’s Project at SDSU, 1979.  Code archived at NIST through collaboration with David Kahaner.  SCRUNCH = Small Crunch – A Numerical Analysis Library in Basic for the Intel 8080 with Z80 floating point processor computer.  (Note, this was prior to the IBM PC based on the 8086 chipset).

 

[7] F. Krogh, http://mathalacarte.com/, now retired from the Jet Propulsion Lab and still very active in the development of high-quality mathematical software, especially for optimization.

 

[8] NETLIB distributes a main program and C version also.  Available online from http://www.netlib.org/blas/machar.c

 

[9] IEEE floating-point standard from Wikipedia gives an excellent article on the “Anatomy of a floating-point number”.  Available on line from http://en.wikipedia.org/wiki/IEEE_floating-point_standard

 

[10] John Seely Brown, “Growing up Digital”, Change, March/April 2000, pp. 10-20.  Also available online from Dr. Brown’s home page (under Publications):

http://www.johnseelybrown.com/Growing_up_digital.pdf