4834_lecture_18_ho

4834_lecture_18_ho - EEL 4834: Lecture 18 EEL 4834: Lecture...

Info iconThis preview shows pages 1–4. 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

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: EEL 4834: Lecture 18 EEL 4834: Lecture 18 Binary Serialization Professor O. Boykin University of Florida, Department of Electrical and Computer Engineering October 8, 2009 EEL 4834: Lecture 18 Outline 1 Integers 2 Serializing Integers EEL 4834: Lecture 18 Integers Binary Representation of Integers A number can be expanded in base b using: N = X i n i b i where n i (0 , b- 1). Examples: 54 = 5 10 1 + 4 10 = 2 3 3 + 0 3 2 + 0 3 1 + 0 3 = 2000 base 3 = 1 2 5 + 1 2 4 + 0 2 3 + 1 2 2 + 1 2 1 + 0 2 = 110110 base 2 EEL 4834: Lecture 18 Integers Code to do base conversions The following code returns an array with the digits for the number n in base base: def base convert(n, base, result = None): (nd, nr) = divmod(n, base) #nd is n // base, nr = n % base if not result: result = result.insert(0, nr) if nd == 0: return result else: return base convert(nd, base, result) EEL 4834: Lecture 18 Integers Representing negative integers: Twos Compliment A negative number x with | x | < 2 n- 1 is represented as an...
View Full Document

Page1 / 7

4834_lecture_18_ho - EEL 4834: Lecture 18 EEL 4834: Lecture...

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

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