Last modified on 6 March 2011, at 03:10

Floating Point/Special Numbers

Special NumbersEdit

There are several special numbers specified in the IEEE 754 standard. These include representations for zero, infinity, and Not-A-Number (NaN).

ZeroEdit

A floating point number is said to be zero when the exponent and the significand are both equal to zero. This is a special case, because we remember that the significand is always considered to be normalized. This means that 1 < m < 2, and there is an implied "1." before the significand. If we look at the following equation:

(1.0 + m) \times b^e

And we plug in our values for m and e:

(1.0 + 0) \times b^0 = 1

We say that whenever the exponent is zero, we have a special class of numbers called "denormalized numbers". We will discuss denormalized numbers more later.

Negative Zero?Edit

Notice that our definition of zero doesnt have any mention of the sign bit. This means that we can have both a positive zero, and a negative zero, depending on the sign value. What is the difference between the two? In general, there is no difference between positive zero and negative zero, except that the sign bit can propagate though arithmetic operations.

InfinityEdit

When the exponent of the number is the maximum value, that is, when the exponent is all 1 bits, we have another special class of numbers. This means that regular numbers may never use the maximum exponent value for representing numbers. If the exponent is the maximum value, and the significand is zero, we say that this special case is called "Infinity". Notice that we can have negative infinity and positive infinity values, depending on the sign bit.

NaNEdit

If we have a maximum exponent value, and a non-zero significand, we have a very special number known as NaN. NaN stands for "Not a Number", and occurs when we perform certain illegal operations, such a division by zero. NaN can be signed, but the sign rarely matters. NaN numbers cannot be used meaningfully in calculations.

CasesEdit

Type Exp Fraction Sign
Positive Zero 0 0 0
Negative Zero 0 0 1
Denormalised numbers 0 non zero any
Normalised numbers 1..2^e-2 any any
Infinities 2^e-1 0 any
NaN 2^e-1 non zero any