Numeric Representation

 

Representing Numbers

 

A Bit

The computer (or an Intel computer, or a computer that runs on an Intel microprocessor) uses the binary system to represent its information. A piece of information in the computer is called a datum; and the plural is data. Sometimes, the word data is used for both singular and plural.

The computer represents data using only a 0 or 1 values. To make an illustration, let's consider that a computer uses a small box to represent such a value. This small box can have only one of two states. When the box is empty, we will give it a value of 0. When the box is full, we give it a value of 1. The box can have only one of these two values.
Bit

Since this box can have only one of two states, consider that you can use it to represent anything that could assume one out of two states. Examples include: True-False; Parent-Child; On-Off; Discount-NoDiscount; Male-Female; Yes-No, etc.

This technique of the binary system uses values 0 and/or 1. The entity used to represent such a value is called a binary digit; in its abbreviated form, it is called a bit (for binary digit). The bit (binary digit) is the most fundamental representation of the computer's counting system. Although this is valid for the computer, the Intel microprocessors cannot validate a variable at this level.

Although the Object Pascal compiler recognizes a bit, you cannot store a variable in a bit.

A Nibble

The single bit is used only to represent a tinny piece of information. To get effective numbers, the computer combines the bits. The first combination of bits consists of grouping four consecutive bits.

Nibble

To count the bits, we number them starting at 0, followed by 1, 2, and 3. The count starts with the most right bit. The first bit, on the right side of the nibble, is called the Low Order bit or LO bit. This is also called the least significant bit. The last bit, on the left side of the nibble, is called the High Order bit or HI bit; it is also called the most significant bit. The bit on the right side is counted as bit 0. The bit on the left side is counted as bit 3. The other bits are called by their positions: bit 1 and bit 2.

Nibble

Once again, each bit can have one of two states. Continuing with our illustration, when a box is empty, it receives a value of 0. Otherwise, it has a value of 1. On a group of four consecutive bits, we can have the following combinations:

This produces the following binary combinations: 0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111 = 16 combinations. When using the decimal system, these combinations can be represented as 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, and 15.

As you can see, a nibble is represented by a group of 4 (consecutive) bits. If you have a number that is less than four bits, such as 10 or 01 or 101, to complete and fill out the nibble consists of displaying 0 for each non-represented bit. Consequently, the binary number 10 is the same as 0010. The number 01 is the same as 0001. The number 101 is the same as 0101. This technique is valuable and allows you to always identify a binary number as a divider of 4.

When all bits of a nibble are 0, you have the lowest value you can get, which is 0000. Any of the other combinations has at least one 0 bit, except for the last one. When all bits are 1, this provides the highest value possible for a nibble. The lowest value, also considered the minimum value, can be represented in the decimal system as 0. The highest value, also considered the maximum, can be expressed in decimal value as 24 (2 represents the fact that there are two possible states: 0 and 1; 4 represents the fact that there are four possible combinations), which is 16. This produces 16 because 24 = 16.

As you can see, the binary system is very difficult (simply because we are not familiar with it) to read when a value combines various bit representations. To make it a little easier, the computer recognizes the hexadecimal representation of bits. Following the box combinations above, we can represent each 4-bit of the sixteen combinations using the decimal, hexadecimal, and binary systems as follows:

Decimal  Hexadecimal  Binary
0 0 0000
1 1 0001
2 2 0010
3 3 0011
4 4 0100
5 5 0101
6 6 0110
7 7 0111
8 8 1000
9 9 1001
10 A 1010
11 B 1011
12 C 1100
13 D 1101
14 E 1110
15 F 1111
 
Table of Numeric Conversions
 

When looking at a binary value represented by 4 bits, you can get its decimal or hexadecimal values by referring to the table above. A group of four consecutive bits has a minimum and maximum values on each system as follows:

  Decimal  Hexadecimal  Binary
Minimum  0 0x0 0000
Maximum  15 0xf 1111

Although Object Pascal recognizes a group of four consecutive bits, you cannot store any variable in it.

 

 


Previous Copyright © 2005 FunctionX Next