You are on page 1of 18

Computer Arithmetic

Fundamentals of IT
|
Introduction

The default number system used is the decimal number system.


Decimal number system has base 10 as it uses 10 digits from 0 to 9.
In decimal number system, the successive positions to the left of the decimal
point represents units, tens, hundreds, thousands and so on.
Each position represents a specific power of the base (10).
This number can be converted to other bases depending on the version to be
used
The common number systems used are:
Binary (Base 2) - used in data storage in digital devices

Hexadecimal (Base 16) used in networking

Octal (base 8) 0-7 digits

5/10/17 Computer Arithmetic | 2


Decimal to Other Base System

Step 1 - Divide the decimal number to be converted by the value of


the new base.
Step 2 - Get the remainder from Step 1 as the rightmost digit (least
significant digit) of new base number.
Step 3 - Divide the quotient of the previous divide by the new base.
Step 4 - Record the remainder from Step 3 as the next digit (to the
left) of the new base number.

Repeat Steps 3 and 4, getting remainders from right to left, until the
quotient becomes zero in Step 3.

5/10/17 Computer Arithmetic | 3


Other Base System to Decimal

Step 1 - Determine the column (positional) value of each digit


(this depends on the position of the digit and the base of the
number system).
Step 2 - Multiply the obtained column values (in Step 1) by the
digits in the corresponding columns.
Step 3 - Sum the products calculated in Step 2. The total is the
equivalent value in decimal.

5/10/17 Computer Arithmetic | 4


Binary System

It uses two digits: 1 and 0; forming a base 2 number system


Each digit represents a state of the machine either on (1) or off (0)
The states show that electricity is present or not

Calculating using 0s and 1s is the binary system


Since computers perform calculations at a high speed, it displays
the decimal numbers easily understood by humans
The values are to the power of 2
The values to the far right starts with 1 then 2 then 4 then 8 then
16 then 32 and so on

5/10/17 Computer Arithmetic | 5


Example:

Binary 64 32 16 8 4 2 1
Conversion
Decimal 10 1 0 1 0
Decimal 7 1 1 1
Decimal 38 1 0 0 1 1 0
Decimal 44 1 0 1 0 0 0
Decimal 19 1 0 0 1 1

5/10/17 Computer Arithmetic | 6


From Binary (Base 2) to Decimal (Base
10)

Step Binary Number Decimal Number


((1 x 24) + (1 x 23) + (1 x 22) + (0 x 21) + (1 x
Step 1 111012
20))10
Step 2 111012 (16 + 8 + 4 + 0 + 1)10
Step 3 111012 2910

Calculating Decimal Equivalent:

Binary Number : 111012 = Decimal Number : 2910

5/10/17 Computer Arithmetic | 7


Hexadecimal Values

In addition to binary, another number base that is commonly used


in digital systems is base 16.
This number system is called hexadecimal, and each digit position
represents a power of 16
For any number base greater than ten, a problem occurs because
there are more than ten symbols needed to represent the
numerals for that number base.

5/10/17 Computer Arithmetic | 8


Hexadecimal Values

It is customary in these cases to use the ten decimal numerals


followed by the letters of the alphabet beginning with A to provide
the needed numerals.
Since the hexadecimal system is base 16, there are sixteen
numerals required. The following are the hexadecimal numerals:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

The following are some examples of hexadecimal numbers:


1016, 4716, 3FA16 and A03F16

5/10/17 Computer Arithmetic | 9


Hexadecimal Values - Example

Convert 140 to Hexadecimal and back


Example

Step Operation Result Reminder


1 140/16 8 12
2 8/16 0 8

Remainders are 8 and 12, but 12 represented as C


= 8C16

5/10/17 Computer Arithmetic | 10


Hexadecimal Values - Example

Convert = 8C16 back to decimal number


8x161 + 12x160
128 + 12 =140

5/10/17 Computer Arithmetic | 11


Exercise:

Convert the 189 to


Binary number
Hexadecimal number
Octal Number

5/10/17 Computer Arithmetic | 12


File Sizes

|
File system

Computers use folders to organize all the files and applications


that it contains
Folder icons are used to identify the different folders
In Windows, to access the files, use the view called Windows
Explorer
The files stored occupy some storage on the hard disk.
These files are stored in a unit called bits

5/10/17 Computer Arithmetic | 14


Bits and Bytes

A bit is either 1 or 0 as discussed earlier


A byte is a series of 8 bits processed as one unit of information
One letter or character takes up one byte
E.g. to store the letter R, it is represented in bits as 01010010
This forms one byte

Therefore each as letters form words which then forms sentences


and later paragraph, all that information is stored as a sequence
of bits grouped together in bytes

5/10/17 Computer Arithmetic | 15


Bytes

A document with 100 characters has 100 bytes which is 800 bits
File sizes are measured in groups of bytes as shown on the table

Size Name
1024 bytes = 1KB Kilobytes
1024 KB = 1MB Megabytes
1024 MB = 1GB Gigabytes
1024 GB = 1TB Terabytes
1024 TB = 1PB Petabytes

5/10/17 Computer Arithmetic | 16


Bytes

Therefore 1 GB file size has over 1,000,000,000,000 bytes


1,073,741,824 Bytes

What is the size of the 1MB?

5/10/17 Computer Arithmetic | 17


Ole Sangale Road, Madaraka Estate. PO Box 59857-00200, Nairobi, Kenya
Tel: (+254) (0)703 034000/200/300 Fax : +254 (0)20 607498
Email: info@strathmore.edu Website: www.strathmore.edu
|

You might also like