Download presentation
Presentation is loading. Please wait.
1
COMPUTING FUNDAMENTALS
Instructor: Romana Farhan Lecture # 02
2
How do computers represent data?
Number systems Binary number system Binary Arithmetic
3
the binary number system.
CPU consists of several million tiny electronic switches called transistors, that can be turned on or off. Computers know two distinct physical states Switch is on or off Since these switches only have two states, it makes sense for a computer to perform its computations with a number system that only has two digits. the binary number system.
4
Several different number systems exist Used by humans to count
A manner of counting Several different number systems exist Decimal number system Used by humans to count Contains ten distinct digits (0-9) Digits combine to make larger numbers
5
Used by computers to count
Binary number system Used by computers to count Two distinct digits, 0 and 1 corresponding to off or on state of switch. 0 and 1 combine to make numbers With only these two digits, a computer can perform all the arithmetic that we can with ten digits Goal of our study is to know Converting between binary and decimal, Performing binary arithmetic,
6
of any number by system is of digits in the the number
The base determined system. of any number by system is of digits in the the number For example Binary is a base 2 number system Decimal is a base 10 number system Octal ????? Hexadecimal ????? Distinguish between various number systems by putting a small subscript after the number to indicate the base.
7
understand the relationship between the digits of a given number,
For example ◦ ◦ we need to understand the relationship between the digits of a given number, the position of those digits, and the base of the number system. Let's take another look at our example number in the decimal system.
8
Generalized formula
9
by both the number and its position.
In decimal system value of number is defined by both the number and its position. Most significant bit/digit (MSB,MSD) The digit in a number which can affect the number Significantly It is the non zero digit of a number that is in the farthest left. The least significant bit/ digit (LSB, LSD) It is the digit in a number that has the least effect on that number.
10
Any changes in the LSD will have minimal effect on
the value. It is the non zero digit of a number that is farthest right. For example
11
To convert a decimal number to a binary number,
The decimal number is successively divided by 2. Follow the following steps Divide the decimal number by and note the remainder. Divide the quotient you got from the previous division once again by 2 and note the remainder. For each step, the division results in a remainder of 1 or 0.
12
Repeat step 2 until the quotient becomes 1.
The binary number is obtained by ordering the 1s and 0s obtained as remainders from bottom to top.
13
To convert the fractional part of the decimal
number to a binary number, the part is repeatedly multiplied by 2. Follow the following steps fractional The decimal fraction is multiplied by 2. the integer part, which is noted i.e. either 0 or 1 The fractional part of the previous product is multiplied by 2. Repeat the first step until the fraction repeats or terminates. The integer part which is obtained as a result forms a string of 0s and 1s which becomes the binary equivalent of the decimal fraction.
14
4. to obtain the binary number of the equivalent fractional, you need to consider the integer part from top to bottom.
15
167 0.875
16
number, perform the following steps.
To convert a binary number to a decimal number, perform the following steps. 1. Start with the rightmost digit and multiply that digit with 20. Here 2 represents the base of the number position, system and 0 represents the which is the rightmost digit digit whose position always starts with 0. Continue working from right to left, and multiply each digit with an increasing power of 2 Repeat step 2 until all the digits have been multiplied Add the result of each worked power of 2 for a final answer
18
decimal number in the same manner but
Fractional binary number can converted to decimal number in the same manner but The exponent are powers of two with negative values for digits on the right side of the binary point.
19
20
Binary Addition Binary Subtraction Binary Division
21
1 + 1 10 Basic four rules of addition
1. First, we apply Rule 4 to find the sum of the first two 1s. 1 + 1 10
22
answer to the second column. 10 + 1 11 to find the
Next, we take the previous result of 102 and add the final 1 to it. Notice that we use Rule 2 ( = 1) to find the answer to the first column, 3. We use Rule 3 (1 + 0 = 1) answer to the second column. 10 + 1 11 to find the
23
4. Now we have derived another rule for binary arithmetic
Now we have derived another rule for binary arithmetic. The sum of three 1s in binary is 112. 1 + 1 11
24
Add 1112, 1102, 11012, 1012, and 11102
25
how to add the binary numbers 110.012 and 1.0112
Addition is same as addition of binary integers, we need to take care of radix point while adding fractional part. Example how to add the binary numbers and 1. First, we align the two numbers so that the radix point of each number is located column in the same 2. Next, we fill in the blank spaces with 0s and add the two numbers together
26
The first column adds to 1.
1 The second column adds to 102, so we write a 0 below it and carry a 1 to the next 1 column 01
27
5. All of the remaining columns add to 1, so
we write 1 below them. 1 4. This gives us a final answer of
28
Add
29
2(10) 3 0 The basic rules for binary subtraction are Consider the problem of subtracting 12 from 102.
30
borrow a 1 from the next column.
To compute the first column, we need to borrow a 1 from the next column. Recall that two 1s generated a carry in addition. If we reverse this process, we can borrow a 1 from the second column. Once we borrow from the second column,we cross out the 1 and write 0 above it to show this column is now empty. 10 -1
31
Since we must borrow a 1 from the next
After cleaning up our work, we can see that the first column of our answer is identical to Rule 4. Since we must borrow a 1 from the next column, = 1. 10 - 1 1
32
Subtract − − 10010 − − When the binary fraction is subtracted from the binary fraction what is the correct result?
33
we multiply by is either
Binary multiplication uses the same technique as decimal multiplication. Binary multiplication is much easier because each digit one. Example we multiply by is either 1102 multiplicand 10 2multiplier zero or multiplying by 102 1. First, we note that 1102 is our multiplicand and 102 is our multiplier.
34
next digit of our multiplier which is 1.
2. We begin by multiplying 1102 by the rightmost digit of our multiplier which is 0. Any number times zero is zero, so we just write zeros below. 110 x 3. Now we multiply the multiplicand by the next digit of our multiplier which is 1. To perform this multiplication, we just need to copy the multiplicand and shift it one column to the left as we do in decimal multiplication.
35
we add our results together. The
110 x 110 we add our results together. The 4. Now product of our multiplication is x 110 1100
36
Ignore radix point, do not align them
Multiply numbers as whole numbers Starting from right of the product, separate as many places as there are in the two numbers together
37
10.01*1.01 1001 *101 --------- 0000 ------------- 101101
Now put the radix point, together binary fractions have four decimal places. starting from right separate the four decimal places
38
remember some important rules: the remainder is less than the divisor,
When doing binary division, we need to remember some important rules: When the remainder is greater than or equal to the divisor, write a 1 in the quotient and subtract. When the remainder is less than the divisor, write a 0 in the quotient and add another digit from the dividend.
39
mark a radix point in the dividend and append a zero.
If all the digits of the dividend have been considered and there is still a remainder, mark a radix point in the dividend and append a zero. Remember that some fractions do not have an exact representation in binary, so not all division problems will terminate.
40
1. 10|11 1 2. 10|11 10 3. 1. 10|11.0
41
1. 10|11.0 10 1.1
42
Divisor must be a whole number, if it is not, then we will multiply it so that it becomes one.
Multiply the dividend by the same power Example /1.01
43
Divide by 1102 /11.011
44
therefore data and numbers must be represented in a numeral format.
Digital computers respond to numbers, therefore data and numbers must be represented in a numeral format. The ON/OFF positions of electronic switches in a digital computers correspond to binary digits 0 or 1. Inter-conversion of numbers from one number system into other becomes important for computation and data processing in digital computers.
45
required to perform addition, division and multiplication.
In digital computers very few rules are required to perform addition, division and multiplication. subtraction,
46
Convert to decimal i ii. iii. iv
47
45 i. 69 ii. 1066 iii. 99 iv. 1939 v. 998
48
DIVIDE /1011 /11001 /10110
49
Multiply 1101 * 1101 1011* 1001 * * * 10110
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.