Hexadecimal and binary numbers, byte, bit and word.

Computers work with binary numbers, or in other words, electrical values ​​that can be represented by ones and zeros.

If you store 8 electric signals, it can be interpreted as storing a binary number of 8 digits. Five low values followed by three high values can be interpreted as the binary number; 00000111.

Therefore, in programming, we often work with binary or hexadecimal numbers.

Decimal numbers

Most people use the decimal numeral system or base ten. This means that any natural number can be written as a sequence of ten symbols {1,2,3,4,5,6,7,8,9,0} .

With one symbol we can represent the numbers zero to nine. If we represent ten, we use two symbols "10". When we want to represent a number from 99 to 999, we use three symbols "100, 101, ..., 999" and so on.

Binary numbers

We can represent numbers using a sequence of only two symbols {0,1}

With one symbol we can represent number one and the zero. To represent number two and three, we use two symbols;

2 is 10 and 3 is 11.

4 is 100 in binary representation and so on.

The binary numeral system is also known as base-2 numeral system.

Hexadecimal numbers

We have just seen that in decimal and binary numbers, they use 10 and 2 symbols respectively, to represent any number.

In hexadecimal representation, 16 symbols {1,2,3,4,5,6,7,8,9,0, A, B, C, D, E, F} are used.

Examples:

It is very easy to convert these representations using the following comparison table:

Decimal

Binary

Hexadecimal

00

0000

0

01

0001

1

02

0010

2

03

0011

3

04

0100

4

05

0101

5

06

0110

6

07

0111

7

08

1000

8

09

1001

9

10

1010

A

11

1011

B

12

1100

C

13

1101

D

14

1110

E

15

1111

F


Bit

In computing, a bit is the smallest unit of information and can only take two values; zero or one. A bit, is a binary number of one digit. A bit can be physically implemented with a two-state electronic device.

Byte

A byte is made of 8 bits. It represents an 8-digit binary number. In a byte, we can store a number between 00000000 and 11111111 in the binary system, between 0 to 255 in decimal system and between 00 to FF in hexadecimal system.

In computing, most of the measures are expressed in bytes or it´s multiples like; Kilobyte, Megabyte, Terabyte, etc..

What does "Word" mean in computing?

When we talk about computer architecture, processors or operating systems, we understand that a word is a set of bits, usually 8, 16, 32 or 64 bits.

We say that a CPU has a 32-bit word, if it´s instructions are based on an information unit of 32 bits. This means that most of the CPU registers are 32 bits, the information transfer unit is usually 32 bits, etc.. Overall, we can think that the processor architecture is based on units of 32 bits.

A 32-bit operating system is ready to use a processor instruction set of 32-bit. But it is also common that a 32-bit CPU, can support 16-bit instructions, so you can use a 16-bit operating system.