Jump to content

Floating Point/Floating-Point Numbers

From Wikibooks, open books for an open world

This page is going to introduce floating point numbers, and explain some key terminology.

Terminology

[edit | edit source]
base
The base of a floating-point number is the number to which the exponent is applied. In our decimal counting system, the base is usually 10. In a binary system, however, the base is usually 2. In the following number: , 10 is the base.
precision
The precision of a number is the amount of places available after the decimal point. In the scientific-notation number: , the precision is 4 because there are 4 digits after the decimal point.
significand
The significand is the value of the non-exponent part of the number. In the number , 1.2345 is the significand. This is also called the mantissa.
exponent
The exponent is the number to which the base is raised. In the number , 6 is the exponent.
Where:
m is the significand
b is the base
e is the exponent

Biasing

[edit | edit source]

In computer science, a number is called biased, if it has associated with it a certain additive offset value. For instance, if we have a 3 bit number (from 0 to 1112, which is 7 in decimal), we can define a bias of 4, so that every number value has 4 subtracted from it to provide the final value. Here are some examples:

unbiased number biased number
0 0 - 4 = -4
7 7 -4 = 3

This means that our number, now that it has been biased can go from -4 to 3. Biasing is only one of many methods for allowing binary values to express negative values.

Variables

[edit | edit source]

There are a number of variables that we will use throughout this book, and we are going to explain a few of them here:

b
b is the base number.
e
We will use the letter e to represent the number of bits in an exponent. This means that the exponent can take all integer values from 0 to .
p
This is the precision value of the significand.