[計算機概論] 第二講、Data Storage (2)
reference
[計算機概論] 第一講、Data Storage (2)
臺大科學教育發展中心CASE
臺大科學教育發展中心CASE
課後感想
簡記課程內容
Data Storage
延續上一講 第一講 - Data Storage 最後的 Topic Representation
Representation with 0 and 1
聲音
每隔一段時間,紀錄震幅位置
參數設定
- Sampling rate:每隔多久紀錄一次(赫 HZ)
- Bit resolution: 振幅要用 _ bits 表達,ex: 用 1 bytes 只能分 256 種不同高度
- Bit rate = sample rate * bit resolution: 聲音檔案每秒鐘有多少 bit 的儲存量
- bps: bit per second
- 數字越高,聲音品質越接近原音,檔案越大
- 每秒鐘有 200 個數字要記,每個數字 8 個 bits,200 * 8 = 1600 bits/每秒鐘 要寫入 = 1600 bps
數字(延伸)
+ - * /
Binary System Revisited
- Addition
- Subtraction
- Negative Numbers
- Two's Complement
- 3 bits 表達一個數字時 _ _ _ 會有七個符號
- 都是正數: 0 ~ 7
- 有負數: -4 ~ 3
- 這樣的設計有一個好處,加法會直接成立:
2 - 1 = 2 + (-1) = 010 + 111 = 1001(第一位捨棄,因為只能記住 3 個 bits) = 001 = 1 - Two's Complement Encoding
- 3 bits -2 表示:
- 2^3 = 8
- 8 - 2 = 6
- 6 的 binary = 110
- 4 bits -2 表示:
- 2^4 = 16
- 16 - 2 = 14
- 14 的 binary = 2^3 + 2^2 + 2^1 = 1110
- Excess 表示法
- 平移
- 加法
加入負數就是除以 2 = 2^15 = 2^(n - 1)
Overflow
記憶體不夠,導致兩個正的相加變成負的
Bin:
2 + 3 = 010 + 011 = 101 = -3 = 5 (mod 8)
-2 + -3 = 101 + 110 = 1011 = 011 = 3 = -5 (mod 8)
Fixed-Point
floating point
會發生 Truncation error
Normalized Form
Comments
Post a Comment