Microprocessor and Computer Architecture

⌘K
  1. Home
  2. Docs
  3. Microprocessor and Comput...
  4. Computer Arithmetic
  5. Addition and Subtraction

Addition and Subtraction

Here is the detailed explanation of Addition and Subtraction:

Group 14
  • If A>B, use the sign of A
  • If A<B, use the sign of B
  • If A=B, subtract B from A and make the sign positive
Screenshot 2024 03 22 173859
Screenshot 2024 03 22 174005
Screenshot 2024 03 22 174632

During addition or subtraction, the two floating-point operands are kept in AC and BR. The sum or difference is formed in the AC.

The algorithm can be divided into four consecutive parts:

  • Check for zeros.
  • Align the mantissas.
  • Add or subtract the mantissas
  • Normalize the result

• A floating-point number cannot be normalized, if it is 0. If this number is used for computation, the result may also be zero. Instead of checking for zeros during the normalization process we check for zeros at the beginning and terminate the process if necessary. The alignment of the mantissas must be carried out prior to their operation. After the mantissas are added or subtracted, the result may be un-normalized. The normalization procedure ensures that the result is normalized before it is transferred to memory.

• If the magnitudes were subtracted, there may be zero or may have an underflow in the result. If the mantissa is equal to zero the entire floating-point number in the AC is cleared to zero. Otherwise, the mantissa must have at least one bit that is equal to 1. The mantissa has an underflow if the most significant bit in position A1, is 0. In that case, the mantissa is shifted left and the exponent decremented. The bit in A1 is checked again and the process is repeated until A1 = 1. When A1 = 1, the mantissa is normalized and the operation is completed.

Screenshot 2024 03 22 175530

How can we help?

Leave a Reply

Your email address will not be published. Required fields are marked *