CSC 284 · Introduction to Logic Design
Our notes
1 min readPositional number systems
In base b, each digit is multiplied by a power of b. In decimal 352 = 3 × 10² + 5 × 10 + 2. The bases used in computing:
- Binary (base 2): digits 0, 1.
- Octal (base 8): 0 to 7.
- Decimal (base 10).
- Hexadecimal (base 16): 0 to 9 then A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
Binary to decimal
Add the place values of the 1s.
- 1011 0110₂ = 128 + 32 + 16 + 4 + 2 = 182.
- Fractions use negative powers: 0.101₂ = 0.5 + 0.125 = 0.625.
Decimal to binary
- Whole part: divide by 2 repeatedly and read the remainders from the bottom up.
- Fraction part: multiply by 2 repeatedly and read the whole-number parts from the top down.
Worked example
Convert 45.375 to binary.
- 45 ÷ 2 = 22 r 1; 22 ÷ 2 = 11 r 0; 11 ÷ 2 = 5 r 1; 5 ÷ 2 = 2 r 1; 2 ÷ 2 = 1 r 0; 1 ÷ 2 = 0 r 1. Reading up: 101101.
- 0.375 × 2 = 0.75 (0); 0.75 × 2 = 1.5 (1); 0.5 × 2 = 1.0 (1). Reading down: .011.
- Answer: 101101.011₂. Check: 32 + 8 + 4 + 1 + 0.25 + 0.125 = 45.375.
Binary, octal and hex shortcuts
Since 8 = 2³ and 16 = 2⁴, group bits from the binary point.
- Octal: groups of 3. 101 101.011 = 55.3₈.
- Hex: groups of 4. 0010 1101.0110 = 2D.6₁₆.
- Hex to binary: write each digit as 4 bits. 3F₁₆ = 0011 1111 = 63.
Worked example
Convert 2AF₁₆ to decimal: 2 × 256 + 10 × 16 + 15 = 512 + 160 + 15 = 687.
Fractions that never end
0.1 in decimal is 0.0001100110011… in binary, a repeating pattern. Computers store a rounded value, which is why 0.1 + 0.2 is not exactly 0.3 in many programming languages.
Exams usually ask
- Convert between any two bases, including fractions.
- Explain why hexadecimal is used (short, easy to turn into binary).
Common mistake
Reading the remainders of repeated division from the top down: that gives the bits in reverse order.
Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.
Read
-
Systems of Numeration | Numeration Systems | Electronics Textbook
(opens allaboutcircuits.com in a new tab)
-
Conversion From Decimal Numeration | Numeration Systems | Electronics Textbook
(opens allaboutcircuits.com in a new tab)
-
Numeral system
(opens en.wikipedia.org in a new tab)
Wikipedia, Numeral system, CC BY-SA 4.0 · licence
-
Binary number
(opens en.wikipedia.org in a new tab)
Wikipedia, Binary number, CC BY-SA 4.0 · licence
-
NPTEL: Switching Circuits and Logic Design (IIT Kharagpur, Prof. Indranil Sengupta)
Video lectures, many hours in all: watch on Wi-Fi where you can.
(opens nptel.ac.in in a new tab)
NPTEL, NPTEL: Switching Circuits and Logic Design (IIT Kharagpur, Prof. Indranil Sengupta), CC BY-NC-SA 4.0 · licence
-
NPTEL: Digital Circuits and Systems (IIT Madras, Prof. Shankar Balachandran)
Video lectures, many hours in all: watch on Wi-Fi where you can.
(opens nptel.ac.in in a new tab)
NPTEL, NPTEL: Digital Circuits and Systems (IIT Madras, Prof. Shankar Balachandran), CC BY-NC-SA 4.0 · licence
Watch
-
Best pick Introduction to Number Systems
9 min · ≈ 41 MB · about ₦23
(opens youtube.com in a new tab)
-
Number Systems Introduction - Decimal, Binary, Octal & Hexadecimal
11 min · ≈ 50 MB · about ₦28
(opens youtube.com in a new tab)
-
Octal and Hexadecimal Number System Explained
24 min · ≈ 108 MB · about ₦61
(opens youtube.com in a new tab)
-
Understanding Binary, Hexadecimal, Decimal (Base-10), and more
11 min · ≈ 50 MB · about ₦28
(opens youtube.com in a new tab)
Practise
We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.