In: Computer Science
Convert 1.8125 to IEEE-754 representation. Show all your work.
1.8125 in IEEE-754 single precision binary format is 00111111111010000000000000000000 sign bit: 0 exponent bits: 01111111 mantissa bits: 11010000000000000000000 Explanation: ------------- 1.8125 Converting 1.8125 to binary Convert decimal part first, then the fractional part > 1 in binary is 1, simple! > Now, Convert 0.81250000 to binary > Multiply 0.81250000 with 2. Since 1.62500000 is >= 1. then add 1 to result > Multiply 0.62500000 with 2. Since 1.25000000 is >= 1. then add 1 to result > Multiply 0.25000000 with 2. Since 0.50000000 is < 1. then add 0 to result > Multiply 0.50000000 with 2. Since 1.00000000 is >= 1. then add 1 to result > This is equal to 1, so, stop calculating 0.8125 of decimal is .1101 in binary so, 1.8125 in binary is 1.1101 1.8125 in simple binary => 1.1101 so, 1.8125 in normal binary is 1.1101 => 1.1101 * 2^0 => 1(.1101 this is the fractional part) * 2^(127+0 this is the exponent bits) single precision: -------------------- sign bit is 0(+ve) exponent bits are (127+0=127) => 01111111 Divide 127 successively by 2 until the quotient is 0 > 127/2 = 63, remainder is 1 > 63/2 = 31, remainder is 1 > 31/2 = 15, remainder is 1 > 15/2 = 7, remainder is 1 > 7/2 = 3, remainder is 1 > 3/2 = 1, remainder is 1 > 1/2 = 0, remainder is 1 Read remainders from the bottom to top as 1111111 So, 127 of decimal is 1111111 in binary frac/significant bits are 11010000000000000000000 so, 1.8125 in single-precision format is 0 01111111 11010000000000000000000