# Problem in finding the floating point representation?

So, i was trying:

$(-10.75)_{10}$ and to convert it into 32 bit binary floating point representation.

i did this:
According to IEEE standard: $(-1)^{-s} * 1.M * 2^{E-bias}$

 sign bit= 1 bit
exponent= 8 bits
mantissa= 23 bits


bias= $2^{n-1}-1 = 127$

  - 10   . 75
⇓  ⇓      ⇓
= 1 1010 . 11
= 1 1.01011 x 2^-3
= 1 1.01011 x 2^(124-127)
= 1 01111100 0101100 0000 0000 0000 0000   = 32 bits
⇓ ________ ____________________________
⇓    ⇓                  ⇓
sign  Exponent         Mantissa


But the answer presented is:

  - 10   . 75
⇓  ⇓      ⇓
= 1 1010 . 11
= 1 1.101011 x 2^-4
-------> why this happened, and why is 1 before '.'
= 1 1.101011 x 2^(123-127)
= 1 01111011 1010110 0000 0000 0000 0000   = 32 bits
⇓ ________ ____________________________
⇓    ⇓                  ⇓
sign  Exponent         Mantissa


If i am wrong, where is it and please explain why.. Any help is appreciated.

Both answers seem wrong to me. A quick conversion in C++:

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <stdint.h>

int main (void)
{
float x = -10.75;
uint32_t* p = (uint32_t*)&x;
printf("%x\n",*p);

return 0;
}


Gives the output: c12c0000

Which is 1 10000010 010110000…

Your mantissa calculation is the correct one, but the binary exponent is +3, not -3 (that is, your number is greater than 1, not less than 1). In bias-127, that exponent becomes 130 (decimal).

• How does this code help in seeing what the conceptual mistake is? – Raphael Mar 15 '14 at 11:25
• It doesn't, but it was what I used to confirm the correct answer and thereby work out what the OP's problem was. – Russell Borogove Mar 16 '14 at 4:43
  - 10   . 75
⇓  ⇓      ⇓
= 1 1010 . 11                              (1)
= 1 1.01011 x 2^3                          (2)
= 1 10000010 0101100 0000 0000 0000 0000   (3)
⇓ ________ ____________________________
⇓    ⇓                  ⇓
sign  Exponent         Mantissa


(1):

• sign is -, so first bit is 1.
• 10 converted to binary is 1010
• 0.75 converted to binary is 0.11

(2):

• signbit is still 1
• 1010.11 x 2^0 = 1.01011 x 2^3

(3):

• signbit is still 1
• exponent is 3, bias is 127, so we convert 127+3=130 as 10000010
• we copy everything after the decimal point into the mantissa and padd with 0's.

As to your questions

why this happened, and why is 1 before '.'

• No idea why it says exponent -4, clearly it has to be 3.
• In scientific notation there is always exactly one digit in front of the decimal point and it is never a 0. So in binary decimal notation there is always a 1 in front of the decimal point. And just because there is always a 1, we don't need to include that in our representation. That's why the mantissa only consists of the part after the decimal point.