Converting Numbers

Decimal to Binary

Decimal to Binary

To convert a decimal number to a binary number:

1.Divide the decimal number by 2. The remainder of this first division becomes the least significant (rightmost) digit of the binary value.

2.Divide the quotient from Step 1 by 2, and use the remainder of the next division as the next digit (to the left) of the binary value. Continue to divide the quotients by 2 until the decimal number is exhausted. The remainder from the last division is the most significant (leftmost) digit of the binary value.

Example

Convert the decimal value 354 to its binary equivalent. (In this example, the symbol “/” indicates division.)

Step

Division

 

Quotient

Remainder

 

1.

354/2

=

177

0

remainder = least significant

2.

177/2

=

88

1

(rightmost) digit

 

3.

88/2

=

44

0

 

4.

44/2

=

22

0

 

5.

22/2

=

11

0

 

6.

11/2

=

5

1

 

7.

5/2

=

2

1

 

8.

2/2

=

1

0

 

9.

1/2

=

0

1

remainder = most significant

 

 

 

 

 

(leftmost) digit

The result is:

Decimal Value

Binary Value

354

%B101100010

HP Integrity NonStop NS-Series Operations Guide529869-005

D-7

Page 249
Image 249
HP NonStop NS Decimal to Binary, Result is, Step Division Quotient Remainder, Decimal Value Binary Value 354 B101100010