Chapter 9 Computer Arithmetic

来源:互联网 发布:淘宝商城天猫首页 编辑:程序博客网 时间:2024/04/30 04:50
  1. Sign-magnitude Representation
    • Left most bit is sign bit.
    • 0 means positive
    • 1 means negative
    • Rarely used
  2. Two's complement representation
    • Benefits
      • One representation of zero
      • Arithmetic works easily
  3. Conversion between lengths: left pack sign bit
  4. Multiplication
    •                                                  
    • Multiplying negative numbers
      • Solution 1
        • Convert to positive if required
        • Multiply as above
        • If signs were different, negate the answer
      • Solution 2
        • Booth's algorithm
  5. Division
    • Negative numbers division
  6. Floating point representation
    • Principle:  ±S*B ±E
      • E: exponent, in computer, usually biased representation
        • ±S*BE'
        • Typically, the bias = 2^(k-1) - 1. Exponent value = true exponent + bias
        • Thus, stored exponent value is unsigned.
  7. Floating-point arithmetic
    • Add/Subtract
      • Align significands(Adjusting exponents)
        • Shifting the radix point on the smaller operand
        • Once the overflow occurs, the influence is smaller
0 0
原创粉丝点击