# Floating Point/Special Numbers

## Special Numbers

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

## Zero

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 ${\displaystyle 1, and there is an implied "1." before the significand. If we look at the following equation:

${\displaystyle (1.0+m)\times b^{e}}$

And we plug in our values for m and e:

${\displaystyle (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?

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 through arithmetic operations.

## Infinity

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.

## NaN

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 of zero by zero. NaN can be signed, but the sign rarely matters. NaN numbers cannot be used meaningfully in calculations.

## Cases

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