tutLN2soln

tutLN2soln - FIT1001 Data Representation Solutions to...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: FIT1001 Data Representation Solutions to FIT1001 Tutorials for LN2 Data Representation Data Representation Integers (* Important to complete) Exercise 1 Convert the following fractions to binary: (a) 237.25 SOLUTION: Integer part as usual 11101101 Fraction: . 25 2 = 0 . 5 remove the 0 . 5 2 = 1 . remove the 1 . 01 result = 11101101.01 (b) 32.32 SOLUTION: Integer part as usual 100000 Fraction: . 32 2 = 0 . 64 remove the 0 . 64 2 = 1 . 28 remove the 1 . 28 2 = 0 . 56 remove the 0 . 56 2 = 1 . 12 remove the 1 . 12 2 = 0 . 24 remove the 0 . 24 2 = 0 . 48 remove the 0 . 48 2 = 0 . 96 remove the 0 . 96 2 = 1 . 92 remove the 1 . 92 2 = 1 . 84 remove the 1 . . . . 010100011 . . . result = 100000.010100011 1 * Exercise 2 Represent the number- 92 in (a) 8-bit signed magnitude SOLUTION: Just convert +92 to binary (getting 01011100) and put sign bit 1 out the front to get- 92 (11011100). Here we dont need to pad with leading 0s, but remind the students of need to do that in order to get required number of bits. (b) 8-bit 2s complement SOLUTION: Again, start with +92 in 8 bits. (For +ve numbers, signed magnitude is same as 2s complement. For NEGATIVE numbers, they are quite different.) Then negate, by complementing each bit then numerically adding 1. 10100011+1 = 10100100 (c) 8-bit excess-k SOLUTION: k = 2 7- 1 = 127- 92 + 127 = 35 00100011 * Exercise 3 Convert the following numbers from unsigned binary notation to decimal notation, and from 6-bit 2s complement notation to decimal notation: SOLUTION: Unsigned binary (a) 110011 = 2 5 + 2 4 + 2 1 + 2 = 32 + 16 + 2 + 1 = 51 (b) 001101 = 2 3 + 2 2 + 2 = 8 + 4 + 1 = 13 (c) 100100 = 2 5 + 2 2 = 32 + 4 = 36 Twos complement (verify using different conversion methods) (a) 110011 =- 2 5 + 2 4 + 2 1 + 2 =- 32 + 16 + 2 + 1 =- 13 (b) 001101 = 13 as above (c) 100100 invert + 1 = 011011 + 1 = 011100 =- (2 4 + 2 3 + 2 2 ) =- (16 + 8 + 4) =- 28 2 Exercise 4...
View Full Document

Page1 / 7

tutLN2soln - FIT1001 Data Representation Solutions to...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online