Technical Considerations

36

Technical Considerations

each data format have a sign bit (s), an exponent field (e), and a fraction field (f). For each format, it lists requirements for the minimum lengths of these fields. For example, the standard describes a 32-bit single format whose exponent field must be 8 bits long and whose fraction field must be 23 bits long.

The only required data format is the 32-bit single format. A 64- bit double format is strongly recommended. The IEEE standard also describes two data formats called single-extendedand double-extendedand recommends that floating-point environments provide the extended format corresponding to the widest basic format (single or double) they support.

To conform to the IEEE requirements on floating-point data formats, the PowerPC Numerics environment provides three data formats: single (32 bits), double (64 bits), and double-double (128 bits).

The single and double formats are implemented exactly as described in the standard. The double-double format is provided in place of the recommended double-extended format. IEEE requires that the double-extended format be at least 79 bits long with at least a 15-bit exponent. The double-double format is 128 bits long and has an 11-bit exponent.

The double-double format is just what its name sounds like: two double-format numbers combined. The PowerPC assembly- language multiply-add instructions, which multiply two double- format numbers and add a third with at most one roundoff error, make implementing the double-double format much more efficient than implementing a true IEEE double-extended format.

The IEEE standard also makes requirements about how the values in these data formats are interpreted. PowerPC Numerics follows these requirements exactly.

iMalc uses doubles for all calculations.

Interpreting Floating-Point Values

Regardless of which data format (single, double, or double-double) you use, the numerics environment uses the same basic method to interpret which floating-point value the data format represents.

Every floating-point data format has a sign bit, an exponent field, and a fraction field. These three fields provide binary encodings of a sign (+ or Ð), an exponent, and a significand, respectively, of a floating-point value. The value is interpreted as

± significand x 2exponent-bias

iMalc Manual

Page 42
Image 42
Apple 1.1.2 manual Interpreting Floating-Point Values