Computer Science 237
Computer Organization
Williams College
Fall 2006
Lecture 03: Binary Arithmetic, Signed Representations
Date: September 13, 2006
Agenda
Announcements
Not CS, but potentially interesting talk tonight: Shuttle astronaut Stephanie Wilson, Brooks-Rogers, 7 PM.
My office hours on Friday may start and end early. Come by if you need help!
Lab continues - ask questions when stuck
Thrown into the deep end and don't know how to swim?
You will soon know what I'm talking about on pages 1 and 2. If not today, then Friday, I promise.
Suggestion: avoid the
sqrt
function, in fact avoid the math library altogether
Useful C functions:
atoi(3)
,
scanf(3)
.
Useful C ideas: bit shifts and logical operators.
Useful C example:
show_bytes
from last time.
TA hours Sunday evening in TCL 312. I hope to be around some then, too.
Memory model and pointers
Know your prefixes: Kilo, Mega, Giga, Tera, Peta, Exa, Zetta, Yotta
Just think of memory as a big array of bytes.
A pointer? Just a memory location whose contents is a memory location.
Strings and arrays
no
String
s in C - just use an array of
char
.
Math
unsigned addition and multiplication
signed integer representations
signed magnitude
Excess N
1's complement
2's complement
signed addition