#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Location
    Manila, Philippines
    Posts
    32
    Rep Power
    2

    Decimal to IEEE 754


    I have found this video:
    Code:
    http://www.youtube.com/watch?v=MIrQtuoT5Ak
    Around mark 2:01-2:04, the mantissa was converted to 1.1010011 x 2^3, but for the mantissa, only the fraction part was taken, which is 1010011.

    What happened to the integer 1? Why was it dropped?
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,957
    Rep Power
    1046
    Because the mantissa of normal numbers always starts with a 1. Storing it would waste one bit and reduce the range of possible numbers.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Location
    Manila, Philippines
    Posts
    32
    Rep Power
    2
    Originally Posted by Jacques1
    Because the mantissa of normal numbers always starts with a 1. Storing it would waste one bit and reduce the range of possible numbers.
    Thank you for that.

    So, we have this homework:
    (-128.4875) base 10 to Single-Precision IEEE 754

    Following the video tutorial, I did the following:

    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:
    Code:
    http://s17.postimg.org/3pkw9glm7/mantissa.png
    I got everything, BUT the last digit of the mantissa. What I did was I took 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?

IMN logo majestic logo threadwatch logo seochat tools logo