# 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 $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?

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.

## 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 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 $1..2^e-2$ any any
Infinities $2^e-1$ 0 any
NaN $2^e-1$ non zero any
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 6, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.8976522088050842, "perplexity_flag": "middle"}