In: Computer Science
1. Represent following floating-point numbers in IEEE single-precision (32-bit) format: a. -0.1875, b. 0.46875
2. What is the decimal value of the following IEEE single-precision (32-bit) floating-point numbers (which are shown in hexadecimal)? a. 3F400000, b. BE000000
1) a) -0.1875 in simple binary => .0011 so, -0.1875 in normal binary is .0011 => 1.1 * 2^-3 single precision: -------------------- sign bit is 1(-ve) exp bits are (127-3=124) => 01111100 frac bits are 10000000000000000000000 so, -0.1875 in single-precision format is 1 01111100 10000000000000000000000 in hexadecimal it is 0xBE400000 b) 0.46875 in simple binary => .01111 so, 0.46875 in normal binary is .01111 => 1.111 * 2^-2 single precision: -------------------- sign bit is 0(+ve) exp bits are (127-2=125) => 01111101 frac bits are 11100000000000000000000 so, 0.46875 in single-precision format is 0 01111101 11100000000000000000000 in hexadecimal it is 0x3EF00000 2) a) 0x3F400000 0 01111110 10000000000000000000000 sign bit is 0(+ve) exp bits are 01111110 => in decimal it is 126 so, exponent/bias is 126-127 = -1 frac bits are 1 Decimal value is 1.1 * 2^-1 1.1 in decimal is 1.5 1.1 * 2^-1 in decimal is 0.75 so, 3F400000 in IEEE-754 single precision format is 0.75 Answer: 0.75 b) 0xBE000000 1 01111100 00000000000000000000000 sign bit is 1(-ve) exp bits are 01111100 => in decimal it is 124 so, exponent/bias is 124-127 = -3 frac bits are Decimal value is 1. * 2^-3 1. in decimal is 1 1. * 2^-3 in decimal is -0.125 so, BE000000 in IEEE-754 single precision format is -0.125 Answer: -0.125