HP (Hewlett-Packard) NS-series Network Card User Manual


 
Converting Numbers
HP Integrity NonStop NS-Series Operations Guide—529869-005
D-7
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.)
The result is:
Step Division Quotient Remainder
1. 354/2 = 177 0 remainder = least significant
(rightmost) digit
2. 177/2 = 88 1
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
Decimal Value Binary Value
354 %B101100010