- Sign-magnitude Representation
- Left most bit is sign bit.
- 0 means positive
- 1 means negative
- Rarely used
- Two's complement representation
- Benefits
-
- One representation of zero
- Arithmetic works easily
- Conversion between lengths: left pack sign bit
- 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
-
- Division
- Negative numbers division
-
- 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.
- 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
Chapter 9 Computer Arithmetic
最新推荐文章于 2021-07-20 04:26:08 发布