3 Binary Math and Signed Representations Computer Organization
第 3章 Binary Math and Signed Representations Computer Organization and Design Fundamental 書籍作者:David Tarnoff 投影片製作者:陳鍾誠
3. 1 Binary Addition
3. 2 Binary Subtraction
2 補數的補數 In decimal, the negative of 5 is -5. If we take the negative a second time, we return to the original value, e. g. , the egative of -5 is 5. Is the same true for taking the 2's complement of a binary number?
3. 3. 3 Most Significant Bit as a Sign Indicator A binary value with a 0 in the MSB position is considered positive and a binary value with a 1 in the MSB position is considered negative
3. 3. 4 Signed Magnitude (正負號位元表示法)
3. 3. 5 MSB and Number of Bits Since the MSB is necessary to indicate the sign of a binary value, it is vital that we know how many bits a particular number is being represented with so we know exactly where the MSB is. 以下位元串到底代表甚麼數字呢?
3. 3. 6 Issues Surrounding the Conversion of Binary Numbers 2 補數正數轉為十進位 2 補數負數轉為十進位
3. 4 Floating Point Binary (浮點數的二進位表示法)
指數 10 n 2 n
3. 5 Hexadecimal Addition (16 進位加法)
3. 7 Multiplication and Division by Powers of Two
用移位代替乘法 Since a shift operation is significantly faster than a multiply or divide operation, compilers will always substitute a shift operation when a program calls for a multiply or divide by a power of two. 但在右移時必需注意 MSB 的填入值
3. 8 Easy Decimal to Binary Conversion Trick 將 15610 轉為二進位 所以 15610 的 2 進位為 10011100
3. 9 Arithmetic Overflow (溢位) 20010 = 1 1 0 0 0 17510 = 1 0 1 1 20010 + 17510 溢位
- Slides: 34