Search code examples
binarynumbers32-bitieee-754ieee

Convert the Number to binary using IEEE 754 standard (32-bits)


I am trying to convert the number -11.25 to binary using IEEE 754 standard 32- bits.

This is what i got so far:

-11.25 = 1011.0100

1.0110100 * 2^3 3 + 127 = 130

= 1.0110100 * 2130

IEEE 754 standard = 1 10000010 1011010...0

I think that my answer is wrong but i can't figure out were.


Solution

  • Since i will assume you already know the Standard we can convert as following ,

    Convert your number to base 2

    1011.01000 Shift this binary number

    1.01101000

    2**3 (shifted by 3)

    add exponent 127+3=130

    convert 130 to binary format 10000010

    And so we have sign * 2^exponent * mantissa

    Sign which is obviously negative here , so the sign bit will be 1

    2^3 (since 3 was your exponent and it will result 130 that we convert to binary) will be 10000010

    and the mantissa here will be 01101000000000000000000

    your final result is 1|10000010|01101000000000000000000