ECS 36A Lecture Notes - Lecture 2: 3I, Endianness, Binary Number
249 views3 pages
Published on 3 Oct 2018
School
Department
Course
Professor

ECS 36A - Lecture 2 - Bits and Bytes at Work
Bit vs Bytes
● Bit -- most basic unit of data
○ Comes in only 2 states
● Byte = 8 bits = 2^3 bits (base 2)
How many bits do you need to represent 52 different things? Log2 52 < 6
Question of interest -- WHY are we interested in powers of 2? -- it is in relation to the reason
that memory also comes in powers of 2
Memory has 2 states = 0 or 1 (binary), and the # of states storable are categorized by a power
of 2 -- which is why the power of 2 has special meanings in computer science and is a really
important aspect
In most, contemporary cases, bytes have become the most common, basic unit of information
over bits because of convenience (terms of how much storage it has)
Prefixes are used to represent larger amounts of bytes:
Decimal- based notation
● k: 1,000 (10^3) bytes -- k is lowercase while others are uppercase
● M: (10)^6
● G: (10)^9
● T: (10)^12
Binary notation
● ki: 2^10
● Mi: 2^20
● Gi: 2^30
● Ti: 2^40
Examples:
1. Convert the number 12 to binary.
#12 → 8+4 : break up the number 12 and proceed to convert the 2 parts of the equation into
binary and add
1000 +100 = 1100
The first 1 in 1100 is the Most significant Bit and the Last 0 in 1100 is least significant bit