Question

(-128.4875) base 10 to Single-Precision IEEE 754

Converting (128.4875) base 10 to BINARY is: 1000 0000 . 0111 1100 1100 1100 1100...

The SCIENTIFIC NOTATION of the binary is: 1 . 0000 0000 1111 1001 1001 1001... x 2^7

The SIGN BIT is: 1 (1 bit)

The MANTISSA is 0000 0000 1111 1001 1001 100 (23 bits)

The EXPONENT is 7 + 127 = (134) base 10 = 1000 0110 (8 bits)

Checking my answer against an online converter:

http://s17.postimg.org/3pkw9glm7/mantissa.png

(not enough reputation to post in-line images)

I got everything BUT the last digit of the mantissa. What I did was I chopped off the first 23 digits after the point in the scientific notation.

I got a 0 where the converter got a 1. Why is this so?

Was it helpful?

Solution

Do not “chop” the bits. Round the bits being removed:

  • If the bits being removed are less than 10000…, just remove them.
  • If the bits being removed are more than 10000…, remove them and add 1 to the remaining bits.
  • If the bits being removed are exactly 10000…, remove them and add 1 to the remaining bits if their last bit is 1.

Thus:

  • 1011 0101 becomes 1011. (0101 is less than 1000….)
  • 1011 1010 becomes 1100. (1010 is more than 1000….)
  • 1011 1000 becomes 1100. (1000 is exactly 1000…, remaining bits are odd, so add one.)
  • 1010 1000 becomes 1010. (1000 is exactly 1000…, remaining bits are even, so do not add.)

(This is “round to nearest, ties to even”.)

Also, there is no mantissa in a floating-point number. The fraction portion is the significand. (A mantissa is logarithmic. A significand is linear.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top