### Number conversions:

The binary number system is the most important one in digital systems as it is very easy to execute in circuitry. The decimal system is significant because it is universally operated to characterize quantities outside a digital system.

In complement to binary and decimal, octal and hexadecimal number systems discover overall application in digital systems. These number systems (octal and hexadecimal) deliver an efficient means for describing large binary numbers. As we shall see, both these numeral systems have the benefit that they can be smoothly converted to and from binary.

In a digital system, three or four of these number systems may be in use at the same time, so an understanding of the system operation requires the ability to convert from one number system to another. This unit consults on how to perform these conversions. So, let us consult them one by one.

Also, read: **About Cyber Safety**

Also, read: **(cyber safety) confidentiality of information**

Also, read: **(Copyright) Ethics Issues, Society, and Law**

Also, read: **Technology Economic and E-waste**

Also, read: **Open Source Software philosophy and licenses**

Also, read: **(Digital Number System) Data Representation**

Also, read: **(Number conversions) binary number**

Also, read: **(Binary Addition) Data Representation**

Also, read: **Emerging Trends (AI and IoT)**

Also, read: **Emerging Trends (Cloud & Blockchain Technology)**

#### Decimal-to-Binary Conversion:

The common technique of converting decimal to binary is the repeated-division process. In this method, the number is sequentially divided by 2 and its remainders recorded. The final binary result is received by making all the remainders, with the last remainder being the most significant bit (MSB).

Keep dividing the quotient until you get 0.

It can be written as :

Then write the remainders in last-to-first order. It means 5 of the decimal number system is equal to 101 in binary system 510 = 1012. Consider another example.

Let us consider some examples now.

**EXAMPLE 1**: Convert 43_{10} to binary using the repeated division method.

SOLUTION>

Reading the remainders from

the bottom to the top,

43 _{10} = 101011_{2}

**EXAMPLE 2**: Convert 200_{10} to binary using the repeated division method.

SOLUTION>

Reading the remainders from the bottom to the top, the result is: 200_{10} = 11001000_{2}

On paper, you may even compute the conversion as depicted in the following example. (As you can see that this is just another way of repre ting the repeated division.

**EXAMPLE 3:** Convert 8510 to binary using the repeated division method.

SOLUTION >

(See on the right)

Q- Quotient and

R- Remainder

. 85_{10} = 1010101_{ 2}

#### Converting Fraction from Decimal to Binary:

For a fractional decimal digit, you can transform it to binary as :

abc. xyz (where a, b, c, x, y, z are digits)

abc as repeated division covered above and .xyz using repeated**multiplication as illustrated below.**

For instance, if you have 5.35, then convert 5 using repeated division as covered earlier and 0.35 as given in the adjacent box. Keep multiplying the fractional part with 2 and take out the non-fractional part: (repeated multiplication) Consider the following example.

##### EXAMPLE: Convert 4.8125 decimal numbers into the bin.

SOLUTION >

4- nonfractional part using repeated division

0.8125- fractional part using repeated multiplication.

##### Binary-to-Decimal Conversion:

The binary number system is a positional system where per binary digit (bit) takes certain importance based on its position relative to the LSB. Any binary number can be converted to its decimal equivalent positively by adding together the weights of the different positions in the binary number which have a 1. To explain, think of a binary number 11011_{2}.

Let’s try another sample with a greater number of bits i.e., 10110101_{2}.

Note that the procedure is to find the weights (i.e., powers of 2) for each bit position that contains a 1, and then add them up. Also, note that the *MSB has the importance of 2 ^{7} actually though it is the 8-bit; this is because the LSB is the first bit and has a weight of 2^{0}.*

The above process will always provide the correct decimal presentation of a binary number. There is a second process, called the dibble-dabble method, that will also provide the solution. To use this process, start with the left-hand bit. Multiply this weight by 2, and add the next bit to the right. Multiply the result value by 2, and add the next bits to the right. Stop when the binary point is reached. To illustrate via the following two examples,

Converting Fractional Part

A fractional binary number say pq.rst (where p, q, r, s, t are bits) converted as:

px 2¹ +qx2⁰ +r *x* 2^{–}¹ +s *x* 2^{-2} + t *x* 2^{-3} ……

e.g., 100.1101 will be converted as

3.3 Decimal-to-Octal Conversion:

A decimal integer can be converted to octal by using the exact repeated-division process we used in the decimal-to-binary transformation, but with a division factor of 8 instead of 2. an example is displayed below :

Note that the first remainder evolves the small significant digit (LSD) of the octal number, and the last remainder evolves the most important digit (MSD).

##### 3.4 Octal-to-Decimal Conversion

An octal number, then, can be efficiently converted to its decimal equivalent by multiplying each octal number by its positional weight.

#### To convert to a decimal system, every number system follows this rule :

Multiply each digit with base positional weight i.e., for a number ijk.Imn

3.5 Octal-to-Binary Conversion:

The direct advantage of the octal number system is the comfort with which conversion can be created between binary and octal numbers. The conversion from octal to binary is performed by converting per octal digit to its 3-bit binary equivalent. The eight possible digits are converted as suggested below.

Octal Digit | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Binary Equivalent | 000 | 001 | 010 | 011 | 100 | 101 | 110 | 111 |

Operating these transformations, any octal number is transformed to binary by converting each digit. For example, we can convert 472g to binary using 3 bits per octal digit as follows:

As another example, suppose transforming 5431 to binary:

Thus, 5431_{8}, 101100011001_{2}.

The same process applies equally to fractions. For example,

###### Note

The octal to binary conversion takes place using a 3-bit sub- stitution for each octal character Because 238, thus an octal number takes 3-bits to represent itself

3.6 Binary-to-Octal Conversion:

Converting from binary integers to octal integers is just the reverse of the foregoing method. The bits of the binary integer are grouped into packs of three bits beginning at the LSB. Then each group is converted to its octal match(Table 2.2). To illustrate, consider the conversion of 100111010₂ to octal.

##### .

Occasionally the binary number will not have even packs of 3 bits. For those cases, we can add one or two Os to the left of the MSB of the binary number to fill out the last group. This is described below for the binary number 11010110_{2}.

Note that a 0 was positioned to the left of the MSB in order to produce entire groups of 3. The same process applies to fractions. While after the binary Digit, zeros are added to the right. For sample…

##### .3.7 Decimal-to Hex Conversion:

Recall that we did the decimal-to-binary conversion using repeated division by 2, and decimal-to-octal using repeated division by 8. Also, decimal-to-hex conversion can be accomplished using the repeated units by 16. For example,

###### To convert 42310 to hex,

###### Similarly, to convert 214 10 to hex,

Note that any remainders that are greater than 9 are defined by letters A via F.

##### .3.8 Hex-to-Decimal Conversion:

A hex number can be converted to its decimal equal by using the attribute that each hex digit role has a weight that is a power of 16. The LSD has a weight of 16° = 1, the next-higher digit has a weight of 16¹ =16, the next-higher digit holds a weight of 16² = 256, and so on. The conversion method is shown in the examples below:

```
35616=3×16² +5×16¹ +6×16⁰ = 768 +80 + 6 = 854 10
2AF16 =2×16² +10×16¹ +15×16⁰ = 512 +160+15= 687 10
```

Note that in the second example the value 10 was replaced for A and the value 16 for F in the transformation to decimal. To convert a fractional number,

```
56.08165×16¹ + 6×16⁰ + -1 +0x16¹ +8x16
= 80+6+0+8/256
= 86 +0.03125
= 86.0312510
```

##### 3.9 Binary-to-Hex Conversion:

Binary numbers can be smoothly transformed to hexadecimal by grouping in groups of four beginning at the binary point.

##### .3.10 Hex to Binary Conversion:

Like the octal number system, the hexadecimal number system is used mostly as a “shorthand” process for representing binary numbers. It is a fairly simple value to convert a hex number to binary. Individually hex digit is converted to its 4-bit binary equivalent (Table 2.1). This is illustrated below for 9F216.

###### Consider another example

## Note

Hex to binary conversion takes place using

4-bit substitution for each hex character.

Because 24 = 16, thus a hexadecimal

number takes 4 bits to represent itself.

##### Transforming from Any Base to Any Different Base

As explained in earlier examples and the table below, there is a direct correspondence between the number systems with three binary digits reaching one octal digit; four binary digits reaching one hexadecimal digit, which you can utilize to transform from one number system to another.

## Note

The hexadecimal and octal codes are used as

shorthand means of expressing large binary numbers.

Correspondence of Binary and

Octal Number Systems

Correspondence of Binary, Octal and

Hexadecimal Number Systems

Let us think of some more examples about the same, i.e., converting from any number

system to another.

EXAMPLE 7 Convert 1948. B616 to Binary and Octal equivalents.

SOLUTION

Hexadecimal | 1 | 9 | 4 | 8 | . | B | 6 |

Binary | 0001 | 1001 | 0100 | 1000 | . | 1011 | 0110 |

(By converting each individual Hex digit to equivalent 4 digit binary from above Table 2.4)

1948.B6_{16} | =0001100101001000.10110110_{2} |

A new Octal number can be generated from the above Binary equivalent i.e., as follows:

Binary | 0 | 001 | 100 | 101 | 001 | 000 | . | 101 | 101 | 100 |

Octal | 1 | 4 | 5 | 1 | 0 | . | 5 | 5 | 4 |

(By making sets of 3 binary digits and converting them into equal octal no.)

1948.B6_{16} | 614510.554_{ 8.} |

##### EXAMPLE SOLUTION 8 :

Convert 75643.5704g to hexadecimal and binary numbers.

We shall convert it in the following way :

(i) From octal to binary – by describing individually octal digit to 3 digits binary number.

(ii) From the complete binary number, we shall create groups of 4 binary digits around the decimal point. (iii) Convert each 4-digit-binary group to an equivalent hex digit.

Octal | 7 | 5 | 6 | 4 | 3 | . | 5 | 7 | 0 | 4 |

Binary | 111 | 101 | 110 | 100 | 011 | . | 101 | 111 | 000 | 100 |

`75643.5704`

_{8} = 111101110100011.101111000100 _{2}