L03 NumberSystem
L03 NumberSystem
14/12/2023
Mehwish Fatima- CIIT Lahore
Numeral System
Decimal System
Binary System
Octal System
Hexadecimal System
Digit and Positions
Bits, Bytes & Words
Conversions
Negative Numbers
Numeral System 3
14/12/2023
A Numeral System is a writing-system for expressing numbers, a mathematical notation for representing
numbers of a given set, using symbols in a consistent manner.
Ideally, a numeral system will:
Represent a useful set of numbers (integers, or rational numbers)
Give every number represented a unique representation (or a standard representation)
Reflect the algebraic and arithmetic structure of the numbers.
Base/Radix of Numeral System 4
14/12/2023
The number of distinct symbols that can be used to represent numbers in that system.
For example, the base for the ‘decimal numerical symbol is 10’, as we can use the ten symbols 0,1,2,…,9
to represent numbers in this system.
14/12/2023
used by modern civilizations.
Binary Number System 6
14/12/2023
The binary numeral system (base two) has two as its base.
It is the numerical base used by the modern day computers where numbers need to be stored using the
on/off logic of electronic and/or magnetic media. The ON and OFF conveniently translate into 1 and 0.
Octal Number System 7
14/12/2023
The octal numeral system (base eight) has eight as its base.
Hexadecimal Number System 8
14/12/2023
The hexadecimal numeral system (base 16) has sixteen as its base.
This system uses the 16 symbols: {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F}
The main advantage of using this numeral system is that it keeps the representations short, and hence
manageable.
For example: the decimal number 199834, is represented in binary as 110000110010011010; and in
hexadecimal as 30C9A.
Why we need all these systems 9
14/12/2023
The length of representations can grow very rapidly in binary, and even decimal, while slowly in
hexadecimal, as extra symbols are allowed.
So we need hexadecimal to keep things manageable on the paper.
Computers need binary numbers, but humans can work better with decimal, octal and hexadecimal.
Hence we should know all these systems and how to convert numbers between these different representations.
Digit & Position 10
14/12/2023
The length of a representation grows, from right to left, like: 0,1, 2, 3, … so on.
Let’s take the example of the decimal system.
The number nine, in decimal, consists of one digit ‘9’ at position 0.
Similarly, all the numbers 0, 1, 2…,9 all consist of a single digit at position 0.
But once we reach 9, we have run out of new symbols (in decimal system) and hence we must increase the length.
Therefore we add another digit to the left, at position 1. Hence we get 10, 11,12…,19,20,21,…,99.
when again, we run out of all length-two combinations of symbols and must proceed to length-three
representations, starting from 100, so on.
Digit & Position 11
14/12/2023
In general, a number x may be represented with a representation of length n in the following manner (here
dp means the digit at position p).
dn-1 … d3 d2 d1 d0
So for the number 199834, in decimal, d0=4, d1=3, d2=8, d3=9, d4=9 and d5=1.
In general, We call the rightmost digit, d0, the least significant digit (LSB) and the leftmost digit dn-1, the
most significant digit (MSB).
BITS, BYTES and WORDS 12
14/12/2023
A digit in the binary system is more commonly called a bit.
Therefore, a bit is a single digit in the binary representation of a number and is either 0 or 1.
When a binary number is represented using 8 bits, the resulting representation, composed of d 0, d1, d2… d7,
is called a byte.
Similarly a binary representation composed of 16 bits is called a word, a binary representation composed of
32 bits is called a double word, and a binary representation composed of 64 bits is called a quadruple
word.
BITS, BYTES and WORDS 13
14/12/2023
A less common, 4-bit representation of numbers is called nibble.
The concept of a byte is fundamental in computer science because a byte is the smallest addressable unit
of memory in a modern computer; furthermore, data is quantified in terms of byte!
When you say that your hard-disk can store 20 Giga Bytes, you really mean that it can store 20x2 30 bytes
of data.
A byte is therefore a unit for measuring data in computers.
BITS, BYTES and WORDS 14
14/12/2023
The following quantifiers are important:
KILO
1K = 210 So how many bytes in 37KB?
MEGA
1M = 220 So how many Kilo bytes in 137MB?
GIGA
1G = 230 So how many Tera bytes in 562MB?
TERA
1T = 240 So how Giga bytes in 307TB?
Representation of a Number 15
14/12/2023
What if I know the digits and want to get the actual representation for the number from them?
Assuming I cannot simply paste them together, but actually have to do a computation.
I will do something like the following:
199834 = 4x1+ 3x10 + 8x100 + 9x1000 + 9x10000 + 1x100000
= 4x100+3x101+8x102+9x103+9x104+1x105
In general, for the decimal system: D= ; where p represents the positions in an n-digit number in the
decimal system.