I’m stuck on an assignment question.
The question is:
Convert the following decimal numbers 2,147,483,775 and 2,147,483,648 into their IEEE 754 single-precision floating-point number. Explain your result.
Starting with 2,147,483,648, I’ve converted it to binary giving,
10000000000000000000000000000000
Normalised it giving
1.0000000000000000000000000000000 x 2^31
added 127 to the exponent for the bias
the bias = 152 = 10011110 (in bin)
the number is positive so a 0 sign bit. I’ve removed the assumed leading 1 from the normalised number.
I make it that 2,147,483,648 = 01001111000000000000000000000000 in ieee 754 single precision.
But, when I use http://www.h-schmidt.net/FloatConverter/IEEE754.html an online converter, I get the correct binary answer but the hex equivilent is different. The converter says 0x4f000000 but the question says (0x80000000).
I’m doing an online degree which basically means, you’re given a reading list, assignments and exam timetables but no help when you’re as confused as I am! I think I’ve over-thought it all as all of the reading I’ve done was for converting decimal fractions into single-p numbers and not large integers.
Have I got the correct result?
Should I ignore the hex? I didn’t use the hex in my working. I went straight from decimal number to binary.
Thanks
Mike