In: Computer Science
What base 10 number (using powers of 10 if using scientific notation) is
represented by the following IEEE 754 hexadecimal representation?
a. 40 70 00 00
b. FF E4 00 00
c. 80 20 00 00
a) 40 70 00 00 Hexadecimal Binary 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 A 1010 B 1011 C 1100 D 1101 E 1110 F 1111 Use this table to convert from hexadecimal to binary Converting 40700000 to binary 4 => 0100 0 => 0000 7 => 0111 0 => 0000 0 => 0000 0 => 0000 0 => 0000 0 => 0000 So, in binary 40700000 is 01000000011100000000000000000000 0 10000000 11100000000000000000000 sign bit is 0(+ve) exp bits are 10000000 Converting 10000000 to decimal 10000000 => 1x2^7+0x2^6+0x2^5+0x2^4+0x2^3+0x2^2+0x2^1+0x2^0 => 1x128+0x64+0x32+0x16+0x8+0x4+0x2+0x1 => 128+0+0+0+0+0+0+0 => 128 in decimal it is 128 so, exponent/bias is 128-127 = 1 frac bits are 111 IEEE-754 Decimal value is 1.frac * 2^exponent IEEE-754 Decimal value is 1.111 * 2^1 1.111 in decimal is 1.875 => 1.111 => 1x2^0+1x2^-1+1x2^-2+1x2^-3 => 1x1+1x0.5+1x0.25+1x0.125 => 1+0.5+0.25+0.125 => 1.875 so, 1.875 * 2^1 in decimal is 3.75 so, 01000000011100000000000000000000 in IEEE-754 single precision format is 3.75 Answer: 3.75 b) FF E4 00 00 Converting FFE40000 to binary F => 1111 F => 1111 E => 1110 4 => 0100 0 => 0000 0 => 0000 0 => 0000 0 => 0000 So, in binary FFE40000 is 11111111111001000000000000000000 1 11111111 11001000000000000000000 sign bit is 1(-ve) exp bits are 11111111 Exp bits are all 1. so, this is infinite. since sign bit is 1. this is -Infinite Answer: -Infinite c) 80 20 00 00 Converting 80200000 to binary 8 => 1000 0 => 0000 2 => 0010 0 => 0000 0 => 0000 0 => 0000 0 => 0000 0 => 0000 So, in binary 80200000 is 10000000001000000000000000000000 1 00000000 01000000000000000000000 sign bit is 1(-ve) exp bits are 00000000 Converting 00000000 to decimal 00000000 => 0x2^7+0x2^6+0x2^5+0x2^4+0x2^3+0x2^2+0x2^1+0x2^0 => 0x128+0x64+0x32+0x16+0x8+0x4+0x2+0x1 => 0+0+0+0+0+0+0+0 => 0 in decimal it is 0 so, exponent/bias is 0-127 = -127 frac bits are 01 IEEE-754 Decimal value is 1.frac * 2^exponent IEEE-754 Decimal value is 1.01 * 2^-127 1.01 in decimal is 1.25 => 1.01 => 1x2^0+0x2^-1+1x2^-2 => 1x1+0x0.5+1x0.25 => 1+0.0+0.25 => 1.25 so, 1.25 * 2^-127 in decimal is 7.346839692639297e-39 so, 10000000001000000000000000000000 in IEEE-754 single precision format is -7.346839692639297e-39 Answer: -7.346839692639297e-39 (Note, this is very very close to zero)