In this article we'll unveil the following secrets of converting numbers into binary digits;

In computing the Binary digit is a data encoding protocol:

"A protocol for encoding data in a file other than in a sequence of printable characters or human-readable text, or a file encoded in this manner" (Microsoft® Encarta® 2007. © 1993-2006 Microsoft Corporation.)

Unlike the human-readable text, or decimal values "0-10" also called denary that has a number based system 10, the Binary digits have a base 2.

Therefore, the decimal number 56(base 10) is represented as 00110100 in Binary using a base 2 number system.

0s in Binary represent OFF bytes and 1s represent ON bytes, thus when converting Binary to Denary and vice versa using a base 2 column heading the 1s represented on the column heading are added together and the outcome is the denary value. (See example 1.)

Conversion of Denary to Binary

Denary or (Decimal values)

The denary (or decimal) values are used by the computer to represent

the numerals 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. Thus it's easier for humans to understand.

Converting Denary to Binary.

Example 1.

Designing a base 2 column heading using: 2^7, 2^6, 2^5, 2^4, 2^3, 2^2, 2^1, 2^0.

128 64 32 16 8 4 2 1

0 0 1 1 0 1 0 0

Adding the numbers represented by 1s in the column heading:

32+16+4 =56

Therefore;

00110100= 56

A step by step example:

Converting 72 (base 10) into binary (base 2):

Step 1.

Design a base 2 column heading using: 2^7, 2^6, 2^5, 2^4, 2^3, 2^2, 2^1, 2^0.*

= 128 64 32 16 8 4 2 1

Step 2.

Represent the binary code onto the base 2 column heading:

128 64 32 16 8 4 2 1

0 1 0 0 1 0 0 0 =72

Step 3.

Adding numbers represented by 1s on the column heading:

64+8 =72

Note: If you have to represent a number such as 1024 (base 10) in binary, it'd be impossible to do so by using the following column heading: "128 64 32 16 8 4 2 1", thus, it has to be expanded by adding "2^8 = 256, 2^9= 512, 2^10= 1024, etc…" to the left hand side of the column heading. Then the column heading will be: "1024 512 256 128 64 32 16 8 4 2 1".

Need more help?

Describe your Problem

Example: Hard Drive Not Detected on My PC

Ask Your Question

Recent Posts from Programming