Technical Considerations

34

Technical Considerations

Exception Handling

The IEEE standard defines five exceptions that indicate when an exceptional event has occurred. They are

invalid operation

underflow

overflow

division by zero

inexact result

There are three ways an application can deal with exceptions:

Continue operation.

Stop on exceptions if the programmer thinks they will invalidate results.

Include code to do something special when exceptions happen.

The IEEE standard lets programs deal with the exceptions in reasonable ways. It defines the special values NaN (Not-a- Number) and Infinity, which allow a program to continue operation. The IEEE standard also defines exception flags, which a program can test to detect exceptional events.

About the FPCE Technical Report

Even though many computers now conform to the IEEE standard, the standard has suffered from a lack of high-level portability. The reason is that the standard does not define bindings to high- level languages; it only defines a programming environment.

For instance, the standard defines data formats that should be supported but does not tell how these data formats should map to variable types in high-level languages. It also specifies that the user must be able to control rounding direction but falls short of defining how the user is able to do so.

However, the definition of a binding is in progress for the C programming language. The Floating-Point C Extensions (FPCE) branch of the Numerical C Extensions Group (NCEG), or ANSI X3J11.1, has proposed a general floating-point specification for the C programming language, called the FPCE technical report, that contains additional specifications for implementations that comply with IEEE floating-point standards 754 and 854.

The FPCE technical report not only specifies how to implement the requirements of the IEEE standards, but also requires some additional functions, called transcendental functions (sometimes called elementary functions). These functions are consistent with the IEEE standard and can be used as building

iMalc Manual

Page 40
Image 40
Apple 1.1.2 manual Exception Handling, About the Fpce Technical Report