You are on page 1of 25

1.1.

1 Number
Representation
SYALLABUS

◍ show understanding of the basis of different number systems


and use the binary, denary and hexadecimal number system
◍ convert a number from one number system to another
◍ express a positive or negative integer in two’s complement
form
◍ show understanding of, and be able to represent, character
data in its internal binary form depending on the character
set used (Candidates will not be expected to memorise any
particular character codes but must be familiar with ASCII
and Unicode.)
◍ express a denary number in Binary Coded Decimal (BCD) and
vice versa
◍ describe practical applications where BCD is used
What is number system?
A number system is a way to represent numbers. We are
used to using the base-10 number system, which is also
called decimal or denary. Other common number systems
include base-16 (hexadecimal), base-8 (octal), and base-2
(binary).
Base of Number System

Base is the number of unique digits, including zero,


used to represent numbers in a positional numeral
system.
1.Base 2
In binary (base -2)number system 0,1 are the unique
digits used to represent every number. (0 and 1 makes
it base because there are two unique digits used in
the number system.)
2. Base 10
In decimal(Base - 10 ) there are 10 unique digits are
used (0,1,2,3,4,5,6,7,8,9)
3. Base 16
In hexadecimal (Base - 16) number system, there are
16 different digits used.
(0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F)
Binary, Decimal And Hexadecimal

Binary Number System Decimal Number System Hexadecimal Number System


0000 0 0
0001 1 1
0010 2 2
0011 3
0100 3 4
4 5
0101 5 6
0110 6 7
0111 7 8
8 9
1000 9 A
1001 10 B
11 C
1010 12 D
1011 13
1100 14 E
15 F
Conversion of Number System
For conversion of binary and hexadecimal number system to
denary, follow these steps:
1. Multiply each of it’s place value digit with the respective
base value.(i.e 2 for binary and 16 for hexadecimal)
2. Then put the power of each base value in order of
increasing value starting with zero from the right hand
side and them all.
Worked Examples

1) Binary to decimal:

Conversion of (01101110)2=(110)10
2) Hexadecimal to decimal:

Conversion of (A2F7)16 = (41719)10


Conversion of other decimal
number system to other number
system:
Follow these steps:
1. Divide the number by the base the respective base
value.
2. Note down the remainder of the division.
3. Carry on the division until the dividend itself
becomes the remainder.
4. Write the remainders in reverse order(bottom to
top).
Worked Examples

1) Decimal to Binary
Conversion of
(4215)10=(1000001110111)2
2) Decimal to Hexadecimal
Conversion of
(10767)10=(2A0F)16

To convert hexadecimal to binary or binary
to hexadecimal; what you can do is first
convert the corresponding number system to
decimal, then convert the corresponding
decimal value to the number system you want
to.
Complements

One’s complement Two’s Complement


The binary number obtained The binary number obtained
by subtracting each digit by adding 1 to one’s
of binary value from 1. complement of a binary
number.
Then to make two’s complement add 1 to one’s complement.

An easier way to convert an integer to two’s
complement is,leave the least significant 1 in the
binary value.Then interchange the digits.(i.e. If
it is 1 make it 0 and vice-versa.)
Standard ASCII Character SET

In the ASCII character set, each binary value between 0 and 127 is
given a specific character. Most computers extend the ASCII character
set to use the full range of 256 characters available in a byte. The
upper 128 characters handle special things like accented characters
from common foreign languages.You can see the 127 standard ASCII codes
below. Computers store text documents, both on disk and in memory,
using these codes. For example, if you use Notepad in Windows OS to
create a text file containing the words, "Four score and seven years
ago," Notepad would use 1 byte of memory per character (including 1
byte for each space character between the words - ASCII character 32).
When Notepad stores the sentence in a file on disk, the file will also
contain 1 byte per character and per space.
Standard ASCII Character SET

If you were to look at the file as a computer looks at it, you would find
that each byte contains not a letter but a number -- the number is the ASCII
code corresponding to the character (see below). So on disk, the numbers for
the file look like this:
Four and Seven (example)
F o u r <spc> a n d <spc> S e v e n
70 111 117 114 32 97 110 100 32 115 101 118 101 110

By looking in the ASCII


table, you can see a one-to-one correspondence between each character and
the ASCII code used. Note the use of 32 for a space -- 32 is the ASCII code
for a space. We could expand these decimal numbers out to binary numbers (so
32 = 00100000) if we wanted to be technically correct - that is how the
computer really deals with things.
Unicode

Unicode is a computing industry standard for the consistent encoding,


representation and handling of text expressed in most of the world's
writing systems or languages. Developed in conjunction with the Universal
Character Set standard and published in book form as The Unicode
Standard, the latest version of Unicode consists of a repertoire of more
than 107,000 characters covering 90 scripts for the correct display of
text containing both right-to-left scripts, such as Arabic and Hebrew,
and left-to-right scripts.The Unicode Consortium, the nonprofit
organization that coordinates Unicode development, has the ambitious goal
of eventually replacing existing character encoding schemes like ASCII
with Unicode as many of the existing schemes are limited in size and
scope and are incompatible with multilingual environments.
Binary Coded Decimal (BCD)

Binary-coded decimal (BCD) is a class of binary encodings of decimal


numbers where each decimal digit is represented by a fixed number of
bits, usually four or eight. Special bit patterns are sometimes used
for a sign or for other indications (e.g., error or overflow).BCD code
uses four bits (a nibble) to represent a denary digit. A four-bit code
can represent 16 different values so there is scope for a variety of
scheme. BCD's main virtue is its more accurate representation and
rounding of decimal quantities as well as an ease of conversion into
human-readable representations, in comparison to binary positional
systems. BCD's principal drawbacks are a small increase in the
complexity of the circuits needed to implement basic arithmetics and a
slightly less dense storage.
E.g. 398602 in BCD
Answer:
3 = 0011 9 = 1001
8 = 1000 6 = 0110
0 = 0000 2 = 0010
So 398602 = 001110011000011000000010 (in
BCD)
Note: All the zeros are essential
otherwise you can’t read it back.
Application of BCD

▪The BIOS in many personal computers stores the date and time in BCD
because the MC 6818 real-time clock chip used in the original IBM PC AT
motherboard provided the time encoded in BCD. This form is easily
converted into ASCII for display.
▪The Atari 8-bit family of computers used BCD to implement floating-point
algorithms. The MOS 6502 processor used has a BCD mode that affects the
addition and subtraction instructions.
▪Early models of the PlayStation 3 store the date and time in BCD. This
led to a worldwide outage of the console on 1 March 2010. The last two
digits of the year stored as BCD were misinterpreted as 16 causing an
error in the unit's date, rendering most functions inoper
👍
Thanks!
Any questions?

You might also like