Converting a Decimal Number to Binary

The binary system finds its wide application in electronics and computers, so programmers should understand how to convert from decimal to binary. The process used for converting a decimal number into binary form involves performing short division of a number by 2 and taking the remainder (for integer part) and performing short multiplication by 2 taking the result (for the decimal part).

To convert a decimal number to a binary number, the integer part of a given decimal number is divided by 2 repeatedly for the quotient and the remainder in each step is noted down till 0 is obtained as the final quotient. These reminders are then written in reverse order to obtain a number which is the binary representation of the integer part of the given decimal number.

For conversion of the decimal part of a number to an equivalent binary value, it is to be multiplied by 2. The integer part of the product will be either 0 or 1 which is to be noted. Continue multiplying the decimal part in each step and note the integer part of the result till we get 0. Now the noted integer values are written serially, which will give the binary value for the decimal part.

Decimal and Binary Number System

The decimal number system uses any of the 10 digits (from 0 to 9) to represent a number. So it has a base of 10. The binary number system represents a number using only two digits, 0 and 1. The digit used to represent a number in binary form is either 0 or 1. Therefore the binary number system is said to have a base of 2. A decimal number can be represented as an equivalent binary number and vice versa. When a decimal number is converted to an equivalent binary number, the base of the number changes from 10 to 2. For example, the decimal number 14 can be represented by the binary number 1110.

Number System

A number system uses different digits to represent a number. The number of digits that can be used in a number system is known as the base of the number system. Decimal and binary number systems are known to have different bases.

Decimals

Decimal is a way of representing numbers that are not whole numbers. Decimals can be used for representing fractions. A decimal number consists of an integer part which corresponds to the whole number part of a mixed fraction and the decimal part corresponds to the fraction part. The integer part becomes zero if it represents a proper fraction. The two parts are separated by a point. The number of digits in the decimal part of a decimal number is called the decimal places. A decimal number system is a convenient way of representing numbers and the most widely used number system.

Types of Decimal Numbers

  • Like decimal numbers (decimals having the same decimal places)

Example: 2.05. 5.19, 24.57 are like decimals as all of them have two decimal places.

  • Unlike decimal numbers (decimals having different decimal places)

Example: 3.4, 7.15, 18.063 are unlike decimals having different decimal places.

  • Recurring decimal numbers (repeating decimal digits)

Example: 2.345345

  • Non-recurring decimal numbers (non-repeating decimal digits)

Example: 1.583

Representation of Decimals

Let’s consider a decimal number 78.456 in which 78 is the whole number part and 456 is the decimal part. It has three decimal places. Again, 0.37 is also a decimal number having the whole part as zero and the decimal part is 37. This number has two decimal places.

This number can also be considered as a decimal representation of a mixed fraction in which the whole part is 78 and a proper fraction part is denoted by 0.456.

To understand the maths concepts in a detailed manner, visit Cuemath to book a free session.

 

Leave a Reply

Your email address will not be published.