cs61c_fa07_mtReview - CS61c Midterm Review (sp07) Number...

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

View Full Document Right Arrow Icon
CS61c Midterm Review (sp07) Number representation and Floating points Alex Kronrod Number representation (See: Lecture 2, Lab 1, HW#1) KNOW: Kibi (2 10 ), Mebi(2 20 ), Gibi(2 30 ), Tebi(2 40 ), Pebi(2 50 ), Exbi(2 60 ), Zebi(2 70 ), Yobi (2 80 ) Know the Binary (0b), Octal (0), Decimal, Hexadecimal (0x) representation of numbers. o Example: 1111 2 = 17 8 = 15 ten = F hex or 0b1111 = 017 = 15 = 0xF Know how to convert from one base to another. Example: 104 5 =4*5 0 +0*5 1 +1*5 2 = 29 ten Know what is a bit, a Nibble, a Byte, a Word o Example: above example uses a Nibble! The lecture presents the evolution of number representation: sign and magnitude, one’s complement, two’s complement o Sign and Magnitude: *Left most bit represents the sign (0 == positive, 1 == negative), the rest represents magnitude. *In order to negate, flip the left most bit. * Can represent from –(2 N-1 -1) to 2 N-1 -1 Cons: *We have two zeros, namely 0x00000000 and 0x80000000 *Arithmetic is non-trivial *Number comparison is non trivial ( -2 > -1 ) o One’s Complement *Left most bit represents the sign. *In order to negate, must flip all the bits. b -x = flip_bits(x) * Can represent from –(2 N-1 -1) to 2 N-1 -1 Cons: * Still have two zeros. o Two’s Complement (standard) *Left most bit represents the sign. *In order to negate must flip bits and add 1.
Background image of page 1

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

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

This note was uploaded on 04/09/2008 for the course CS 61A taught by Professor Harvey during the Spring '08 term at University of California, Berkeley.

Page1 / 7

cs61c_fa07_mtReview - CS61c Midterm Review (sp07) Number...

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

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