#Binary #encoding

  • What is binary encoding

  • What does the bit mean

    • What is the weight of the bits

    • Conversions

  • What does Byte mean

    • What are KiloBytes and MegaBytes

  • How Binary Operations Work

    • How to perform binary addition

    • How to do binary multiplication

What is binary encoding

In the late 1930s, Claude Shannon showed that with the use of switches (switches) closed, for true, and open, to false, it is possible to perform logical operations by associating the number 1 for ‘true’ and 0 for ‘false’. This codification of information is called binary base and that’s where computers work. It consists of using two statuses (represented by the numbers 0 and 1) to encode the information.

Since the 2000s BC, man has calculated with 10 digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9), what we call the decimal system (or base 10). However, ancient civilizations and certain current applications use other calculation bases, such as hexadecimal base (base 60), created by the Sumerians and that today is used in the current system of hours, minutes and seconds. There is also vigesimal base (20), used by the Maya, the duodecimal base (12), used by the Anglo-Saxons in their monetary systems until 1960 and which lasts in part in the time system of some countries; The quinary basis (5), also from the Maya; and the binary base (2), used by all digital technologies.

What does the bit mean

The term bit (with lowercase ‘b’) means binary digit, that is, 0 or 1 in binary encoding. It is the smallest unit of information manipulable by a digital machine. It is possible to physically represent this binary information by an electrical or magnetic signal, which, in addition to a certain threshold, corresponds to the value 1, by geometric roughness on a surface and thanks to the stable bits, that is, electronic components that have two stable states (one corresponds to state 1 and the other to 0).

With a bit, it is also possible to obtain two states: either 1 or 0. Thanks to 2 bits, it is possible to obtain four different states (2 * 2 = 4):

0 0
0 1
1 0
1 1

With 3 bits, it is possible to obtain eight different states (2 * 2 * 2 = 8):

Binary value in 3 bits Decimal value
000 0
001 1
010 2
011 3
100 4
101 5
110 6
111 7

For a group of n bits, it is possible to represent 2 ^ n values.

What is the weight of the bits

In a binary number, the value of a bit is called a Weight and depends on the position of the bit, starting from the right. As in the tens, hundreds and thousands, for a decimal number, the weight of a bit grows from a power of two going from right to left, as shown in the following table:

Binary number 1 1 1 1 1 1 1 1
Weight 2 ^ 7 = 128 2 ^ 6 = 64 2 ^ 5 = 32 2 ^ 4 = 16 2 ^ 3 = 8 2 ^ 2 = 4 2 ^ 1 = 2 2 ^ 0 = 1

Conversions

To convert a binary word to a decimal number, simply multiply the value of each bit by its weight and add each result. So the binary word 0101 in decimal:

2^3x0 + 2^2x1 + 2^1x0 + 2^0x1         
= 8x0 + 4x1 + 2x0 + 1x1
= 5

What does Byte mean

THE Byte (‘B’ in capital letters) is an information unit made up of 8 bits. It can store a character, such as a letter or a number. This grouping of numbers per series of 8 gives more readability, just as we like, on the decimal basis, to gather numbers per group of three, to distinguish the thousands. The number ‘1 256 245’, for example, is easier to read than 1256245. In general, a 16-bit information unit is called Word (Word). A unit of information 32 bits long is called a Double word (Double word, hence the name dword). For a byte, the smallest number is 0 (represented by eight zeros 00000000) and the largest is 255 (represented by eight digits “one”, 11111111), which represents 256 possibilities of different values.

2 ^ 7 = 128 2 ^ 6 = 64 2 ^ 5 = 32 2 ^ 4 = 16 2 ^ 3 = 8 2 ^ 2 = 4 2 ^ 1 = 2 2 ^ 0 = 1
0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1

What are KiloBytes and MegaBytes

For a long time, information technology stood out for the use of different values ​​for the units of the international system. So many computer scientists learned that 1 kilobyte was worth 1,024 bytes. However, since December 1998, the IEC (International Electrotechnical Commission) has ruled on the matter. Read the prefixes for multiple binaries.

See the standard units:

One kilobyte (kB) = 1,000 bytes

One MegaByte (MB) = 1000 kB = 1,000,000 bytes

One Gigabyte (GB) = 1000 MB = 1,000,000,000,000 bytes

One Terabyte (TB) = 1000 GB = 1,000,000,000,000,000 bytes

Many software (sometimes even certain operating systems) still use the pre-1998 notation, in which:

One kilobyte (kB) = 2 ^ 10 bytes = 1,024 bytes

One MegaByte (MB) = 2 ^ 20 bytes = 1024 kB = 1,048 576 bytes

One Gigabyte (GB) = 2 ^ 30 bytes = 1024 MB = 1,073 741 824 bytes

One Terabyte (TB) = 2 ^ 40 bytes = 1024 GB = 1,099 511 627 776 bytes

The IEC also defined the binary kilo (kibi), the mega binary (MEBI), the binary giga (Gibi), the binary tera (Tebi). See your definitions:

One kibibyte (kiB) = 2 ^ 10 = 1,024 bytes

One Mébibyte (MiB) = 2 ^ 20 = 1,048 576 bytes

A Gibibyte (GiB) = 2 ^ 30 = 1,073 741 824 bytes

One Tébibyte (TiB) = 2 ^ 40 = 1 099 511 627 776 bytes

It is important to note that the international community, as a whole, preferably uses the abbreviated terms to refer to these values. This results in the following notations for kilobyte, megabyte, gigabyte and terabyte:

kB, MB, GB, TB

Use a B uppercase to differentiate bit byte.

Here’s how it looks in the Internet Explorer browser:


How Binary Operations Work

Simple arithmetic operations like addition, subtraction and multiplication are easy to do in binary.

How to perform binary addition

The addition in binary is done according to the same rules in decimal: we start adding the bits of low weight (the bits on the right), then we retain when the sum of two bits with the same weight exceeds the value of the largest unit (in the case of torque: 1), this retention is transferred to the next heaviest bit. For example:

0 1 1 0 1
+ 0 1 1 1 0
1 1 0 1 1

How to do binary multiplication

The multiplication table in binary is very simple:

0x0 = 0

0x1 = 0

1×0 = 0

1×1 = 1

Multiplication is done by forming a partial product for each digit of the multiplier (only bits other than zero will give a non-zero result). When the multiplier bit is null, the partial product is equal to zero; when it is worth 1, the partial product is the displaced multiplicand of the number of positions equal to the weight of the multiplier bit. For example:

0 1 0 1 multiplying
x 0 0 1 0 multiplier
0 0 0 0
0 1 0 1
0 0 0 0
0 1 0 1 0

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *