Module 2: Computer Arithmetic
|
|
- Brooke Clark
- 6 years ago
- Views:
Transcription
1 Module 2: Computer Arithmetic 1 B O O K : C O M P U T E R O R G A N I Z A T I O N A N D D E S I G N, 3 E D, D A V I D L. P A T T E R S O N A N D J O H N L. H A N N E S S Y, M O R G A N K A U F M A N N P U B L I S H E R S
2 Complement Addition Subtraction Multiplication Division Arithmetic Operations 2
3 Introduction Numbers are represented by binary digits (bits): How are negative numbers represented? What is the largest number that can be represented in a computer world? What happens if an operation creates a number bigger than can be represented? What about fractions and real numbers? 3 A mystery: How does hardware really multiply or divide numbers?
4 Binary Numbers 4
5 Binary Numbers Binary Number System System Digits: 0 and 1 Bit (short for binary digit): A single binary digit LSB (least significant bit): The rightmost bit MSB (most significant bit): The leftmost bit 5 Upper Byte (or nybble): The right-hand byte (or nybble) of a pair Lower Byte (or nybble): The left-hand byte (or nybble) of a pair
6 Binary Equivalents Binary Numbers 1 Nybble (or nibble) = 4 bits 1 Byte = 2 nybbles = 8 bits 1 Kilobyte (KB) = 1024 bytes 1 Megabyte (MB) = 1024 kilobytes = 1,048,576 bytes 1 Gigabyte (GB) = 1024 megabytes = 1,073,741,824 bytes 6
7 Binary Numbers 7 Base 2
8 Binary Addition Rules of Binary Addition = = = = 0, and carry 1 to the next more significant bit Example: Carry
9 Binary Subtraction Rules of Binary Subtraction 0-0 = = 1, and borrow 1 from the next more significant bit 1-0 = = 0 Example: borrowed
10 Binary Multiplication Rules of Binary Multiplication 0 x 0 = 0 0 x 1 = 0 1 x 0 = 0 1 x 1 = 1, and no carry or borrow bits Example: 23 x 3 10 Another Method: Binary multiplication is the same as repeated binary addition
11 Binary division 11
12 2 s Complement Two's complement representation allows the use of binary arithmetic operations on signed integers, yielding the correct 2's complement results. Positive Numbers: Positive 2's complement numbers are represented as the simple binary. Negative Numbers: Negative 2's complement numbers are represented as the binary number that when added to a positive number of the same magnitude, will equals zero. 12
13 13 To represent positive and negative numbers look at the MSB (or the sign bit) MSB = 0 means positive MSB = 1 means negative
14 Step 1: Calculation of 2's Complement 14 invert the binary equivalent of the number by changing all of the ones to zeroes and all of the zeroes to ones (also called 1's complement) Step 2: Then add one. Example: = = Step1 : Step2 :
15 2's Complement Addition Two's complement addition follows the same rules as binary addition. Example: 5 + (-3) 5 = = Ignore (2)
16 2's Complement Addition Two's complement addition follows the same rules as binary addition. Example: 3 + (-5) 3 = = (-2)
17 2's Complement Subtraction 17 Two's complement subtraction is the binary addition of the minuhend to the 2's complement of the subtrahend (adding a negative number is the same as subtracting a positive one). Example : (-12) minuhend subtrahend
18 2's Complement Subtraction 18 Example : (-12) 7 = = (-5) CHECK! -5 = Step1 : Step2 : (5)
19 2's Complement Multiplication Two's complement multiplication follows the same rules as binary multiplication. Example : (-4) 4 = (-16) Ignore 4 = = x (-16) 19 CHECK! -16 = Step1 : Step2 : (16)
20 2's Complement Division Two's complement division is repeated 2's complement subtraction. 20 The 2's complement of the divisor is calculated, then added to the dividend. For the next subtraction cycle, the quotient replaces the dividend. This repeats until the quotient is too small for subtraction or is zero, then it becomes the remainder. The final answer is the total of subtraction cycles plus the dividend remainder Example : 6/ 3 = 2 divisor quotient
21 2's Complement Division Example: 6/3 Example: 7/3 6 + (-3) = (-3) = 0 6 / 3 = 2 Cycle 1 Cycle 2 The number of cycle (-3) = (-3) = 1 Cycle 1 Cycle 2 7 / 3 = 2 remainder 1
22 2's Complement Division 22 Example: 42/ (-6) = (-6) = (-6) = (-6) = 18 Cycle 1 Cycle 2 Cycle 3 Cycle (-6) = (-6) = (-6) = 0 42 / 6 = 7 Cycle 5 Cycle 6 Cycle 7
23 Sign Extension Extending a number representation to a larger number of bits. Example: 2 in 8 bit binary to 16 bit binary In signed numbers, it is important to extend the sign bit to preserve the number (+ve or ve) Example: -2 in 8 bit binary to 16 bit binary Sign bit Sign bit extended Sign bit
24 Detecting Overflow in Two Complement Numbers Overflow occurs when adding two positive numbers and the sum is negative, or vice versa A carry out occurred into the sign bit Overflow conditions for addition and subtraction 24
25 Overflow Rule for addition If 2 Two's Complement numbers are added, and they both have the same sign (both positive -7 or both = 1001 negative), -6 then = overflow 1010 occurs if and only if the result has the opposite sign. Adding two positive numbers must give a positive result Adding two negative numbers must give a negative result Overflow occurs Overflow never occurs when adding operands with different signs. Overflow occurs if 25 (+A) + (+B) = C ( A) + ( B) = +C (3) Example: Using 4-bit Two's Complement numbers ( 8 x +7) (-7) + (-6) = (-13) but Overflow (largest ve number is 8) The sign bit has changed to +ve
26 Overflow Rule for Subtraction If 2 Two's Complement numbers are subtracted, and their signs are different, then overflow occurs if and only if the result has the same sign as the subtrahend. subtrahend Overflow occurs if (+A) ( B) = C ( A) (+B) = +C result Example: Using 4-bit Two's Complement numbers ( 8 x +7) Subtract 6 from +7 (i.e. 7 (-6)) 26 result has the same sign as the subtrahend overflow happens
27 Overflow Rule for Subtraction If 2 Two's Complement numbers are subtracted, and their signs are different, then overflow occurs if and only if the result has the same sign as the subtrahend. Overflow occurs if (+A) ( B) = C ( A) (+B) = +C 7 = 0111 Example: Using 4-bit Two's Complement numbers ( 8 x +7) Subtract 6 from +7 (i.e. 7 (-6)) 27 Overflow occurs 6 = (-3) Result has same sign as subtrahend
28 Addition A little summary Add the values, discarding any carry-out bit Subtraction Negate the subtrahend and add, discarding any carry-out bit Overflow (-96) Not 160 because the sign bit is 1. (largest +ve number in 8 bits is 127) Occurs when adding two positive numbers produces a negative result, or when adding two negative numbers produces a positive result. Adding operands of unlike signs never produces an overflow Notice that discarding the carry out of the most significant bit during Two's Complement addition is a normal occurrence, and does not by itself indicate overflow As an example of overflow, consider adding ( = 160) 10, which produces a result of in 8-bit two's complement.
29 Binary Multiplication 29
30 Two's Complement Multiplication There are a couple of ways of doing two's complement multiplication by hand. Remember that the result can require 2 times as many bits as the original operands. 30
31 Sign Extend Method" for Two's Complement Multiplication In 2's complement, sign extend both integers to twice as many bits. Then take the correct number of result bits from the least significant portion of the result A 4-bit example: 2 x (-3) 2= = = Sign extend to 8 bit x Correct answer underlined
32 " Partial Product Sign Extend Method " for Two's Complement Multiplication 32 Another way is to sign extend the partial products 1100 to the correct number of bits. x 0011 Sometimes we do have to make some adjustments Example 1: (-4) x 3-4 = = 0011 Sign extend to the correct number of bits (-12)
33 " Partial Product Sign Extend Method " for Two's Complement Multiplication Sometimes we do have to make some adjustments. If (+ve) x (+ve) then OK Normal stuff If (+ve) x (-ve) then get additive inverse of both And then Sign extend partial products Example: 3 x (-4) 33 If (-ve) x (+ve) then Sign extend partial products 3=0011 ;-4 = =1101; 4 =0100 If (-ve) x 1101 (-ve) then get x additive 0100 inverse of both (-12) Like the slide before (-4)x3
34 " Partial Product Sign Extend Method " for Two's Complement Multiplication Sometimes we do have to make some adjustments. 34 If (+ve) x (+ve) then OK -3= = If (+ve) x (-ve) then x 0011 get additive inverse of both 0011 And then 0011 Sign extend partial products (9) Example: 3 x (-4) If (-ve) x (+ve) then Sign extend partial products If (-ve) x (-ve) then get additive inverse of both Example: (-3)x(-3)
35 Signed Multiplication Another way to deal with signed numbers. 35 First convert the multiplier and multiplicand to positive numbers and then remember the original signs Leave the sign out of the calculation To negate the product only if the original signs disagree
36 1st Version of Multiplication Hardware Actual implementations are far more complex, and use algorithms that generate more than one bit of product each clock cycle. 32-bit multiplicand starts at right half of multiplicand register Algorithm Flows of 1st Version Multiplication Multiplier0 = 1 Start 1. Test Multiplier0 Multiplier0 = 0 Multiplicand 64 bits Shift left 1a. Add multiplicand to product and place the result in Product register 64-bit ALU Multiplier Shift right 32 bits 2. Shift the Multiplicand register left 1 bit Product 64 bits Write Control test 3. Shift the Multiplier register right 1 bit Product register is initialized at 0 Multiplicand register, product register, ALU are 64-bit wide; multiplier register is 32-bit wide 32nd repetition? No: < 32 repetitions Yes: 32 repetitions Done
37 Example of Multiplication 4 bits Example : 2 x 3 =? Multiplicand (MC) Multiplier (MP) Product (P) 2 x x 0011 Steps: 1a test multiplier (0 or 1) If 1 then P = P + MC If 0 then no operation 2 shift MC left 3 shift MP right All bits done? If still <max bit, repeat If = max bit, stop 37 Multiplier0 = 1 1a. Add multiplicand to product and place the result in Product register Start Test Multiplier0 2. Shift the Multiplicand register left 1 bit 3. Shift the Multiplier register right 1 bit 32nd repetition? Multiplier0 = 0 P = P + MC = = MC = MP = No: < 32 repetitions Max bit? NO repeat Yes: 32 repetitions Done
38 Iteration Step Multiplier (MP) Multiplicand (MC) Product (P) 0 Initial value a:1 P = P + MC 2: Shift MC left 3: Shift MP right 1a:1 P = P + MC 2: Shift MC left 3: Shift MP right 1a:0 no operation 2: Shift MC left 3: Shift MP right 1a:0 no operation 2: Shift MC left 3: Shift MP right Try with 5 x
39 Iteration Step Multiplier (MP) Multiplicand (MC) Product (P) 0 Initial value Example : 5 x 4 1a:0 no operation 2: Shift MC left : Shift MP right a:0 no operation 2: Shift MC left : Shift MP right a:1 P = P + MC : Shift MC left : Shift MP right a:0 no operation 2: Shift MC left : Shift MP right 0000 Try with 2 x (-3) 20 40
40 Iteration Step Multiplier (MP) Multiplicand (MC) Product (P) 0 Initial value a:1 P = P + MC Example : 2 x (-3) get additive inverse of both 2: Shift MC left : Shift MP right a:1 P = P + MC : Shift MC left : Shift MP right a:0 no operation 2: Shift MC left : Shift MP right a:0 no operation 2: Shift MC left : Shift MP right
41 Binary Division 42
42 1st Version of Division Hardware Divisor starts at left half of divisor register 32-bit divisor starts at left half of divisor register Divisor 64 bits Shift right Quotient register is initialized to be 0 43 Flows of 1st Version Division Start 1. Subtract the Divisor register from the Remainder register and place the result in the Remainder register Remainder > 0 Test Remainder Remainder < 0 64-bit ALU Remainder Write Control test Quotient Shift left 32 bits 2a. Shift the Quotient register to the left, setting the new rightmost bit to 1 2b. Restore the original value by adding the Divisor register to the Remainder register and place the sum in the Remainder register. Also shift the Quotient register to the left, setting the new least significant bit to 0 64 bits Remainder register is initialized with the dividend at right 3. Shift the Divisor register right 1 bit Divisor register, remainder register, ALU are 64-bit wide; quotient register is 32-bit wide 33rd repetition? No: < 33 repetitions Yes: 33 repetitions Done Algorithm
43 Example of Division 4 bits 44 Start 1. R = R - D Example : 7 / 2 =? Dividend (DD) Divisor (D) 7 / / 0010 Steps: 1 Remainder (R) = R D 2 test new R (>=0 or <0) 2a - If >=0 then R = no operation; Q = Shift left (add 1 at LSB) 2b - If <0 then R = D + R Q = Shift left (add 0 at LSB) 3 shift D right All bits done? If still <(max bit + 1), repeat If = (max bit+1), stop Quotient (Q) If R = R D = +ve 2a. Shift the Quotient register to the left, setting the new rightmost bit to 1 1. Subtract the Divisor register from the Remainder register and place the result in the Remainder register Remainder > 0 2a. R >= 0; R = no operation Q = Shift left (add 1 at LSB) 4. If not yet 33 repeat to Step 1 (new iteration) Test Remainder 3. D = Shift right 1 3. Shift the Divisor register right 1 bit 33rd repetition? If R = R D = -ve Remainder < 0 2b. R < 0; R = D + R Q = Shift left (add 0 at LSB) 2b. Restore the original value by adding the Divisor register to the Remainder register and place the sum in the Remainder register. Also shift the Quotient register to the left, setting the new least significant bit to 0 No: < 33 repetitions Yes: 33 repetitions Done
44 Iteration Step Quotient (Q) Divisor Divisor Remainder ( (D) starts at left half Example: 7/2 R) of divisor register 0 Initial value R = R - D R = R D = R + (-D) Negate b. R < 0; R = D + R Q = Shift left (add 0 at LSB) D = Shift right R = R - D b. R < 0; R = D + R Q = Shift left (add 0 at LSB) D = Shift right R = R - D b. R < 0; R = D + R Q = Shift left (add 0 at LSB) D = Shift right
45 Iteration Step Quotient (Q) Divisor (D) Remainder(R) R = R - D b. R < 0; R = D + R Q = Shift left (add 0 at LSB) D = Shift right R = R - D b. R >=0; R = no operation Q = Shift left (add 1 at LSB) D = Shift right R = R - D b. R >=0; R = no operation Q = Shift left (add 1 at LSB) D = Shift right Example: 7/2 = 3 remainder 1 47
46 Example: 6/3 Iteration Step Quotient (Q) Divisor (D) Remainder(R) 0 Initial value R = R - D b. R < 0; R = D + R Q = Shift left (add 0 at LSB) D = Shift right R = R - D b. R < 0; R = D + R Q = Shift left (add 0 at LSB) D = Shift right R = R - D b. R < 0; R = D + R Q = Shift left (add 0 at LSB) D = Shift right
47 Iteration Step Quotient (Q) Divisor (D) Remainder (R) R = R - D b. R < 0; R = D + R Q = Shift left (add 0 at LSB) D = Shift right R = R - D b. R >=0; R = no operation Q = Shift left (add 1 at LSB) D = Shift right R = R - D b. R < 0; R = D + R Q = Shift left (add 0 at LSB) D = Shift right Example: 6/3 = 2 49
48 Signed Division Signed divide: make both divisor and dividend positive and perform division negate the quotient if divisor and dividend were of opposite signs make the sign of the remainder match that of the dividend this ensures always dividend = (quotient divisor) + remainder quotient (x/y) = quotient ( x/y) e.g. 7 = = 3 2 1) 50
49 Module 2 Part 2 51 FLOATING POINT
50 Floating Point Representation Floating point aids in the representation of very big or very small fixed point numbers x Fixed point Floating point 976,000,000,000, x x 10-14
51 Floating Point Numbers 53 Significand/Fraction Exponent x Base/radix Significand and Exponent can be +ve or ve. Decimal numbers use the radix 10, binary use 2
52 Normalized and Unnormalized In generalized normalization (like in mathematics), a floating point number number is said to after be normalized the if the number after the radix radix point point is a non-zero is a value. Un-normalized floating number is when the number after the radix point is 0. Example: x x x x 10 5 unnormalized non-zero value. unnormalized normalized normalized
53 Normalization Process Normalization is the process of deleting the zeroes until a Move non-zero radix point value to is detected. the right (in this case 2 Example points) : 56 Move radix point to the left (in this x case points) x x x x x 10 6 A rule of thumb: moving the radix point to the right subtract exponent moving the radix point to the left add exponent
54 Floating Point Format for Binary Numbers In the beginning, the general form of floating point is : +/- 0.Mantissa x r +/- exponent In binary: +/- (sign) Exponent +/- (sign) Mantissa 1 word Mantissa = Significand The 2 sign bits are not good for design as it incurs extra costs
55 Biased Exponent A new value to represent the exponent without the sign bit is introduced 59 This will eliminate the sign for the exponent value that is the exponent will be positive. (indicative) +/- (sign) Biased Exponent Mantissa 1 word +/- (1 bit) E t (n bit) Mantissa, m
56 Biased Exponent 60 +/- (1 bit) E t (n bit) Mantissa, m Biased value, b = 2 n-1 Normalized exponent, e = E t - b Biased exponent, E t = e + b Where, E t = biased exponent n = bits of exponent format (i.e. the word format) This is used unless the IEEE standard is mentioned then is a different calculation
57 Conversion to Floating Point Number Change to binary (if given decimal number) Normalized the number Change the number to biased exponent Form the word (3 fields) 61
58 Example 3 62 Transform to floating point word using the following format (radix 2) Sign Biased exponent Significand 1 bit 4 bit 12 bit Step 1 : Change to binary This is the given word format x 2 = x 2 = x 2 = = = = x
59 Example 3 Step 2 : Normalized the number x Normalized exponent, e Step 3: Change the number to biased exponent 1 bit 4 bit 12 bit Biased value, b = 2 n-1 = = 8d = 1000b Biased exponent, E t = e + b = = x x
60 Example x Step 4 : Form the word (3 fields) 1 bit 4 bit 12 bit Padding Rule of thumb: -the biased exponent is always padded to the left - the significand (or mantissa) is always padded to the right
61 Floating-Point Representation Value in general form: (-1) S x F x 2 e In an 8-bit representation, we can represent: From 2 x to 2 x This is called single-precision = 1 word If anything goes above or under, then overflow and underflow happens respectively. One way to reduce this is to offer another format with a larger exponent use double precision (2 words) From 2 x to 2 x
62 IEEE 754 Floating-Point Standard 69 This 1 is made implicit to pack more bits into the significand
63 Normalized Scientific Notation In IEEE standard normalization (used in computers), a floating point number is said to be normalized if there is only a single non-zero before the radix point. Example: 70 there is only a single non-zero before the radix point normalized x B normalized x 2 011
64 Challenge of Negative Exponents Placing the exponent before the significand simplifies sorting sign of floating-point Exponent numbers using Significand integer comparison 1 bit instructions. 8 bit 23 bit However, using 2 s complement in the exponent field makes a negative exponent look like a big number. 72
65 Biased Notation 73 Bias In single precision is 127 In double precision 1023 Biased notation (-1)sign x (1 + Fraction) x 2 (exponent-bias)
66 74 To convert a decimal number to single (or double) precision floating point: Step 1: Normalize Step 2: Determine Sign Bit Step 3: Determine exponent IEEE 754 Conversion Step 4: Determine Significand
67 IEEE 754 Conversion : Example 1 Convert 10.4 d to single precision floating point. Step 1: Normalize x 2 = x 2 = x 2 = x 2 = x 2 = x 2 = For continuous results, take the 1 st pattern before it repeats itself 0.4 = = x x 2 3
68 IEEE 754 Conversion : Example 1 76 Step 2: Determine Sign Bit (S) Because (10.4) is positive, S = 0 3 is from 2 3 Step 3: Determine exponent Because its single precision bias = 127 Exponent = 3 + bias = = 130 d = b Step4: Determine Significand Drop the leading 1 of the significand x Then expand (padding) to 23 bits sign Exponent Significand
69 IEEE 754 Conversion : Example 2 Convert d to single precision floating point. Step 1: Normalize x 2 = x 2 = x 2 = = x x 2-1
70 IEEE 754 Conversion : Example 2 78 Step 2: Determine Sign Bit (S) Because (-0.75) is negative, S = 1 Step 3: Determine exponent Because its single precision bias = 127 Exponent = -1 + bias = = 126 d = b Step4: Determine Significand Drop the leading 1 of the significand -1.1 x Then expand (padding) to 23 bits sign Exponent Significand
71 IEEE 754 Conversion : Example 3 Convert d to double precision floating point. Step 1: Normalize x 2 = x 2 = x 2 = = x x 2-1
72 IEEE 754 Conversion : Example 3 80 Step 2: Determine Sign Bit (S) Because (-0.75) is negative, S = 1 Step 3: Determine exponent Because its double precision bias = 1023 Exponent = -1 + bias = = 1022 d = b Step4: Determine Significand Drop the leading 1 of the significand -1.1 x Then expand (padding) to 52 bits sign Exponent (11) Significand (52)
73 Converting Binary to Decimal Floating-Point What decimal number is represented by this single precision float? Extract the values: Sign = 1 81 Sign (1 bit) Exponent(8 bit) Significand(23 bit) Exponent = b = 129 d Significand Remember: Biased notation (-1)sign x (1 + Fraction) x 2 (exponent-bias) The Fraction = (0 x 2-1 ) + (1 x 2-2 ) + (0 x 2-3 ) = ¼ = ( ) The number = - (1.25 x 2 (exponent-bias) ) = - (1.25 x 2 2 ) = - (1.25 x 4) = -5.0
74 Module 2 Part 3 82 FLOATING-POINT OPERATIONS
75 Floating-Point Addition Flows 83
76 Decimal Floating-Point Addition 84 Assume 4 decimal digits for significand and 2 decimal digits for exponent Step 1: Align the decimal point of the number that has the smaller exponent Step 2: add the significand Step 3: Normalize the sum check for overflow/underflow of the exponent after normalisation Step 4: Round the significand If the significand does not fit in the space reserved for it, it has to be rounded off Step 5: Normalize it (if need be)
77 Decimal Floating-Point Addition Example: d x d x 10-1 Step 1: Align the decimal point of the number that has the smaller exponent Make d x 10-1 to x = 1 x = 2 move 2 to left d x 10 1 Step 2: add the significand x d x x
78 Decimal Floating-Point Addition Example: d x d x 10-1 Step 3: Normalize the sum x x Step 4: Round the significand (to 4 decimal digits for significand) x x 10 2 Step 5: Normalize it (if need be) No need as its normalized
79 Decimal Floating-Point Addition Example: 0.5 d + ( d ) Adjusts the numbers Step 1: Align the decimal point of the number that has the smaller exponent b x b x b x b x 2-2 Make 1.11 b x 2-2 to x = -1 x = 1 move 1 to left b x 2-1
80 Decimal Floating-Point Addition Example: 0.5 d + ( d ) Step 2: add the significand Step 3: Normalize the sum Step 4: Round the significand (to 4 decimal digits for significand) Fits in the 4 decimal digits Step 5: Normalize it (if need be) No need as its normalized x x
81 Floating-Point Multiplication Flows 90
82 Floating-Point Multiplication 91 Assume 4 decimal digits for significand and 2 decimal digits for exponent Step 1: Add the exponent of the 2 numbers Step 2: Multiply the significands Step 3: Normalize the product check for overflow/underflow of the exponent after normalisation Step 4: Round the significand If the significand does not fit in the space reserved for it, it has to be rounded off Step 5: Normalize it (if need be) Step 6: Set the sign of the product
83 Floating-Point Multiplication 92 Example: (1.110 d x ) x (9.200 d x 10-5 ) Assume 4 decimal digits for significand and 2 decimal digits for exponent Step 1: Add the exponent of the 2 numbers 10 + (-5) = 5 If biased is considered 10 + (-5) = 132 Step 2: Multiply the significands x x 10 5
84 Floating-Point Multiplication Example: (1.110 d x ) x (9.200 d x 10-5 ) Step 3: Normalize the product x x 10 6 Step 4: Round the significand (4 decimal digits for significand) x 10 6 Still normalized Step 5: Normalize it (if need be) Step 6: Set the sign of the product x 10 6
85 Floating-Point Multiplication Example: (1.000 b x 2-1 ) x ( b x 2-2 ) 95 Assume 4 decimal digits for significand and 2 decimal digits for exponent Step 1: Add the exponent of the 2 numbers -1 + (-2) = -3 If biased is considered -1 + (-2) = 124 Step 2: Multiply the significands x x 10-3
86 Floating-Point Multiplication Example: (1.000 b x 2-1 ) x ( b x 2-2 Step 3: Normalize the product x 10-3 already normalized 96 Step 4: Round the significand (4 decimal digits for significand) x 10-3 Still normalized Step 5: Normalize it (if need be) Step 6: Set the sign of the product b x /32 d
87 Floating-Point ALU Sign Exponent Significand Sign Exponent Significand 97 Small ALU Compare exponents Exponent difference Control Shift right Shift smaller number right Big ALU Add 0 1 Increment or decrement 0 1 Shift left or right Normalize Rounding hardware Round Sign Exponent Significand
88 Accurate Arithmetic If a calculation exceeds the limits of the floating point scheme then CPU will flag this error. 98 If number is too tiny to be represented
89 Accurate Arithmetic : Truncation & Rounding 99 Some number have infinite decimal points (the irrational numbers) 1/3 d = Truncation is done to fit the decimal points into manageable units. Truncation is where decimal values beyond the truncation point are simply discarded and it can cause error in floating point calculations. Rounding :If you have a number such as then if you have to round this to 3 significant digits, the number becomes 3.46 A small error called the rounding error has occurred ***Note : the CPU will not flag any error when truncation and rounding occurs, as it is acting within its limits. programmers must assess if this will lead to significant errors
Divide: Paper & Pencil
Divide: Paper & Pencil 1001 Quotient Divisor 1000 1001010 Dividend -1000 10 101 1010 1000 10 Remainder See how big a number can be subtracted, creating quotient bit on each step Binary => 1 * divisor or
More informationNumber Systems and Computer Arithmetic
Number Systems and Computer Arithmetic Counting to four billion two fingers at a time What do all those bits mean now? bits (011011011100010...01) instruction R-format I-format... integer data number text
More informationCO212 Lecture 10: Arithmetic & Logical Unit
CO212 Lecture 10: Arithmetic & Logical Unit Shobhanjana Kalita, Dept. of CSE, Tezpur University Slides courtesy: Computer Architecture and Organization, 9 th Ed, W. Stallings Integer Representation For
More informationChapter 3: Arithmetic for Computers
Chapter 3: Arithmetic for Computers Objectives Signed and Unsigned Numbers Addition and Subtraction Multiplication and Division Floating Point Computer Architecture CS 35101-002 2 The Binary Numbering
More informationFloating Point Arithmetic
Floating Point Arithmetic CS 365 Floating-Point What can be represented in N bits? Unsigned 0 to 2 N 2s Complement -2 N-1 to 2 N-1-1 But, what about? very large numbers? 9,349,398,989,787,762,244,859,087,678
More informationFloating Point. The World is Not Just Integers. Programming languages support numbers with fraction
1 Floating Point The World is Not Just Integers Programming languages support numbers with fraction Called floating-point numbers Examples: 3.14159265 (π) 2.71828 (e) 0.000000001 or 1.0 10 9 (seconds in
More informationOrganisasi Sistem Komputer
LOGO Organisasi Sistem Komputer OSK 8 Aritmatika Komputer 1 1 PT. Elektronika FT UNY Does the calculations Arithmetic & Logic Unit Everything else in the computer is there to service this unit Handles
More informationChapter 5 : Computer Arithmetic
Chapter 5 Computer Arithmetic Integer Representation: (Fixedpoint representation): An eight bit word can be represented the numbers from zero to 255 including = 1 = 1 11111111 = 255 In general if an nbit
More informationMIPS Integer ALU Requirements
MIPS Integer ALU Requirements Add, AddU, Sub, SubU, AddI, AddIU: 2 s complement adder/sub with overflow detection. And, Or, Andi, Ori, Xor, Xori, Nor: Logical AND, logical OR, XOR, nor. SLTI, SLTIU (set
More informationChapter 10 - Computer Arithmetic
Chapter 10 - Computer Arithmetic Luis Tarrataca luis.tarrataca@gmail.com CEFET-RJ L. Tarrataca Chapter 10 - Computer Arithmetic 1 / 126 1 Motivation 2 Arithmetic and Logic Unit 3 Integer representation
More informationCOMP2611: Computer Organization. Data Representation
COMP2611: Computer Organization Comp2611 Fall 2015 2 1. Binary numbers and 2 s Complement Numbers 3 Bits: are the basis for binary number representation in digital computers What you will learn here: How
More informationCOMPUTER ARITHMETIC (Part 1)
Eastern Mediterranean University School of Computing and Technology ITEC255 Computer Organization & Architecture COMPUTER ARITHMETIC (Part 1) Introduction The two principal concerns for computer arithmetic
More informationUNIT-III COMPUTER ARTHIMETIC
UNIT-III COMPUTER ARTHIMETIC INTRODUCTION Arithmetic Instructions in digital computers manipulate data to produce results necessary for the of activity solution of computational problems. These instructions
More informationEE260: Logic Design, Spring n Integer multiplication. n Booth s algorithm. n Integer division. n Restoring, non-restoring
EE 260: Introduction to Digital Design Arithmetic II Yao Zheng Department of Electrical Engineering University of Hawaiʻi at Mānoa Overview n Integer multiplication n Booth s algorithm n Integer division
More informationCHW 261: Logic Design
CHW 261: Logic Design Instructors: Prof. Hala Zayed Dr. Ahmed Shalaby http://www.bu.edu.eg/staff/halazayed14 http://bu.edu.eg/staff/ahmedshalaby14# Slide 1 Slide 2 Slide 3 Digital Fundamentals CHAPTER
More informationIT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1
IT 1204 Section 2.0 Data Representation and Arithmetic 2009, University of Colombo School of Computing 1 What is Analog and Digital The interpretation of an analog signal would correspond to a signal whose
More informationChapter 2 Data Representations
Computer Engineering Chapter 2 Data Representations Hiroaki Kobayashi 4/21/2008 4/21/2008 1 Agenda in Chapter 2 Translation between binary numbers and decimal numbers Data Representations for Integers
More informationComputer Arithmetic Ch 8
Computer Arithmetic Ch 8 ALU Integer Representation Integer Arithmetic Floating-Point Representation Floating-Point Arithmetic 1 Arithmetic Logical Unit (ALU) (2) Does all work in CPU (aritmeettis-looginen
More informationData Representations & Arithmetic Operations
Data Representations & Arithmetic Operations Hiroaki Kobayashi 7/13/2011 7/13/2011 Computer Science 1 Agenda Translation between binary numbers and decimal numbers Data Representations for Integers Negative
More informationThe ALU consists of combinational logic. Processes all data in the CPU. ALL von Neuman machines have an ALU loop.
CS 320 Ch 10 Computer Arithmetic The ALU consists of combinational logic. Processes all data in the CPU. ALL von Neuman machines have an ALU loop. Signed integers are typically represented in sign-magnitude
More informationComputer Arithmetic Ch 8
Computer Arithmetic Ch 8 ALU Integer Representation Integer Arithmetic Floating-Point Representation Floating-Point Arithmetic 1 Arithmetic Logical Unit (ALU) (2) (aritmeettis-looginen yksikkö) Does all
More informationNumber Systems CHAPTER Positional Number Systems
CHAPTER 2 Number Systems Inside computers, information is encoded as patterns of bits because it is easy to construct electronic circuits that exhibit the two alternative states, 0 and 1. The meaning of
More informationCPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS
CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS Aleksandar Milenković The LaCASA Laboratory, ECE Department, The University of Alabama in Huntsville Email: milenka@uah.edu Web:
More informationCPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS
CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS Aleksandar Milenković The LaCASA Laboratory, ECE Department, The University of Alabama in Huntsville Email: milenka@uah.edu Web:
More informationFloating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Lecture 3
Floating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Instructor: Nicole Hynes nicole.hynes@rutgers.edu 1 Fixed Point Numbers Fixed point number: integer part
More informationChapter 2. Data Representation in Computer Systems
Chapter 2 Data Representation in Computer Systems Chapter 2 Objectives Understand the fundamentals of numerical data representation and manipulation in digital computers. Master the skill of converting
More informationDLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 1 DLD P VIDYA SAGAR
UNIT I Digital Systems: Binary Numbers, Octal, Hexa Decimal and other base numbers, Number base conversions, complements, signed binary numbers, Floating point number representation, binary codes, error
More informationCOMP 303 Computer Architecture Lecture 6
COMP 303 Computer Architecture Lecture 6 MULTIPLY (unsigned) Paper and pencil example (unsigned): Multiplicand 1000 = 8 Multiplier x 1001 = 9 1000 0000 0000 1000 Product 01001000 = 72 n bits x n bits =
More informationMACHINE LEVEL REPRESENTATION OF DATA
MACHINE LEVEL REPRESENTATION OF DATA CHAPTER 2 1 Objectives Understand how integers and fractional numbers are represented in binary Explore the relationship between decimal number system and number systems
More informationChapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers
Chapter 03: Computer Arithmetic Lesson 09: Arithmetic using floating point numbers Objective To understand arithmetic operations in case of floating point numbers 2 Multiplication of Floating Point Numbers
More informationCOMP Overview of Tutorial #2
COMP 1402 Winter 2008 Tutorial #2 Overview of Tutorial #2 Number representation basics Binary conversions Octal conversions Hexadecimal conversions Signed numbers (signed magnitude, one s and two s complement,
More informationUNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS
UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS (09 periods) Computer Arithmetic: Data Representation, Fixed Point Representation, Floating Point Representation, Addition and
More informationCPE300: Digital System Architecture and Design
CPE300: Digital System Architecture and Design Fall 2011 MW 17:30-18:45 CBC C316 Arithmetic Unit 10122011 http://www.egr.unlv.edu/~b1morris/cpe300/ 2 Outline Recap Fixed Point Arithmetic Addition/Subtraction
More informationIntroduction to Computers and Programming. Numeric Values
Introduction to Computers and Programming Prof. I. K. Lundqvist Lecture 5 Reading: B pp. 47-71 Sept 1 003 Numeric Values Storing the value of 5 10 using ASCII: 00110010 00110101 Binary notation: 00000000
More informationVTU NOTES QUESTION PAPERS NEWS RESULTS FORUMS Arithmetic (a) The four possible cases Carry (b) Truth table x y
Arithmetic A basic operation in all digital computers is the addition and subtraction of two numbers They are implemented, along with the basic logic functions such as AND,OR, NOT,EX- OR in the ALU subsystem
More informationChapter 4. Operations on Data
Chapter 4 Operations on Data 1 OBJECTIVES After reading this chapter, the reader should be able to: List the three categories of operations performed on data. Perform unary and binary logic operations
More information9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation
Data Representation II CMSC 313 Sections 01, 02 The conversions we have so far presented have involved only unsigned numbers. To represent signed integers, computer systems allocate the high-order bit
More informationLecture 8: Addition, Multiplication & Division
Lecture 8: Addition, Multiplication & Division Today s topics: Signed/Unsigned Addition Multiplication Division 1 Signed / Unsigned The hardware recognizes two formats: unsigned (corresponding to the C
More informationKinds Of Data CHAPTER 3 DATA REPRESENTATION. Numbers Are Different! Positional Number Systems. Text. Numbers. Other
Kinds Of Data CHAPTER 3 DATA REPRESENTATION Numbers Integers Unsigned Signed Reals Fixed-Point Floating-Point Binary-Coded Decimal Text ASCII Characters Strings Other Graphics Images Video Audio Numbers
More informationNumbering systems. Dr Abu Arqoub
Numbering systems The decimal numbering system is widely used, because the people Accustomed (معتاد) to use the hand fingers in their counting. But with the development of the computer science another
More informationUNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Digital Computer Arithmetic ECE 666
UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer Arithmetic ECE 666 Part 4-A Floating-Point Arithmetic Israel Koren ECE666/Koren Part.4a.1 Preliminaries - Representation
More informationBINARY SYSTEM. Binary system is used in digital systems because it is:
CHAPTER 2 CHAPTER CONTENTS 2.1 Binary System 2.2 Binary Arithmetic Operation 2.3 Signed & Unsigned Numbers 2.4 Arithmetic Operations of Signed Numbers 2.5 Hexadecimal Number System 2.6 Octal Number System
More informationCOMPUTER ORGANIZATION AND. Edition. The Hardware/Software Interface. Chapter 3. Arithmetic for Computers
ARM D COMPUTER ORGANIZATION AND Edition The Hardware/Software Interface Chapter 3 Arithmetic for Computers Modified and extended by R.J. Leduc - 2016 In this chapter, we will investigate: How integer arithmetic
More informationInternal Data Representation
Appendices This part consists of seven appendices, which provide a wealth of reference material. Appendix A primarily discusses the number systems and their internal representation. Appendix B gives information
More informationECE260: Fundamentals of Computer Engineering
Arithmetic for Computers James Moscola Dept. of Engineering & Computer Science York College of Pennsylvania Based on Computer Organization and Design, 5th Edition by Patterson & Hennessy Arithmetic for
More informationChapter Three. Arithmetic
Chapter Three 1 Arithmetic Where we've been: Performance (seconds, cycles, instructions) Abstractions: Instruction Set Architecture Assembly Language and Machine Language What's up ahead: Implementing
More informationNumeric Encodings Prof. James L. Frankel Harvard University
Numeric Encodings Prof. James L. Frankel Harvard University Version of 10:19 PM 12-Sep-2017 Copyright 2017, 2016 James L. Frankel. All rights reserved. Representation of Positive & Negative Integral and
More informationCOSC 243. Data Representation 3. Lecture 3 - Data Representation 3 1. COSC 243 (Computer Architecture)
COSC 243 Data Representation 3 Lecture 3 - Data Representation 3 1 Data Representation Test Material Lectures 1, 2, and 3 Tutorials 1b, 2a, and 2b During Tutorial a Next Week 12 th and 13 th March If you
More informationSigned Multiplication Multiply the positives Negate result if signs of operand are different
Another Improvement Save on space: Put multiplier in product saves on speed: only single shift needed Figure: Improved hardware for multiplication Signed Multiplication Multiply the positives Negate result
More informationNumber Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as:
N Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as: a n a a a The value of this number is given by: = a n Ka a a a a a
More informationReview: MULTIPLY HARDWARE Version 1. ECE4680 Computer Organization & Architecture. Divide, Floating Point, Pentium Bug
ECE468 ALU-III.1 2002-2-27 Review: MULTIPLY HARDWARE Version 1 ECE4680 Computer Organization & Architecture 64-bit Multiplicand reg, 64-bit ALU, 64-bit Product reg, 32-bit multiplier reg Divide, Floating
More informationCHAPTER 2 Data Representation in Computer Systems
CHAPTER 2 Data Representation in Computer Systems 2.1 Introduction 37 2.2 Positional Numbering Systems 38 2.3 Decimal to Binary Conversions 38 2.3.1 Converting Unsigned Whole Numbers 39 2.3.2 Converting
More informationD I G I T A L C I R C U I T S E E
D I G I T A L C I R C U I T S E E Digital Circuits Basic Scope and Introduction This book covers theory solved examples and previous year gate question for following topics: Number system, Boolean algebra,
More informationCHAPTER 2 Data Representation in Computer Systems
CHAPTER 2 Data Representation in Computer Systems 2.1 Introduction 37 2.2 Positional Numbering Systems 38 2.3 Decimal to Binary Conversions 38 2.3.1 Converting Unsigned Whole Numbers 39 2.3.2 Converting
More informationCS 101: Computer Programming and Utilization
CS 101: Computer Programming and Utilization Jul-Nov 2017 Umesh Bellur (cs101@cse.iitb.ac.in) Lecture 3: Number Representa.ons Representing Numbers Digital Circuits can store and manipulate 0 s and 1 s.
More information(+A) + ( B) + (A B) (B A) + (A B) ( A) + (+ B) (A B) + (B A) + (A B) (+ A) (+ B) + (A - B) (B A) + (A B) ( A) ( B) (A B) + (B A) + (A B)
COMPUTER ARITHMETIC 1. Addition and Subtraction of Unsigned Numbers The direct method of subtraction taught in elementary schools uses the borrowconcept. In this method we borrow a 1 from a higher significant
More informationThe Sign consists of a single bit. If this bit is '1', then the number is negative. If this bit is '0', then the number is positive.
IEEE 754 Standard - Overview Frozen Content Modified by on 13-Sep-2017 Before discussing the actual WB_FPU - Wishbone Floating Point Unit peripheral in detail, it is worth spending some time to look at
More information1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM
1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM 1.1 Introduction Given that digital logic and memory devices are based on two electrical states (on and off), it is natural to use a number
More informationCS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.
CS 265 Computer Architecture Wei Lu, Ph.D., P.Eng. 1 Part 1: Data Representation Our goal: revisit and re-establish fundamental of mathematics for the computer architecture course Overview: what are bits
More informationComputer Architecture Chapter 3. Fall 2005 Department of Computer Science Kent State University
Computer Architecture Chapter 3 Fall 2005 Department of Computer Science Kent State University Objectives Signed and Unsigned Numbers Addition and Subtraction Multiplication and Division Floating Point
More informationBinary Addition & Subtraction. Unsigned and Sign & Magnitude numbers
Binary Addition & Subtraction Unsigned and Sign & Magnitude numbers Addition and subtraction of unsigned or sign & magnitude binary numbers by hand proceeds exactly as with decimal numbers. (In fact this
More informationCHAPTER 5: Representing Numerical Data
CHAPTER 5: Representing Numerical Data The Architecture of Computer Hardware and Systems Software & Networking: An Information Technology Approach 4th Edition, Irv Englander John Wiley and Sons 2010 PowerPoint
More informationRui Wang, Assistant professor Dept. of Information and Communication Tongji University.
Data Representation ti and Arithmetic for Computers Rui Wang, Assistant professor Dept. of Information and Communication Tongji University it Email: ruiwang@tongji.edu.cn Questions What do you know about
More informationDigital Fundamentals
Digital Fundamentals Tenth Edition Floyd Chapter 2 2009 Pearson Education, Upper 2008 Pearson Saddle River, Education NJ 07458. All Rights Reserved Decimal Numbers The position of each digit in a weighted
More informationCOMPUTER ARCHITECTURE AND ORGANIZATION. Operation Add Magnitudes Subtract Magnitudes (+A) + ( B) + (A B) (B A) + (A B)
Computer Arithmetic Data is manipulated by using the arithmetic instructions in digital computers. Data is manipulated to produce results necessary to give solution for the computation problems. The Addition,
More informationcarry in carry 1101 carry carry
Chapter Binary arithmetic Arithmetic is the process of applying a mathematical operator (such as negation or addition) to one or more operands (the values being operated upon). Binary arithmetic works
More informationChapter 3 Arithmetic for Computers (Part 2)
Department of Electr rical Eng ineering, Chapter 3 Arithmetic for Computers (Part 2) 王振傑 (Chen-Chieh Wang) ccwang@mail.ee.ncku.edu.tw ncku edu Depar rtment of Electr rical Eng ineering, Feng-Chia Unive
More informationArithmetic Logic Unit
Arithmetic Logic Unit A.R. Hurson Department of Computer Science Missouri University of Science & Technology A.R. Hurson 1 Arithmetic Logic Unit It is a functional bo designed to perform "basic" arithmetic,
More informationChapter 2. Positional number systems. 2.1 Signed number representations Signed magnitude
Chapter 2 Positional number systems A positional number system represents numeric values as sequences of one or more digits. Each digit in the representation is weighted according to its position in the
More informationFloating-point representations
Lecture 10 Floating-point representations Methods of representing real numbers (1) 1. Fixed-point number system limited range and/or limited precision results must be scaled 100101010 1111010 100101010.1111010
More informationFloating-point representations
Lecture 10 Floating-point representations Methods of representing real numbers (1) 1. Fixed-point number system limited range and/or limited precision results must be scaled 100101010 1111010 100101010.1111010
More informationNumber Systems. Both numbers are positive
Number Systems Range of Numbers and Overflow When arithmetic operation such as Addition, Subtraction, Multiplication and Division are performed on numbers the results generated may exceed the range of
More informationInf2C - Computer Systems Lecture 2 Data Representation
Inf2C - Computer Systems Lecture 2 Data Representation Boris Grot School of Informatics University of Edinburgh Last lecture Moore s law Types of computer systems Computer components Computer system stack
More informationCHAPTER V NUMBER SYSTEMS AND ARITHMETIC
CHAPTER V-1 CHAPTER V CHAPTER V NUMBER SYSTEMS AND ARITHMETIC CHAPTER V-2 NUMBER SYSTEMS RADIX-R REPRESENTATION Decimal number expansion 73625 10 = ( 7 10 4 ) + ( 3 10 3 ) + ( 6 10 2 ) + ( 2 10 1 ) +(
More informationChapter 1 Review of Number Systems
1.1 Introduction Chapter 1 Review of Number Systems Before the inception of digital computers, the only number system that was in common use is the decimal number system which has a total of 10 digits
More informationChapter 2. Data Representation in Computer Systems
Chapter 2 Data Representation in Computer Systems Chapter 2 Objectives Understand the fundamentals of numerical data representation and manipulation in digital computers. Master the skill of converting
More informationNumber System. Introduction. Decimal Numbers
Number System Introduction Number systems provide the basis for all operations in information processing systems. In a number system the information is divided into a group of symbols; for example, 26
More informationCOMPUTER ORGANIZATION AND DESIGN
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 3 Arithmetic for Computers Arithmetic for Computers Operations on integers Addition and subtraction Multiplication
More informationBinary Addition. Add the binary numbers and and show the equivalent decimal addition.
Binary Addition The rules for binary addition are 0 + 0 = 0 Sum = 0, carry = 0 0 + 1 = 0 Sum = 1, carry = 0 1 + 0 = 0 Sum = 1, carry = 0 1 + 1 = 10 Sum = 0, carry = 1 When an input carry = 1 due to a previous
More informationChapter 2: Number Systems
Chapter 2: Number Systems Logic circuits are used to generate and transmit 1s and 0s to compute and convey information. This two-valued number system is called binary. As presented earlier, there are many
More information3.5 Floating Point: Overview
3.5 Floating Point: Overview Floating point (FP) numbers Scientific notation Decimal scientific notation Binary scientific notation IEEE 754 FP Standard Floating point representation inside a computer
More informationDecimal & Binary Representation Systems. Decimal & Binary Representation Systems
Decimal & Binary Representation Systems Decimal & binary are positional representation systems each position has a value: d*base i for example: 321 10 = 3*10 2 + 2*10 1 + 1*10 0 for example: 101000001
More informationComputer Organisation CS303
Computer Organisation CS303 Module Period Assignments 1 Day 1 to Day 6 1. Write a program to evaluate the arithmetic statement: X=(A-B + C * (D * E-F))/G + H*K a. Using a general register computer with
More informationNumber Systems. Decimal numbers. Binary numbers. Chapter 1 <1> 8's column. 1000's column. 2's column. 4's column
1's column 10's column 100's column 1000's column 1's column 2's column 4's column 8's column Number Systems Decimal numbers 5374 10 = Binary numbers 1101 2 = Chapter 1 1's column 10's column 100's
More informationComputer (Literacy) Skills. Number representations and memory. Lubomír Bulej KDSS MFF UK
Computer (Literacy Skills Number representations and memory Lubomír Bulej KDSS MFF UK Number representations? What for? Recall: computer works with binary numbers Groups of zeroes and ones 8 bits (byte,
More informationChapter 4 Section 2 Operations on Decimals
Chapter 4 Section 2 Operations on Decimals Addition and subtraction of decimals To add decimals, write the numbers so that the decimal points are on a vertical line. Add as you would with whole numbers.
More informationDIGITAL SYSTEM FUNDAMENTALS (ECE 421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE 422) COURSE / CODE NUMBER SYSTEM
COURSE / CODE DIGITAL SYSTEM FUNDAMENTALS (ECE 421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE 422) NUMBER SYSTEM A considerable subset of digital systems deals with arithmetic operations. To understand the
More informationNumber Systems and Conversions UNIT 1 NUMBER SYSTEMS & CONVERSIONS. Number Systems (2/2) Number Systems (1/2) Iris Hui-Ru Jiang Spring 2010
Contents Number systems and conversion Binary arithmetic Representation of negative numbers Addition of two s complement numbers Addition of one s complement numbers Binary s Readings Unit.~. UNIT NUMBER
More informationInteger Multiplication. Back to Arithmetic. Integer Multiplication. Example (Fig 4.25)
Back to Arithmetic Before, we did Representation of integers Addition/Subtraction Logical ops Forecast Integer Multiplication Integer Division Floating-point Numbers Floating-point Addition/Multiplication
More informationCPS 104 Computer Organization and Programming
CPS 104 Computer Organization and Programming Lecture 9: Integer Arithmetic. Robert Wagner CPS104 IMD.1 RW Fall 2000 Overview of Today s Lecture: Integer Multiplication and Division. Read Appendix B CPS104
More informationFloating Point. CSE 351 Autumn Instructor: Justin Hsia
Floating Point CSE 351 Autumn 2017 Instructor: Justin Hsia Teaching Assistants: Lucas Wotton Michael Zhang Parker DeWilde Ryan Wong Sam Gehman Sam Wolfson Savanna Yee Vinny Palaniappan Administrivia Lab
More informationIn this lesson you will learn: how to add and multiply positive binary integers how to work with signed binary numbers using two s complement how fixed and floating point numbers are used to represent
More informationFloating Point Numbers. Lecture 9 CAP
Floating Point Numbers Lecture 9 CAP 3103 06-16-2014 Review of Numbers Computers are made to deal with numbers What can we represent in N bits? 2 N things, and no more! They could be Unsigned integers:
More informationComputer Organization and Structure. Bing-Yu Chen National Taiwan University
Computer Organization and Structure Bing-Yu Chen National Taiwan University Arithmetic for Computers Addition and Subtraction Gate Logic and K-Map Method Constructing a Basic ALU Arithmetic Logic Unit
More informationFloating point. Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties. Next time. !
Floating point Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties Next time! The machine model Chris Riesbeck, Fall 2011 Checkpoint IEEE Floating point Floating
More informationNumber Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr
Number Systems and Binary Arithmetic Quantitative Analysis II Professor Bob Orr Introduction to Numbering Systems We are all familiar with the decimal number system (Base 10). Some other number systems
More informationArithmetic for Computers. Hwansoo Han
Arithmetic for Computers Hwansoo Han Arithmetic for Computers Operations on integers Addition and subtraction Multiplication and division Dealing with overflow Floating-point real numbers Representation
More informationFloating-Point Arithmetic
ENEE446---Lectures-4/10-15/08 A. Yavuz Oruç Professor, UMD, College Park Copyright 2007 A. Yavuz Oruç. All rights reserved. Floating-Point Arithmetic Integer or fixed-point arithmetic provides a complete
More information4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning
4 Operations On Data 4.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List the three categories of operations performed on data.
More information10.1. Unit 10. Signed Representation Systems Binary Arithmetic
0. Unit 0 Signed Representation Systems Binary Arithmetic 0.2 BINARY REPRESENTATION SYSTEMS REVIEW 0.3 Interpreting Binary Strings Given a string of s and 0 s, you need to know the representation system
More information