Mark Hobley
FLOATING POINT NUMBERS

What are floating point numbers?


Floating point
is a way of storing numbers using mantissa and exponent representation. This enables a large range of numbers (including numbers containing a fractional component) to be stored.

Display Notations

Floating point numbers can be displayed either using fixed point notation or scientific notation.

Precision

The precision and range of floating point numbers is determined by the number of bits used to store them, which is defined within the underlying standard C library, upon which the programming language being used dependents. Floating point numbers are usually double precision, so the number is stored using twice the number of bits that the underlying platform uses for its registers. This means that on a 32 bit platform, 64 bits are used to store a floating point number.

Range

The range of values that can be represented as floating point numbers is far greater that the range of numbers that can be stored as integers. On a typical 32 bit platform, using double precision floating point, using a mantissa of 52 bits and an exponent of 11 bits, and 1 bit for the sign, floating point numbers have an approximate of range of 10e-308 to 10e308.

Accuracy

Not all numbers can be represented accurately using floating point representation, so this may affect the accuracy of floating point calculations.

Computers Use Binary Numbers

Problems with accuracy arise from using floating point numbers, because although the numbers are being displayed in decimal (base 10), they are internally stored and manipulated in binary (base 2), and fractional numbers in one base cannot always be accurately expressed in another base.



Wikipedia

Wikipedia Article