CS 120 Lecture 2: Binary
Document Summary
In computer science, you only need to know your powers of 2 and some basic addition. High voltage and low voltage are used to determine what number in binary it is. High voltage is 1, low voltage is 0. This is because it is easier to measure two types of voltage than numerous levels of voltage. Positional notation: using the number of bits to represent a number. Example: using 5 bits to represent the number 5. This is a terrible way of representation because it uses too much space. Weighted position: using the position of a number to determine its value. Example: 329 = 3*10^2 + 2*10^1 + 9*10^0. The example above is in decimal format, which uses powers of ten. To write in binary, use powers of 2: C*2^2 + b*2^1 + a*2^0 for any positive numbers a,b,c,etc. Bits tell us how large a number a machine can handle. A 3-bit machine can handle up to 7: