1 Number Systems And Conversions

Digital Logic · Unit 1

Number Systems and Conversions

Exam-focused notes for Number Systems and Conversions (Digital Logic, BIT103): what the TU syllabus asks and how it has actually been tested, with 13 solved past questions from this unit.

Number Systems and Conversions in short

Digital computers store and process everything as binary numbers. This chapter shows how to convert between number systems and how to do arithmetic, including subtraction with complements, which is how real hardware subtracts.

Number Systems and Conversions: notes

Binary, decimal, octal and hexadecimal conversions

A number system has a base (radix), which is the count of digits it uses. Decimal has base 10, binary base 2, octal base 8 and hexadecimal base 16. Hexadecimal digits are 0 to 9 and A to F. Here A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15.

Decimal to any base: divide the number again and again by the base. Write down each remainder. Read the remainders from bottom to top.

$$\begin{aligned} 45 \div 2 &= 22 \text{ rem } 1 \ 22 \div 2 &= 11 \text{ rem } 0 \ 11 \div 2 &= 5 \text{ rem } 1 \ 5 \div 2 &= 2 \text{ rem } 1 \ 2 \div 2 &= 1 \text{ rem } 0 \ 1 \div 2 &= 0 \text{ rem } 1 \end{aligned}$$

Reading upward gives $(45)_{10} = (101101)_2$.

Any base to decimal: multiply each digit by its place value (a power of the base) and add.

$$(3A7)_{16} = 3 \times 256 + 10 \times 16 + 7 = 768 + 160 + 7 = 935$$

Binary to octal: group bits in threes from the right. Binary to hexadecimal: group bits in fours from the right. Add zeros on the left if a group is short.

$$(101101)_2 = (101\ 101)_2 = (55)_8, \qquad (101101)_2 = (0010\ 1101)2 = (2D){16}$$

Octal or hexadecimal to binary is the reverse. Replace each digit by its 3-bit or 4-bit group.

DecimalBinaryOctalHex
81000108
10101012A
15111117F
21411010110326D6

To go from octal to hexadecimal, convert to binary first and regroup. For example $(326)_8 = (011\ 010\ 110)_2 = (1101\ 0110)2 = (D6){16}$.

What this unit covers

  • Binary decimal octal hexadecimal conversions
  • Fractional number conversions
  • Complements of decimal numbers
  • Binary arithmetic operations
  • Binary subtraction using complements

Binary decimal octal hexadecimal conversions

2081 · 5 marks

Convert (257)₈ into hexadecimal and decimal number system. [5]

Show solved answer

Convert (257)₈ to Decimal and Hexadecimal

Given Data

  • Number: $(257)_8$ (octal, base 8)
  • Required: convert to hexadecimal (base 16) and decimal (base 10)

Part 1: Octal to Decimal

Multiply each digit by its positional weight (power of 8):

$$ (257)_8 = 2 \times 8^2 + 5 \times 8^1 + 7 \times 8^0 $$

$$ = 2 \times 64 + 5 \times 8 + 7 \times 1 $$

$$ = 128 + 40 + 7 = 175 $$

$$ \boxed{(257)8 = (175){10}} $$


Part 2: Octal to Hexadecimal (via Binary)

Step 1: Convert each octal digit to 3-bit binary

Octal Digit3-bit Binary
2010
5101
7111

$$ (257)_8 = (010\ 101\ 111)_2 = (10101111)_2 $$

Step 2: Regroup binary into groups of 4 (from right)

$$ 10101111 \rightarrow 1010\ 1111 $$

(No padding needed here since 8 bits = two groups of 4.)

4-bit GroupHexadecimal
1010A
1111F

Answer

$$ \boxed{(257)8 = (AF){16}} $$

Verification (decimal check): $$ (AF){16} = 10 \times 16 + 15 = 160 + 15 = 175 = (175){10} \checkmark $$


Summary

FromToResult
$(257)_8$Decimal$(175)_{10}$
$(257)_8$Hexadecimal$(AF)_{16}$
Open this answer on its own page →

2080 · 5 marks

Convert $(591.62)_{10}$ into hexadecimal and octal number system. [5]

  • Decimal number: $(591.62){10}$ - Target bases: 16 (hex) and 8 (octal) --- Division Quotient Remainder Digit -------------------------------------- 591 ÷ 16 36 15 F 36 ÷ 16 2 4 4 2 ÷ 16 0 2 2 Reading bottom to top: $(591){10} = (24F){16}$ Multiplication Result Integer Digit ---------------------...
Open this answer on its own page →

2079 · 5 marks

Convert $(110.101)_8$ into binary and decimal number system. [5]

Given data: - Number to convert: $(110.101)8$ (octal, base 8) - Target systems: Binary (base 2) and Decimal (base 10) All required data present. --- Each octal digit maps to a 3-bit binary group. Octal Digit Binary :-----------::------: 1 001 1 001 0 000 . . 1 001 0 000 1 001 Combining: $$(110.10...

Open this answer on its own page →

2078 · 5 marks

Convert 51966.57 decimal number system into octal number system and hexadecimal number system. [5]

  • Decimal number: $51966.57$ - Integer part: $51966$ - Fractional part: $0.57$ - Target bases: Octal (8) and Hexadecimal (16) --- Division Quotient Remainder ------------------------------- $51966 \div 8$ 6495 6 $6495 \div 8$ 811 7 $811 \div 8$ 101 3 $101 \div 8$ 12 5 $12 \div 8$ 1 4 $1 \div 8$ 0...
Open this answer on its own page →

Binary arithmetic operations

2081 · 5 marks

Perform following arithmetic operation: a) $101101 + 011011$ b) $101111 - 010101$ [5]

  • a) $101101 + 011011$ - b) $101111 - 010101$ --- Rules: $0+0=0$, $0+1=1$, $1+0=1$, $1+1=10$, $1+1+1=11$ Step-by-step (right to left): Position A B Carry In Sum Carry Out ------------------ 1 (LSB) 1 1 0 0 1 2 0 1 1 0 1 3 1 0 1 0 1 4 1 1 1 1 1 5 0 1 1 0 1 6 (MSB) 1 0 1 0 1 Verification (Decimal):...
Open this answer on its own page →

Binary subtraction using complements

2079 · 5 marks

Subtract $(739.57)_{10}$ - $(78.35)_2$ using both 10's and 9's complement. [5]

  • Minuend: $(739.57){10}$ - Subtrahend: written as $(78.35)2$ Data issue: The value $78.35$ contains the digits $7$ and $8$ and $3$ and $5$, none of which are valid binary digits (base 2 only allows $0$ and $1$). Therefore $(78.35)2$ cannot be a genuine binary number. The subscript $2$ is a typog...
Open this answer on its own page →

2078 · 5 marks

Subtract $(111000.110)_2 - (110100.101)_2$ using both 2's and 1's complement. [5]

  • Minuend $A = (111000.110)2$ - Subtrahend $B = (110100.101)2$ - Format: 6 integer bits, 3 fractional bits. --- - $A = 111000.1102 = 56 + 0.75 = 56.75$ - $B = 110100.1012 = 52 + 0.625 = 52.625$ - $A - B = 4.125 = (100.001)2 = (000100.001)2$ So the expected answer is $(000100.001)2$. --- Step 1: 1...
Open this answer on its own page →

2077 · 5 marks

Substract (1011.11- 1010.10) using 2's and l's complement. [5]

  • Minuend: $1011.112$ - Subtrahend: $1010.102$ - Operation: $1011.11 - 1010.10$ Decimal check of inputs: - $1011.11 = 8 + 2 + 1 + 0.5 + 0.25 = 11.75$ - $1010.10 = 8 + 2 + 0.5 = 10.50$ - Expected difference $= 11.75 - 10.50 = 1.25$ --- Step 1: 1's complement of subtrahend $1010.10$ (flip every bit...
Open this answer on its own page →

2081.2 · 5 marks

Perform $A - B$ with the given binary numbers using 1’s complement. $A = 1010100$, $B = 1000100$. [5]

Show solved answer

A − B Using 1's Complement Method

Given

  • $A = 1010100$
  • $B = 1000100$
  • Operation: $A - B$ using 1's complement

Decimal check of inputs:

  • $A = 1010100_2 = 64+16+4 = 84$
  • $B = 1000100_2 = 64+4 = 68$

Solution

Step 1: 1's Complement of B

Invert every bit of $B$:

B        = 1000100
1's comp = 0111011

Step 2: Add A and 1's complement of B

   1010100
 + 0111011
 ---------
  10001111

Bit-by-bit (right to left):

  • $0+1 = 1$
  • $0+1 = 1$
  • $1+0 = 1$
  • $0+1 = 1$
  • $1+1 = 0$, carry 1
  • $0+1+1 = 0$, carry 1
  • $1+0+1 = 0$, carry 1 (carry out)

Result = $1,0001111$ (a carry out of 1 is generated).

Step 3: End-around carry

Since a carry is produced, the result is positive. Add the carry back to the 7-bit sum:

   0001111
 +       1
 ---------
   0010000

Step 4: Final Result

$$A - B = 0010000_2$$

Verification

$$0010000_2 = 16_{10}, \quad 84 - 68 = 16 \checkmark$$

Conclusion

$$A - B = 0010000_2 = 16_{10}$$

Open this answer on its own page →

Fractional number conversions

2078 · 5 marks

Convert (1011.110) into decimal. and hexadecimal [5]

Show solved answer

Convert $(1011.110)_2$ to Decimal and Hexadecimal

Given Data

  • Binary number: $(1011.110)_2$
  • Integer part: $1011$
  • Fractional part: $.110$

Part 1: Binary to Decimal

Multiply each bit by its positional weight (power of 2) and sum.

Integer part: $1011$

$$1 \times 2^3 + 0 \times 2^2 + 1 \times 2^1 + 1 \times 2^0 = 8 + 0 + 2 + 1 = 11$$

Fractional part: $.110$

$$1 \times 2^{-1} + 1 \times 2^{-2} + 0 \times 2^{-3} = 0.5 + 0.25 + 0 = 0.75$$

Total

$$11 + 0.75 = \boxed{11.75_{10}}$$


Part 2: Binary to Hexadecimal

Group bits into sets of 4, starting from the binary point (left for integer, right for fraction), padding with zeros where needed.

Grouping

  • Integer part: $1011$ (already 4 bits)
  • Fractional part: $110 \rightarrow 1100$ (pad right with one zero)

$$\underbrace{1011}{\text{integer}} . \underbrace{1100}{\text{fraction}}$$

Convert each group

Binary GroupDecimalHex Digit
$1011$$11$$B$
$1100$$12$$C$

Result

$$\boxed{(1011.110)2 = (B.C){16}}$$


Summary

FromToResult
$1011.110_2$Decimal$11.75_{10}$
$1011.110_2$Hexadecimal$B.C_{16}$
Open this answer on its own page →

2077 · 5 marks

Convert (1011.110) into decimal and hexadecimal. [5]

Show solved answer

Convert $(1011.110)_2$ to Decimal and Hexadecimal

Given

Given data:

  • Binary number: $1011.110_2$
  • Integer part: $1011$
  • Fractional part: $110$

Required conversions: to decimal (base 10) and to hexadecimal (base 16).


Solution

Part A: Binary to Decimal

Integer part $1011$:

$$1\times2^3 + 0\times2^2 + 1\times2^1 + 1\times2^0 = 8 + 0 + 2 + 1 = 11$$

Fractional part $.110$:

$$1\times2^{-1} + 1\times2^{-2} + 0\times2^{-3} = 0.5 + 0.25 + 0 = 0.75$$

Combine:

$$(1011.110)2 = 11 + 0.75 = (11.75){10}$$


Part B: Binary to Hexadecimal

Group into blocks of 4 bits from the binary point outward, padding with zeros.

Integer part: $1011$ (already 4 bits)

$$1011_2 = 8+2+1 = 11 = B$$

Fractional part: $110 \rightarrow$ pad right to $1100$

$$1100_2 = 8+4 = 12 = C$$

Result:

$$(1011.110)2 = (B.C){16}$$

Check via decimal: $11.75_{10} = B + 0.75$. Fraction $0.75 = \frac{12}{16} = 0.C_{16}$. ✓


Summary

FromToResult
$(1011.110)_2$Decimal$(11.75)_{10}$
$(1011.110)_2$Hexadecimal$(B.C)_{16}$
Open this answer on its own page →

2081.2 · 5 marks

Perform the following conversion: (a) $(0.625)_{10}$ to binary. (b) $(173)_8$ to decimal. [2.5+2.5]

  • (a) Convert $(0.625){10}$ to binary - (b) Convert $(173)8$ to decimal --- Method: Multiply the fractional part by 2 repeatedly, recording the integer part each time, reading top to bottom. Step Fraction × 2 Result Bit ---------------------------------- 1 0.625 × 2 1.250 1 2 0.250 × 2 0.500 0 3 ...
Open this answer on its own page →

Complements of decimal numbers

0 · 5 marks

a) Obtain the 9's and 10's complement of i) 13579 ii) 90090 decimal number. b) Convert 6524275 octal to hexadecimal [5]

Formulas: - 9's complement: subtract each digit from 9 - 10's complement = 9's complement + 1 9's complement: subtract each digit from 9 $9-1=8,\ 9-3=6,\ 9-5=4,\ 9-7=2,\ 9-9=0$ $$\text{9's complement} = 86420$$ 10's complement: $86420 + 1 = 86421$ 9's complement: subtract each digit from 9

Open this answer on its own page →