Cheatography

# do not use Cheat Sheet (DRAFT) by wayneswu

lmaolmaolmaolmaolmao

This is a draft cheat sheet. It is a work in progress and is not finished yet.

### Positional Number System

 - Radix - number of unique symbols in a number system - usually 0-9, then A-Z

### 2x vs 10y

- Binary prefix are mainly use in memory capacity
- SI prefix are usually use in data transfer rate or storage space

- abbrev­iation * value = number of bits

### Binary Data Organi­zation

• a bit has 2 cells

• most signif­icant (left) ------ least signif­icant (right)
• bit(b), byte(B)

• little endian - top address to bottom
• big endian - bottom address to top

### Integer repres­ent­ation

 UNSIGNED 0 to (2n)-1 normal fill the rest with 0 (MSb) SIGNED -(2n-1) to +(2n-1)-1 sign and magnitude sign bit | positive int 1's complement (n-1's) flip for negative int 2's complement (n's) flip then + 1, for negative int
- unsigned integers use zero extension
- signed integers use sign extension
in short, extend the MSb until you have reached the sufficient num of bits

### integer operation overflow

 SHOULD ___; otherwise, overflow ADDITION  ­ UNSIGNED SHOULD NOT have carry  ­ SIGNED [same sign] SHOULD remain the same sign  ­ SIGNED [different sign] add using 2's complement repres­ent­ation (never overflow) SUBTRA­CTION  ­ UNSIGNED SHOULD HAVE carry  ­ SIGNED A-B = A+B' (2's complement B)
addition of signed integers [same sign]
­ 1. first bit should never change
­ 2. ignore carry if there is

### IEEE 754 Floating point for single precision

 1 - sign bit 8 - exponent 23 - mantissa 0 for positive e' = e + 127 f in 1.f notation
Example:
Given: 3.5₁₀
­ 1. 3.5₁₀ = 11.1₂
­ 2. 1.11 x 21
­ 3. e' = 128₁₀ == 1000_0000₂

### IEEE 754 Floating point for single precision

 1 - sign bit 8 - exponent 23 - mantissa 0 for positive

### test

 1 - sign bit 8 - exponent 23 - mantissa 0 for positive e' = e + 127 f in 1.f notation
Example:
Given: 3.5₁₀
­ 1. 3.5₁₀ = 11.1₂
­ 2. 1.11 x 21
­ 3. e' = 128₁₀ == 1000_0000₂