If the numbers being added are of opposite signs then an overflow will never

If the numbers being added are of opposite signs then

This preview shows page 22 - 33 out of 49 pages.

If the numbers being added are of opposite signs, then an overflow will never occur. As an alternative method of detecting overflow for addition, an overflow occurs if and only if the carry into the sign bit differs from the carry out of the sign bit. 22
Image of page 22
Cont… Consider adding (+80)10 and (+50)10 using an eight bit format. The result should be (+130)10, however, as shown below, the result is (- 126)10: + 0 1 0 1 0 0 0 0 (+80)10 + 0 0 1 1 0 0 1 0 (+50)10 ——————— + 1 0 0 0 0 0 1 0 (-126)10 This should come as no surprise, since we know that the largest positive 8-bit two’s complement number is +(127)10, and it is therefore impossible to represent (+130)10. Although the result (10000010)2 “looks” like (130)10 if we think of it in unsigned form, the sign bit indicates a negative number in the signed form, which is clearly wrong. 23
Image of page 23
24 Exercise Determine the decimal value represented by 10001011 in each of the following four systems. 1. Unsigned notation? 2. Signed magnitude notation? 3. One’s complement 4. Tow’s complements?
Image of page 24
25 2.4.2 Fraction Representation To represent fraction we need other representations: Fixed point representation Floating point representation.
Image of page 25
26 2.4.2.1 Fixed-Point Representation old position 7 6 5 4 3 2 1 0 New position 4 3 2 1 0 -1 -2 -3 Bit pattern 1 0 0 1 1 . 1 0 1 Contribution 2 4 2 1 2 0 2 -1 2 -3 =19.625 Radix-point
Image of page 26
27 Limitation of Fixed-Point Representation To represent large numbers or very small numbers we need a very long sequences of bits. This is because we have to give bits to both the integer part and the fraction part.
Image of page 27
28 Floating Point -15900000000000000 could be represented as - 15.9 * 10 15 - 1.59 * 10 16 A calculator might display 159 E14 - 159 * 10 14 Sign Exponent Base Mantissa
Image of page 28
29 M B E Sign mantissa or base exponent significand Floating point format Sign Exponent Mantissa
Image of page 29
30 Example 32 bit floating representation The number will occupy 32 bits The first bit represents the sign of the number; 1= negative 0= positive. The next 8 bits will specify the exponent The remaining 23 bits will carry the mantissa normalised to be between
Image of page 30
Normalization A potential problem with representing floating point numbers is that the same number can be represented in different ways, which makes comparisons and arithmetic operations difficult. For example, consider the numerically equivalent forms shown below: 3584.1 × 100 = 3.5841 × 103 = .35841 × 104. In order to avoid multiple representations for the same number, floating point numbers are maintained in normalized form. That is, the radix point is shifted to the left or to the right and the exponent is adjusted accordingly until the radix point is to the left of the leftmost nonzero digit. So the rightmost number above is the normalized one. Unfortunately, the number zero cannot be represented in this scheme, so to represent zero an exception is made. The exception to this rule is that zero is represented as all 0’s in the mantissa 31
Image of page 31
If the mantissa is represented as a binary, that is, base 2, number, and if the normalization condition is that there is a leading “1” in the normalized mantissa, then there is no need to store that “1” and in fact, most floating point formats do not store it. Rather, it is “chopped off ” before packing up the number for storage, and it is restored when unpacking the number into exponent and mantissa.
Image of page 32
Image of page 33

You've reached the end of your free preview.

Want to read all 49 pages?

  • Fall '19
  • Binary numeral system, Decimal, mantissa

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes