Presentation is loading. Please wait.

Presentation is loading. Please wait.

Negative Numbers An alternative way to find the 2's complement Starting at the right 1. Copy bits until you reach the first 1. 2. Flip all the remaining.

Similar presentations


Presentation on theme: "Negative Numbers An alternative way to find the 2's complement Starting at the right 1. Copy bits until you reach the first 1. 2. Flip all the remaining."— Presentation transcript:

1 Negative Numbers An alternative way to find the 2's complement Starting at the right 1. Copy bits until you reach the first 1. 2. Flip all the remaining bits. 0 0 1 1 1 0 (14)1 1 0 0 1 0 (-14) 1 1 0 0 1 0 (-14)0 0 1 1 1 0 (14)

2 Floating Point Numbers Positional Notation Redux 2 3 2 2 2 1 2 0. 2 -1 2 -2 2 -3 8 4 2 1. ½ ¼ ⅛ Thus 101.101 = 4 + 1 + ½ + ⅛ = 5⅜ And 10.011 +100.11_ 110.111

3 Floating Point Numbers Another Darn Notation Excess value notation E.g. with 3 bits we can represent 8 things, the excess value is half of that or 4. The idea is that the number that you see appears 4 greater than it really is!!??? Thus000(0) -> -4 011(3) -> -1 100(4) -> 0 111(7) -> 3

4 Floating Point Numbers So how is 101.101 2 (5⅜ 10 ) actually stored. In a way similar to scientific notation. For example, we might store 5⅜ in scientific notation as follows: +0.5375 x 10 1 where the important parts are exponent (excess 4) [e below] fractional part (mantissa) [m] sign [s] Now in the computer we have s eee mmmm for 8 bits and 101.101 -> +0.101101 x 2 3 -> 0 111 1011 truncation error

5 Floating Point Numbers Decode the following 8 bit representation of a floating point number. 101010111 – sign bit -> negative 010 – exponent -> -2 -0.1011 x 2 -2 or excess 4-0.001011 2 Now, -0.001011 2 = -(2 -3 + 2 -5 + 2 -6 ) or = -(0.125 +.03125 + 0.015625) = -0.171875

6 Floating Point Numbers Encode the following number as an 8 bit representation of a floating point number. 3 = 3.15625 now consider 0.15625 < 2 -1 and 2 -2 so subtr. 2 -3 -0.125 which leaves 0.03125 < 2 -4 so subtr. 2 -5 -0.03125 which leaves 0.00000 Thus 3.15625 10 = 11.00101 2 = +0.1100101 x 2 2 The exponent 2 is 110(6) in excess 4 notation The final form is 01101100


Download ppt "Negative Numbers An alternative way to find the 2's complement Starting at the right 1. Copy bits until you reach the first 1. 2. Flip all the remaining."

Similar presentations


Ads by Google