Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
49 views

The Number System CS

The document discusses number systems used in computers. It begins by explaining that computers can only process digital data represented as binary digits of 1s and 0s. It then discusses several number systems - binary, decimal, hexadecimal and octal. Binary uses two digits, 0 and 1. Decimal uses ten digits. Hexadecimal uses sixteen, with 0-9 and A-F representing values. Octal uses eight digits. The document provides tables to help convert between these number systems and methods for converting binary to decimal and vice versa. It also covers converting between hexadecimal and decimal.

Uploaded by

sunriseformone
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views

The Number System CS

The document discusses number systems used in computers. It begins by explaining that computers can only process digital data represented as binary digits of 1s and 0s. It then discusses several number systems - binary, decimal, hexadecimal and octal. Binary uses two digits, 0 and 1. Decimal uses ten digits. Hexadecimal uses sixteen, with 0-9 and A-F representing values. Octal uses eight digits. The document provides tables to help convert between these number systems and methods for converting binary to decimal and vice versa. It also covers converting between hexadecimal and decimal.

Uploaded by

sunriseformone
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

THE NU M B ER

SYS TEM

SAI N K O R I R
BY: MR H US
8
CT:071498098
CONTA
INTRODUCTION
Data is information coded in a format ready for processing.
Data is raw facts and figures and can be in the form of numbers, symbols or alphanumeric characters before processing. .
As humans we use analogue data, such as sound or light waves and impulses on our skin. Everything we see
and hear is a continuous transmission of analogue data to our senses.
Analogue data is great for us as we can process and understand it.
Computers cannot process analogue data, they are only capable of processing digital data. Any data that we want a computer to
process must first be converted into digital data, This is data represented in the values 1 and 0 that a computer can process.

Why Computers use Binary Numbers


Computers use the binary system because all of the processing takes place using components such as registers and memory.
These components are made up of transistors that can hold either an electric charge (1) or no electric charge (0). Logic gates are
used to make decisions about the processing of data, and they have two options – on (1) or off (0). Depending on the gate, data
bits are either kept the same, or switched from 0 to 1 or 1 to 0 for the operation being carried out .
This system is chosen because it only consists of 1s and 0s. Since computers contain millions and millions of tiny ‘switches’,
which must be in the ON or OFF position, they can be represented by the binary system. A switch in the ON position is
represented by 1; a switch in the OFF position is represented by 0
The Number System
Number systems are the techniques to represent numbers in
the computer system.
 A set of values used to represent different quantities is
known as Number System.
 The digital computer represents all kinds of data and
information in binary numbers ,it includes audio,
graphics, video, text and numbers.
 The number of digits used in a number system is called its
base or radix.
 The base is written after the number as subscript such as
(10101)2 ,(28)10
 Since computers contain millions and millions of tiny
‘switches’, which must be in the ON or OFF position, they
can be represented by the binary system.
 A switch in the ON position is represented by 1; a switch
in the OFF position is represented by 0.
Decimal number system
This is the most popular number system for user. Our everyday counting system is called denary (or decimal). Denary is a base-10
number system.
 Decimal number system has only ten(10) digits from 0 to 9.
 Every number (value) represents with 0,1,2,3,4,5,6, 7,8 and 9.
 The base of decimal number system is 10 because it has only 10 digits. So, it is also called the base 10 number system. It can be
written as (9801)10.
 Hexadecimal number system
 A Hexadecimal number system has 16 alphanumeric values from 0 to 9 and A to F.
 Every number (value) represents with 0,1,2,3,4,5,6, 7,8,9,A,B,C,D,E and F.
 The base of hexadecimal number system is 16 because it has 16 alphanumeric values.
 It is also called base16 number system.
 In this number system , the value for A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15. It can be written as (961)16, (DAF1)16,
etc.
Binary Number System

 Binary number system uses only two digits that are 0 and 1.

 All the computers and electronic devices are using it for their internal processing.

 The base of binary number system is 2, as it has only two digits.

 Binary numbers are also called the base 2 number system. It can be written as (101010)2.

Octal number system

 Octal number system has eight digits from 0 to 7.

 Since 8 digits are used, it is also called the base 8 number system.

 Every number (value) represents with 0,1,2,3,4,5,6 and 7 in this number system.

 The base of octal number system is 8 because it has only 8 digits. It can be written as (76401)8
CONVERSION TABLE
CONVERTING BINARY(BASE2) TO DENARY(BASE 10)

Computers use switches to store data and these switches can be in one
of two states: on or off.
Because of this we need to convert all data and instructions into binary,
which can represent on or off using the two digits 0 and 1 (Zero = Off)
(One=On)
■ Each stored binary digit is called a bit (binary digit). Example 0 and
1(1 is a bit) (0 is a bit) (10= 2bits)
■ A group of 8 bits is called a byte. example 11110000
■ Half a byte, 4 bits, is called a nibble . Example: 1111
128 64 32 16 8 4 2 1

MSB LSB

 The column values are ten times larger than the previous value as we move from right to left; that is, the ‘hundreds’ are ten
times bigger than ‘tens’ and ‘tens’ are ten times bigger than ‘ones’.
 In binary we just have the two symbols or values, 0 and 1. This means that in the binary number system each column
heading is twice as big as the previous one as we move from right to left The column headings in binary, from right to left,
are ‘ones’, ‘twos’, ‘fours’, ‘eights’ and so on. The leftmost digit in a binary number is called the most significant bit (MSB) and
the rightmost digit the least significant bit (LSB). In an 8-bit number, the MSB has decimal value of 128 and the LSB has
decimal value of 1.
HOW TO CONVERT DENARY NUMBERS INTO 8-BIT BINARY NUMBERS AND VICE VERSA

Method1

To convert denary numbers into binary, we use the binary column

heading values from the table.

 We decide whether each column heading value, starting at the left-

hand side, is smaller than or equal to our decimal number.

 We record 0 if it is not smaller and then compare it with the next

column value.

 If it is smaller than or equal to, we record 1 in the table,

 subtract the number and work out the remainder.

 We take that remainder and then check if it is smaller than the next

column value, and repeat the process above. We continue this process

until we are left with the right-hand ‘1’ column.


METHOD 2

This method involves successive division by 2.


Start with the denary number, 142, and divide it by 2.
Write the result of the division including the remainder (even if it is 0)
under the 142 (that is, 142 ÷ 2 = 71 remainder 0);
Then divide again by 2 (that is,71 ÷ 2 = 35 remainder 1) and keep dividing until the result is zero.
Finally write down all the remainders in reverse order:
If we want to show this as an 8-bit binary number (as shown in Method 1), we now simply add two 0’s from
the left-hand side to give the result: 0 0 1 1 1 0 1 1.
The hexadecimal system

The hexadecimal number system is very closely related to the


binary system.
Hexadecimal (sometimes referred to as simply ‘hex’) is a base
16 system and therefore needs to use 16 different ‘digits’ to
represent each value.

Because it is a system based on 16 different digits, the numbers


0 to 9 and the letters A to F are used to represent each
hexadecimal (hex) digit.
A in hex = 10 in denary, B = 11, C = 12, D = 13, E = 14 and F =
15.

Using the same method as for denary and binary, this gives the
headings 160, 161, 162, 163, and so on.
The typical headings for a hexadecimal number with five
digits would be: Example :2 1 F 3 A
65536(164) 4096(163) 256(162) 16(161) 1(160)
2 1 F 3 A
Converting from binary to hexadecimal and from hexadecimal to binary
Converting from binary to hexadecimal is a fairly easy process.

 Starting from the right and moving left, split the binary
number into groups of 4 bits.
 If the last group has less than 4 bits, then simply fill in with 0s
from the left.
 Take each group of 4 bits and convert it into the equivalent
hexadecimal digit using Table

Example 1
Convert 1 0 1 1 1 1 1 0 0 0 0 1 to Hexadecimal
First split this up into groups of 4 bits:
1011 1110 0001
Find the value of each grouped binary digits in decimal/denary
1011=11 1110=14 00001=1
Then, using Table <find the equivalent hexadecimal digits of
11, 14 and 1
Answer :11=B , E=14 and 1=1
1011,1110,0001=BE1
CONVERTING FROM HEXADECIMAL TO DENARY

 To convert hexadecimal numbers into denary involves the

value headings of each hexadecimal digit; that is, 4096, 256,

16 and 1.

 Take each of the hexadecimal digits and multiply it by the

heading values.

 Add all the resultant totals together to give the denary

number. Remember that the hex digits A → F need to be first

converted to the values 10 → 15 before carrying out the

multiplication.
Example 1
Convert the hexadecimal number, 4 5 A, into denary.
First of all we have to multiply each hex digit by its heading value:

256 16
1
4 5
A

(4 × 256 = 1024) (5 × 16 = 80) (10 × 1 = 10) (NOTE: A = 10)

Then we have to add the three totals together (1024 + 80 + 10) to give the
denary number:
1114
CONVERT DENARY TO HEXADECIMAL
To convert a denary value to hexadecimal, you :
first convert the number to binary using the method outlined previously.
Once you have this binary number, you can split it into two nibbles – 4 bits each.
This is because 4 bits can be used to represent values from 0–15
– the same values represented by a single hexadecimal digit.
For example, let us take the number 222, which converts to binary number
11011110
If you apply place values on a ‘per-nibble’ basis, you end up with the above. You
can then translate each nibble to a corresponding denary value, and finally convert
this to hexadecimal.
For example, nibble 1 is equal to denary 13 (hexadecimal D ),
and nibble 2 is equal to denary 14 (hexadecimal E ).
So our resulting hexadecimal number is DE
WHY IS HEXADECIMAL USED IN COMPUTER SCIENCE.

Programmers often use hexadecimal when writing and analyzing computer programs. They do this because it is easy for a human to read
hexadecimal, rather than binary.

For example, if a programmer looked at a set of data that is stored in registers, as binary it could look like this:
10011100101110111000111011100010111101011010
The programmer may be trying to find out if the data stored matches the correct data
which should be:
10011100101110111001011011100010111101011010
At a glance, it is difficult to see whether the two values match or if an error has occurred.
If that stored data is represented in hexadecimal it would be:
9CBB8EE2F5A
Comparing it to the correct value that should be:
9CBB96E2F5A
It is much easier to see that the data does not match, and the programmer can identify that an error has occurred.

The benefits of using hexadecimal rather than binary for a programmer are:
• Hexadecimal is a shorter way of representing binary, so it takes up less space on the computer screen or piece of paper.
• Hexadecimal is easier for a programmer to read, write and understand.
• Hexadecimal is easier to debug and locate errors in data.
EXAMPLES OF THE USE OF HEXADECIMAL NUMBERS IN DATA REPRESENTATION
Data in its most basic form has to be converted to binary so it can be processed by a computer. However hexadecimal
numbers are useful for a number of purposes, and are easier for humans to read than long strings of binary bits
Hexadecimal numbers can be found in computer science in the following examples:

MAC Address :Media Access Control


A number that identifies a network interface controller of a device on a network.
00:06:93:9d:21:1a

IPv6 Address: Internet Protocol version 6


A number that identifies locations of devices for the routing of data packets across the internet.
2003:da8:7a2e:323:21

Error codes
Often operating system errors are represented with hexadecimal numbers for reference.
0xC00D0803L

HTML Colour Codes


Websites use colour codes to represent one of the 16 million colours in the palette.
ERROR CODES
Error codes are often shown as hexadecimal values. These numbers refer to the memory location of the error and are
usually automatically generated by the computer. The programmer needs to know how to interpret the hexadecimal
error codes. Examples of error codes from a Windows system are shown below:
MEDIA ACCESS CONTROL (MAC) ADDRESSES
Media Access Control (MAC) address refers to a number which uniquely identifies a device on a network. The MAC address refers to the
network interface card (NIC)
which is part of the device. The MAC address is rarely changed so that a particular device can always be identified no matter where it is.
A MAC address is usually made up of 48 bits which are shown as 6 groups of two hexadecimal digits (although 64-bit addresses also
exist):
NN – NN – NN – DD – DD – DD
or
NN:NN:NN:DD:DD:DD
where the first half (NN – NN – NN) is the identity number of the manufacturer of the device and the second half (DD – DD – DD) is the
serial number of the device.

For example:
00 – 1C – B3 – 4F – 25 – FE is the MAC address of a device produced by the Apple Corporation (code: 001CB3) with a serial number of:
4F25FE. Very often lowercase hexadecimal letters are used in the MAC address: 00-1c-b3-4f-25-fe. Other
manufacturer identification numbers include:
00 – 14 – 22 which identifies devices made by Dell
00 – 40 – 96 which identifies devices made by Cisco
00 – a0 – c9 which identifies devices made by Intel, and so on
INTERNET PROTOCOL (IP) ADDRESSES
Each device connected to a network is given an address known as the Internet Protocol (IP) address. An IPv4 address is a 32-bit number
written in denary or hexadecimal form: e.g. 109.108.158.1 (or 77.76.9e.01 in hex). IPv4 has recently been improved upon by the adoption of
IPv6. An IPv6 address is a 128-bit number broken down into 16-bit chunks, represented by a hexadecimal number. For
example:a8fb:7a88:fff0:0fff:3d21:2085:66fb:f0fa >>IPv6 uses a colon (:) rather than a decimal point (.) as used in IPv4.

HYPERTEXT MARK-UP LANGUAGE (HTML) COLOUR CODES


HyperText Mark-up Language (HTML) is used when writing and developing web pages. HTML isn’t a programming language but is
simply a mark-up language.
A mark-up language is used in the processing, definition and presentation of text (for example, specifying the colour of the text). HTML
uses <tags> which are used to bracket a piece of text for example, <h1> and </h1> surround a top-level heading. Whatever is between the
two tags has been defined as heading level 1. Here is a short example of HTML code:
<h1 style="color:#FF0000;">This is a red heading</h1>
<h2 style="color:#00FF00;">This is a green heading</h2>
<h3 style="color:#0000FF;">This is a blue heading</h3>
HTML is often used to represent colours of text on the computer screen. All colours can be made up of different combinations of the three
primary colours (red, green and blue). The different intensity of each colour (red, green and blue)
is determined by its hexadecimal value. This means different hexadecimal values represent different colours.
The # symbol always precedes hexadecimal values in HTML code. The colour codes are always six hexadecimal digits representing the
red, green and blue components. There are a possible 256 values for red, 256 values for green and 256 values for blue giving a total of 256
× 256 × 256 (i.e. 16 777 216) possible colours.

You might also like