Two's complement Find -50 Compute +50 -128 64 32 16 8 4 2 1 0 0 1 1 0 0 1 0 = 50 ============================= 1 1 0 0 1 1 0 1 reverse bits (1's complement) +1 add one ---------------------------- 1 1 0 0 1 1 1 0 = -50 in two's complement Base 2 addition 0 1 0 1 +0 +0 +1 +1 --- --- --- --- 0 1 1 10 1 Example: 1 0 1 1 0 1 1 1 0 +1 0 0 1 1 0 1 1 0 --- ---------------------- 11 1 0 1 0 0 1 0 0 Floating Point -5.33333 * 10^-6 = -.0000053333 The Mantissa of a Normalized Floating Point Number -1 < N < 1 -5.3333 * 10^-6 = -.53333 * 10^-5 In Base 2 we only have 0s and 1s. Therefore numbers look like -.00101011 * 2^-3 = -.00000101011 A normalized floating point base 2 number's mantissa begins with 1. -.00000101011 = -.101011 * 2^-5 Since the first bit is ALWAYS 1, it need not be stored. What we store is Mantissa = 010110, sign = -1 and exponent -5 The first 1 bit is the "hidden bit". Next we must know how many bits are allocated to 1. The mantissa 2. exponent Let's consider the number 2,000,000,000 which is approx. 2^31 stored as a floating point number. This is 1 * 2^31. Therefore the exponent of 2 must be 31. 31 = 11111 = 16+8+4++1 16 bit floating point representation COULD be (we'll make this up) Let's use 6 bits for the exponent. We must use one bit for the sign. That leaves 9 bits for the mantissa.