Module 2: Computer Arithmetic

 Brooke Clark
 7 months 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 righthand byte (or nybble) of a pair Lower Byte (or nybble): The lefthand 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 00 = = 1, and borrow 1 from the next more significant bit 10 = = 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 4bit 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 4bit 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 4bit 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 carryout bit Subtraction Negate the subtrahend and add, discarding any carryout 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 8bit 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 4bit 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 34 = = 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. 32bit 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 64bit 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 64bit wide; multiplier register is 32bit 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 32bit 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 64bit 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 64bit wide; quotient register is 32bit 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 1014
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 nonzero is a value. Unnormalized floating number is when the number after the radix point is 0. Example: x x x x 10 5 unnormalized nonzero value. unnormalized normalized normalized
53 Normalization Process Normalization is the process of deleting the zeroes until a Move nonzero 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 n1 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 n1 = = 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 FloatingPoint Representation Value in general form: (1) S x F x 2 e In an 8bit representation, we can represent: From 2 x to 2 x This is called singleprecision = 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 FloatingPoint 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 nonzero before the radix point. Example: 70 there is only a single nonzero 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 floatingpoint 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 (exponentbias)
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 21
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 21
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 FloatingPoint 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 (exponentbias) The Fraction = (0 x 21 ) + (1 x 22 ) + (0 x 23 ) = ¼ = ( ) The number =  (1.25 x 2 (exponentbias) ) =  (1.25 x 2 2 ) =  (1.25 x 4) = 5.0
74 Module 2 Part 3 82 FLOATINGPOINT OPERATIONS
75 FloatingPoint Addition Flows 83
76 Decimal FloatingPoint 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 FloatingPoint Addition Example: d x d x 101 Step 1: Align the decimal point of the number that has the smaller exponent Make d x 101 to x = 1 x = 2 move 2 to left d x 10 1 Step 2: add the significand x d x x
78 Decimal FloatingPoint Addition Example: d x d x 101 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 FloatingPoint 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 22 Make 1.11 b x 22 to x = 1 x = 1 move 1 to left b x 21
80 Decimal FloatingPoint 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 FloatingPoint Multiplication Flows 90
82 FloatingPoint 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 FloatingPoint Multiplication 92 Example: (1.110 d x ) x (9.200 d x 105 ) 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 FloatingPoint Multiplication Example: (1.110 d x ) x (9.200 d x 105 ) 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 FloatingPoint Multiplication Example: (1.000 b x 21 ) x ( b x 22 ) 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 103
86 FloatingPoint Multiplication Example: (1.000 b x 21 ) x ( b x 22 Step 3: Normalize the product x 103 already normalized 96 Step 4: Round the significand (4 decimal digits for significand) x 103 Still normalized Step 5: Normalize it (if need be) Step 6: Set the sign of the product b x /32 d
87 FloatingPoint 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
Number 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 Rformat Iformat... integer data number text
More informationFloating Point Arithmetic
Floating Point Arithmetic CS 365 FloatingPoint What can be represented in N bits? Unsigned 0 to 2 N 2s Complement 2 N1 to 2 N11 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 floatingpoint numbers Examples: 3.14159265 (π) 2.71828 (e) 0.000000001 or 1.0 10 9 (seconds in
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 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 informationComputer Arithmetic Ch 8
Computer Arithmetic Ch 8 ALU Integer Representation Integer Arithmetic FloatingPoint Representation FloatingPoint Arithmetic 1 Arithmetic Logical Unit (ALU) (2) Does all work in CPU (aritmeettislooginen
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 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 reestablish fundamental of mathematics for the computer architecture course Overview: what are bits
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 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 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 13Sep2017 Before discussing the actual WB_FPU  Wishbone Floating Point Unit peripheral in detail, it is worth spending some time to look at
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 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 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 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 2: Number Systems
Chapter 2: Number Systems Logic circuits are used to generate and transmit 1s and 0s to compute and convey information. This twovalued number system is called binary. As presented earlier, there are many
More informationChapter 3 Arithmetic for Computers (Part 2)
Department of Electr rical Eng ineering, Chapter 3 Arithmetic for Computers (Part 2) 王振傑 (ChenChieh Wang) ccwang@mail.ee.ncku.edu.tw ncku edu Depar rtment of Electr rical Eng ineering, FengChia Unive
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 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 informationFloatingpoint Arithmetic. where you sum up the integer to the left of the decimal point and the fraction to the right.
Floatingpoint Arithmetic Reading: pp. 312328 FloatingPoint Representation Nonscientific floating point numbers: A noninteger can be represented as: 2 4 2 3 2 2 2 1 2 0.21 22 23 24 where you sum
More informationArithmetic Operations on Binary Numbers
Arithmetic Operations on Binary Numbers Because of its widespread use, we will concentrate on addition and subtraction for Two's Complement representation. The nice feature with Two's Complement is that
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 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 informationC NUMERIC FORMATS. Overview. IEEE SinglePrecision Floatingpoint Data Format. Figure C0. Table C0. Listing C0.
C NUMERIC FORMATS Figure C. Table C. Listing C. Overview The DSP supports the 32bit singleprecision floatingpoint data format defined in the IEEE Standard 754/854. In addition, the DSP supports an
More informationFloating Point Numbers. Lecture 9 CAP
Floating Point Numbers Lecture 9 CAP 3103 06162014 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 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 informationMore Programming Constructs  Introduction
More Programming Constructs  Introduction We can now examine some additional programming concepts and constructs Chapter 5 focuses on: internal data representation conversions between one data type and
More informationA complement number system is used to represent positive and negative integers. A complement number system is based on a fixed length representation
Complement Number Systems A complement number system is used to represent positive and negative integers A complement number system is based on a fixed length representation of numbers Pretend that integers
More informationChapter 3: part 3 Binary Subtraction
Chapter 3: part 3 Binary Subtraction Iterative combinational circuits Binary adders Half and full adders Ripple carry and carry lookahead adders Binary subtraction Binary addersubtractors Signed binary
More informationSigned umbers. Sign/Magnitude otation
Signed umbers So far we have discussed unsigned number representations. In particular, we have looked at the binary number system and shorthand methods in representing binary codes. With m binary digits,
More informationFloating Point Numbers
Floating Point Numbers Summer 8 Fractional numbers Fractional numbers fixed point Floating point numbers the IEEE 7 floating point standard Floating point operations Rounding modes CMPE Summer 8 Slides
More informationLecture 5. Computer Arithmetic. Ch 9 [Stal10] Integer arithmetic Floatingpoint arithmetic
Lecture 5 Computer Arithmetic Ch 9 [Stal10] Integer arithmetic Floatingpoint arithmetic ALU ALU = Arithmetic Logic Unit (aritmeettislooginen yksikkö) Actually performs operations on data Integer and
More information1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
CS 64 Lecture 2 Data Representation Reading: FLD 1.21.4 Decimal Numbers: Base 10 Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Example: 3271 = (3x10 3 ) + (2x10 2 ) + (7x10 1 ) + (1x10 0 ) 1010 10?= 1010 2?= 1
More informationCS429: Computer Organization and Architecture
CS429: Computer Organization and Architecture Dr. Bill Young Department of Computer Sciences University of Texas at Austin Last updated: September 18, 2017 at 12:48 CS429 Slideset 4: 1 Topics of this Slideset
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 Fabián E. Bustamante, Spring 2010 IEEE Floating point Floating point
More informationChapter 2 Float Point Arithmetic. Real Numbers in Decimal Notation. Real Numbers in Decimal Notation
Chapter 2 Float Point Arithmetic Topics IEEE Floating Point Standard Fractional Binary Numbers Rounding Floating Point Operations Mathematical properties Real Numbers in Decimal Notation Representation
More informationComputer Architecture and Organization
31 Chapter 3  Arithmetic Computer Architecture and Organization Miles Murdocca and Vincent Heuring Chapter 3 Arithmetic 32 Chapter 3  Arithmetic Chapter Contents 3.1 Fixed Point Addition and Subtraction
More information9 Multiplication and Division
9 Multiplication and Division Multiplication is done by doing shifts and additions. Multiplying two (unsigned) numbers of n bits each results in a product of 2n bits. Example: 0110 x 0011 (6x3) At start,
More informationCS101 Lecture 04: Binary Arithmetic
CS101 Lecture 04: Binary Arithmetic Binary Number Addition Two s complement encoding Briefly: real number representation Aaron Stevens (azs@bu.edu) 25 January 2013 What You ll Learn Today Counting in binary
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 informationScientific Computing. Error Analysis
ECE257 Numerical Methods and Scientific Computing Error Analysis Today s s class: Introduction to error analysis Approximations RoundOff Errors Introduction Error is the difference between the exact solution
More informationNumber Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example
Appendix F Number Systems Binary Numbers Decimal notation represents numbers as powers of 10, for example 1729 1 103 7 102 2 101 9 100 decimal = + + + There is no particular reason for the choice of 10,
More informationCourse Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation
Course Schedule CS 221 Computer Architecture Week 3: Information Representation (2) Fall 2001 W1 Sep 11 Sep 14 Introduction W2 Sep 18 Sep 21 Information Representation (1) (Chapter 3) W3 Sep 25 Sep
More informationSystems I. Floating Point. Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties
Systems I Floating Point Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties IEEE Floating Point IEEE Standard 754 Established in 1985 as uniform standard for
More informationPrinciples of Computer Architecture. Chapter 3: Arithmetic
31 Chapter 3  Arithmetic Principles of Computer Architecture Miles Murdocca and Vincent Heuring Chapter 3: Arithmetic 32 Chapter 3  Arithmetic 3.1 Overview Chapter Contents 3.2 Fixed Point Addition
More informationHardware Modules for Safe Integer and FloatingPoint Arithmetic
Hardware Modules for Safe Integer and FloatingPoint Arithmetic A Thesis submitted to the Graduate School Of The University of Cincinnati In partial fulfillment of the requirements for the degree of Master
More informationFloating Point Puzzles The course that gives CMU its Zip! Floating Point Jan 22, IEEE Floating Point. Fractional Binary Numbers.
class04.ppt 15213 The course that gives CMU its Zip! Topics Floating Point Jan 22, 2004 IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Floating Point Puzzles For
More informationData Representation Floating Point
Data Representation Floating Point CSCI 2400 / ECE 3217: Computer Architecture Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides via Jason Fritts Today: Floating Point Background:
More informationSigned Binary Numbers
Signed Binary Numbers Unsigned Binary Numbers We write numbers with as many digits as we need: 0, 99, 65536, 15000, 1979, However, memory locations and CPU registers always hold a constant, fixed number
More informationChapter 2 Bits, Data Types, and Operations
Chapter 2 Bits, Data Types, and Operations How do we represent data in a computer? At the lowest level, a computer is an electronic machine. works by controlling the flow of electrons Easy to recognize
More informationLearning Log Title: CHAPTER 3: ARITHMETIC PROPERTIES. Date: Lesson: Chapter 3: Arithmetic Properties
Chapter 3: Arithmetic Properties CHAPTER 3: ARITHMETIC PROPERTIES Date: Lesson: Learning Log Title: Date: Lesson: Learning Log Title: Chapter 3: Arithmetic Properties Date: Lesson: Learning Log Title:
More informationSystem Programming CISC 360. Floating Point September 16, 2008
System Programming CISC 360 Floating Point September 16, 2008 Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Powerpoint Lecture Notes for Computer Systems:
More informationCharacters, Strings, and Floats
Characters, Strings, and Floats CS 350: Computer Organization & Assembler Language Programming 9/6: pp.8,9; 9/28: Activity Q.6 A. Why? We need to represent textual characters in addition to numbers. Floatingpoint
More informationClasses of Real Numbers 1/2. The Real Line
Classes of Real Numbers All real numbers can be represented by a line: 1/2 π 1 0 1 2 3 4 real numbers The Real Line { integers rational numbers nonintegral fractions irrational numbers Rational numbers
More informationComputer Architecture. Chapter 3: Arithmetic for Computers
182.092 Computer Architecture Chapter 3: Arithmetic for Computers Adapted from Computer Organization and Design, 4 th Edition, Patterson & Hennessy, 2008, Morgan Kaufmann Publishers and Mary Jane Irwin
More informationCS/COE 0447 Example Problems for Exam 2 Spring 2011
CS/COE 0447 Example Problems for Exam 2 Spring 2011 1) Show the steps to multiply the 4bit numbers 3 and 5 with the fast shiftadd multipler. Use the table below. List the multiplicand (M) and product
More informationTailoring the 32Bit ALU to MIPS
Tailoring the 32Bit ALU to MIPS MIPS ALU extensions Overflow detection: Carry into MSB XOR Carry out of MSB Branch instructions Shift instructions Slt instruction Immediate instructions ALU performance
More informationFloating Point Arithmetic
Floating Point Arithmetic Floating point numbers are frequently used in many applications. Implementation of arithmetic units such as adder, multiplier, etc for Floating point numbers are more complex
More informationENE 334 Microprocessors
Page 1 ENE 334 Microprocessors Lecture 10: MCS51: Logical and Arithmetic : Dejwoot KHAWPARISUTH http://webstaff.kmutt.ac.th/~dejwoot.kha/ ENE 334 MCS51 Logical & Arithmetic Page 2 Logical: Objectives
More informationCO Computer Architecture and Programming Languages CAPL. Lecture 15
CO20320241 Computer Architecture and Programming Languages CAPL Lecture 15 Dr. Kinga Lipskoch Fall 2017 How to Compute a Binary Float Decimal fraction: 8.703125 Integral part: 8 1000 Fraction part: 0.703125
More informationl l l l l l l Base 2; each digit is 0 or 1 l Each bit in place i has value 2 i l Binary representation is used in computers
198:211 Computer Architecture Topics: Lecture 8 (W5) Fall 2012 Data representation 2.1 and 2.2 of the book Floating point 2.4 of the book Computer Architecture What do computers do? Manipulate stored information
More informationNUMBER SCALING FOR THE LGP27
NUMBER SCALING FOR THE LGP27 5 SCALING The LGP21 considers all numbers to be within the range l
More informationIEEE754 floatingpoint
IEEE754 floatingpoint Real and floatingpoint numbers Real numbers R form a continuum  Rational numbers are a subset of the reals  Some numbers are irrational, e.g. π Floatingpoint numbers are an
More informationLearning the Binary System
Learning the Binary System www.brainlubeonline.com/counting_on_binary/ Formated to L A TEX: /25/22 Abstract This is a document on the base2 abstract numerical system, or Binary system. This is a VERY
More informationNumeric Variable Storage Pattern
Numeric Variable Storage Pattern Sreekanth Middela Srinivas Vanam Rahul Baddula Percept Pharma Services, Bridgewater, NJ ABSTRACT This paper presents the Storage pattern of Numeric Variables within the
More informationDigital Fundamentals
Digital Fundamentals Tenth Edition Floyd Chapter 1 Modified by Yuttapong Jiraraksopakun Floyd, Digital Fundamentals, 10 th 2008 Pearson Education ENE, KMUTT ed 2009 Analog Quantities Most natural quantities
More informationP( Hit 2nd ) = P( Hit 2nd Miss 1st )P( Miss 1st ) = (1/15)(15/16) = 1/16. P( Hit 3rd ) = (1/14) * P( Miss 2nd and 1st ) = (1/14)(14/15)(15/16) = 1/16
CODING and INFORMATION We need encodings for data. How many questions must be asked to be certain where the ball is. (cases: avg, worst, best) P( Hit 1st ) = 1/16 P( Hit 2nd ) = P( Hit 2nd Miss 1st )P(
More informationNumber Systems & Encoding
Number Systems & Encoding Lecturer: Sri Parameswaran Author: Hui Annie Guo Modified: Sri Parameswaran Week2 1 Lecture overview Basics of computing with digital systems Binary numbers Floating point numbers
More informationCoprocessor Math Processor. Richa Upadhyay Prabhu. NMIMS s MPSTME February 9, 2016
8087 Math Processor Richa Upadhyay Prabhu NMIMS s MPSTME richa.upadhyay@nmims.edu February 9, 2016 Introduction Need of Math Processor: In application where fast calculation is required Also where there
More information4/8/17. Admin. Assignment 5 BINARY. David Kauchak CS 52 Spring 2017
4/8/17 Admin! Assignment 5 BINARY David Kauchak CS 52 Spring 2017 Diving into your computer Normal computer user 1 After intro CS After 5 weeks of cs52 What now One last note on CS52 memory address binary
More informationArithmetic Operations
Arithmetic Operations Arithmetic Operations addition subtraction multiplication division Each of these operations on the integer representations: unsigned two's complement 1 Addition One bit of binary
More informationLesson 1: THE DECIMAL SYSTEM
Lesson 1: THE DECIMAL SYSTEM The word DECIMAL comes from a Latin word, which means "ten. The Decimal system uses the following ten digits to write a number: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. Each time
More informationCHAPTER 6 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS
CHAPTER 6 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS Addition of Unsigned Numbers The instruction ADD is used to add two operands Destination operand is always in register A Source operand can be a register,
More informationCS321. Introduction to Numerical Methods
CS31 Introduction to Numerical Methods Lecture 1 Number Representations and Errors Professor Jun Zhang Department of Computer Science University of Kentucky Lexington, KY 40506 0633 August 5, 017 Number
More informationDigital Arithmetic. Digital Arithmetic: Operations and Circuits Dr. Farahmand
Digital Arithmetic Digital Arithmetic: Operations and Circuits Dr. Farahmand Binary Arithmetic Digital circuits are frequently used for arithmetic operations Fundamental arithmetic operations on binary
More informationEE 109 Unit 6 Binary Arithmetic
EE 109 Unit 6 Binary Arithmetic 1 2 Semester Transition Point At this point we are going to start to transition in our class to look more at the hardware organization and the lowlevel software that is
More informationUNIT IV: DATA PATH DESIGN
UNIT IV: DATA PATH DESIGN Agenda Introduc/on Fixed Point Arithme/c Addi/on Subtrac/on Mul/plica/on & Serial mul/plier Division & Serial Divider Two s Complement (Addi/on, Subtrac/on) Booth s algorithm
More information1620 DATA PRQCESSING SYSTEM BULLETlli. AUTOMATIC FLOATINGPOINT OPERATIONS (Special Feature)
1620 DATA PRQCESSING SYSTEM BULLETlli AUTOMATIC FLOATINGPOINT OPERATIONS (Special Feature) The Automatic FloatingPoint Operations special feature provides the IBM 1620 Data Processing System (Figure 1)
More informationAn Efficient Implementation of Floating Point Multiplier
An Efficient Implementation of Floating Point Multiplier Mohamed AlAshrafy Mentor Graphics Mohamed_Samy@Mentor.com Ashraf Salem Mentor Graphics Ashraf_Salem@Mentor.com Wagdy Anis Communications and Electronics
More information2 Computation with FloatingPoint Numbers
2 Computation with FloatingPoint Numbers 2.1 FloatingPoint Representation The notion of real numbers in mathematics is convenient for hand computations and formula manipulations. However, real numbers
More informationCREATING FLOATING POINT VALUES IN MILSTD1750A 32 AND 48 BIT FORMATS: ISSUES AND ALGORITHMS
CREATING FLOATING POINT VALUES IN MILSTD1750A 32 AND 48 BIT FORMATS: ISSUES AND ALGORITHMS Jeffrey B. Mitchell L3 Communications, Telemetry & Instrumentation Division Storm Control Systems ABSTRACT Experimentation
More informationArithmetic. Chapter 3 Computer Organization and Design
Arithmetic Chapter 3 Computer Organization and Design Addition Addition is similar to decimals 0000 0111 + 0000 0101 = 0000 1100 Subtraction (negate) 0000 0111 + 1111 1011 = 0000 0010 Over(under)flow For
More informationIEEE Standard 754 Floating Point Numbers
IEEE Standard 754 Floating Point Numbers Steve Hollasch / Last update 2005Feb24 IEEE Standard 754 floating point is the most common representation today for real numbers on computers, including Intelbased
More informationThe Perils of Floating Point
The Perils of Floating Point by Bruce M. Bush Copyright (c) 1996 Lahey Computer Systems, Inc. Permission to copy is granted with acknowledgement of the source. Many great engineering and scientific advances
More informationDivisibility Rules and Their Explanations
Divisibility Rules and Their Explanations Increase Your Number Sense These divisibility rules apply to determining the divisibility of a positive integer (1, 2, 3, ) by another positive integer or 0 (although
More informationLogic, Words, and Integers
Computer Science 52 Logic, Words, and Integers 1 Words and Data The basic unit of information in a computer is the bit; it is simply a quantity that takes one of two values, 0 or 1. A sequence of k bits
More informationTUTORIAL 1 COMPUTER ORGANISATION TIT402
TUTORIAL 1 COMPUTER ORGANISATION TIT402 Q1.(43) 10 = (? ) 2 s (GATE 2000) a)01010101 b)11010101 c)00101011 d)10101011 Q2.The 2 s complement representation of (539) 10 in hexadecimal is (GATE 2001) a)abe
More informationDeclaring Floating Point Data
Declaring Floating Point Data There are three ways to declare floating point storage. These are E D L Single precision floating point, Double precision floating point, and Extended precision floating point.
More informationCMSC 313 Lecture 03 Multiplebyte data bigendian vs littleendian sign extension Multiplication and division Floating point formats Character Codes
Multiplebyte data CMSC 313 Lecture 03 bigendian vs littleendian sign extension Multiplication and division Floating point formats Character Codes UMBC, CMSC313, Richard Chang 45 Chapter
More informationCS101 Introduction to computing Floating Point Numbers
CS101 Introduction to computing Floating Point Numbers A. Sahu and S. V.Rao Dept of Comp. Sc. & Engg. Indian Institute of Technology Guwahati 1 Outline Need to floating point number Number representation
More information8/30/2016. In Binary, We Have A Binary Point. ECE 120: Introduction to Computing. FixedPoint Representations Support Fractions
University of Illinois at UrbanaChampaign Dept. of Electrical and Computer Engineering ECE 120: Introduction to Computing Fixed and FloatingPoint Representations In Binary, We Have A Binary Point Let
More information15213 Recitation 2: Floating Point
15213 Recitation 2: Floating Point 1 Introduction This handout will introduce and test your knowledge of the floating point representation of real numbers, as defined by the IEEE standard. This information
More informationBits, Bytes, and Integers Part 2
Bits, Bytes, and Integers Part 2 15213: Introduction to Computer Systems 3 rd Lecture, Jan. 23, 2018 Instructors: Franz Franchetti, Seth Copen Goldstein, Brian Railing 1 First Assignment: Data Lab Due:
More informationBut first, encode deck of cards. Integer Representation. Two possible representations. Two better representations WELLESLEY CS 240 9/8/15
Integer Representation Representation of integers: unsigned and signed Sign extension Arithmetic and shifting Casting But first, encode deck of cards. cards in suits How do we encode suits, face cards?
More informationOn a 64bit CPU. Size/Range vary by CPU model and Word size.
On a 64bit CPU. Size/Range vary by CPU model and Word size. unsigned short x; //range 0 to 65553 signed short x; //range ± 32767 short x; //assumed signed There are (usually) no unsigned floats or doubles.
More informationInternational Journal of Advanced Research in Electrical, Electronics and Instrumentation Engineering
An Efficient Implementation of Double Precision Floating Point Multiplier Using Booth Algorithm Pallavi Ramteke 1, Dr. N. N. Mhala 2, Prof. P. R. Lakhe M.Tech [IV Sem], Dept. of Comm. Engg., S.D.C.E, [Selukate],
More informationA NEW REPRESENTATION OF THE RATIONAL NUMBERS FOR FAST EASY ARITHMETIC
A NEW REPRESENTATION OF THE RATIONAL NUMBERS FOR FAST EASY ARITHMETIC ERIC C. R. HEHNER and R. N. S. HORSPOOL Abstract. A novel system for representing the rational numbers based on Hensel's padic arithmetic
More informationECE 372 Microcontroller Design Assembly Programming Arrays. ECE 372 Microcontroller Design Assembly Programming Arrays
Assembly Programming Arrays Assembly Programming Arrays Array For Loop Example: unsigned short a[]; for(j=; j
More informationDATA REPRESENTATION. Data Types. Complements. Fixed Point Representations. Floating Point Representations. Other Binary Codes. Error Detection Codes
1 DATA REPRESENTATION Data Types Complements Fixed Point Representations Floating Point Representations Other Binary Codes Error Detection Codes 2 Data Types DATA REPRESENTATION Information that a Computer
More information1.2 Roundoff Errors and Computer Arithmetic
1.2 Roundoff Errors and Computer Arithmetic 1 In a computer model, a memory storage unit word is used to store a number. A word has only a finite number of bits. These facts imply: 1. Only a small set
More information