# Real number

Jump to: navigation, search

This article is unfinished. Please consider joining and adding to this article. Read about Page layout beforehand.

## Key points

• A real number is a simple data type stored as a floating point number – a number split into two parts
• A real number is a number with a fractional part (or decimal place).
• A real number is stored in parts called the mantissa and exponent. This kind of number is called a floating point number.
• The mantissa is a number used to store the precision of the number. The number of bits reserved for the mantissa determines its precision.
• The exponent is a number used to store the range of a number. The number of bits reserved for the exponent determines its range.
• Floating point numbers can also used an extra bit called a signed bit to indicate whether a number is positive or negative

## Information

Computers store whole numbers using binary. This represents numbers as a set of 1s and 0s. A decimal point cannot be represented by a binary number.

### Using fractional binary

It is possible to represent fractions of a whole number using binary, by utilising columns as follows

This number is 9.75 (8+1+0.5+0.25).

Fractional binary is useful, but cannot store numbers larger than the number of bits allocated, for example, if 16 bits were used to store the fractional binary numbers, 8 bits would store numbers above 0 (up to 255) and 1/2, 1/4, 1/8, 1/16, 1/32, 1/64, 1/128, 1/256 could be stored with the other 8 bits.

To store numbers outside of the range of binary storage, a new approach is needed.

### Floating point representation

A floating point number is a number represented in two parts. The detail of the number (all the digits) are represented in one part, called the mantissa, and the range of the number (how many zeros follow or precede the number) are represented in another part, called the exponent.

If the exponent is a negative number, this will make the floating point number a decimal.

### How is a floating point number stored?

A floating point number is stored using a number of bits for the mantissa, and a number of bits for the exponent. There is also usually a bit stored to indicate whether the value is positive or negative.

• If the number of bits for the mantissa is increased, the detail of the number will improve
• If the number of bits for the mantissa is reduced, the detail of the number will be reduced
• If the number of bits for the exponent is increased, the range of the number will improve
• If the number of bits for the exponent is reduced, the range of the number will be reduced