(Number conversions) binary number

November 29, 2023
31 mins read
(Number conversions) binary number

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.

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).

binary number

Keep dividing the quotient until you get 0.

It can be written as :

binary number

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.

binary number

Let us consider some examples now.

EXAMPLE 1: Convert 4310 to binary using the repeated division method.

SOLUTION>

binary number

Reading the remainders from
the bottom to the top,
43 10 = 1010112

EXAMPLE 2: Convert 20010 to binary using the repeated division method.

SOLUTION>

binary number

Reading the remainders from the bottom to the top, the result is: 20010 = 110010002

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

. 8510 = 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)

Decimal to Binary

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.

Decimal to Binary

Thus 4.8125 10 = 100.1101₂

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 110112.

Let's try another sample with a greater number of bits i.e., 101101012.

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 27 actually though it is the 8-bit; this is because the LSB is the first bit and has a weight of 20.

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,

Number system

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 Digit01234567
Binary Equivalent000001010011100101110111

Table 2.2 Binary Equivalents of Octal Digits

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:

Consequently, octal 472 is identical to binary 100111010.

As another example, suppose transforming 5431 to binary:

Thus, 54318, 1011000110012.

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 110101102.

10110.01012 = 26.248

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

For the transformation from base 2 to base 16, we
use sets of four bits and vice-versa.

 

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

Hexadecimal1948.B6
Binary0001100101001000.10110110

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

1948.B616=0001100101001000.101101102

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

Binary0001100101001000.101101100
Octal 14510.554

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

1948.B616614510.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.

Octal75643.5704
Binary111101110100011.101111000100

75643.57048 = 111101110100011.101111000100 2

After learning about various digital number systems, let us talk about binary addition.

 

Keep reading

More posts from our blog

Digital Number System (Data Representation)
By November 29, 2023
1. INTRODUCTIONDigital techniques have found their way into numerous areas of technology, but the area of automatic digital computers is by far the...
Read more
Emerging Trends (AI and IoT)
By November 29, 2023
1. INTRODUCTIONThe rapid growth of technology is not at all surprising but what surprises is the rate at which the technology is growing and evolving,...
Read more
Emerging Trends (Cloud & Blockchain Technology)
By November 29, 2023
in this post, we discuss Cloud & Blockchain Technology. so let's get started...CLOUD COMPUTINGCloud computing is Internet-based computing,...
Read more