MAD 3401
IEEE Notes - Sect. 4
Representing Special Values

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

The following examples illustrate these values for the 32-bit format; the 64-bit format is exactly the same except the pattern is simply extended to fill out the longer exponent and fraction fields.

The bit patterns 00000000 and 11111111 in the exponent field are reserved so they can be used to denote special values. The zero pattern is used for zero:

0 00000000 0000000 0000000000000000 = 0.0 = 00000000 (hex)

This is necessary since the hidden bit in the mantissa implies that a number is non-zero even when the fractional part is zero. The ones pattern is used for error conditions:

The representation for +/- infinity is:

0 11111111 0000000 0000000000000000 = Inf = 7F800000 (hex)

1 11111111 0000000 0000000000000000 = -Inf = FF800000 (hex)

These values appear if you divide by zero or do a calculation that causes an overflow condition -- a number bigger than the largest value (about 3.4x10^{38} in single precision) that can be stored. Comparison tests do the right thing by making infinity bigger than any number.

The representation for Not-a-Number (NaN) is:

0 11111111 0111111 1111111111111111 = NaNS = 7FBFFFFF (hex)

0 11111111 1000000 0000000000000000 = NaNQ = 7FC00000 (hex)

NaNS means "signalling", it generates a trap, while NaNQ means "quiet", the calculation continues. Which of these is generated is usually a compiler option; default varies from machine to machine.
NaN results from a calculation like 0/0 or log(0) whose result is undefined. Any numerical calculation with NaN as input produces NaN as output so, for example, 0*NaN = NaN.

Although I will go over this in lecture, I will not ask about NaN or Inf on the exams. You might get them from your programs, however!

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

Next: Section 5: 64-bit IEEE representation

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

This material is © Copyright 1996, by James Carr. FSU students enrolled in MAD-3401 have permission to make personal copies of this document for use when studying. Other academic users may link to this page but may not copy or redistribute the material without the author's permission.

Return to the Home Page for MAD-3401.