Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Representing (0.5)in IEEE754 format

Options
  • 11-08-2005 1:58pm
    #1
    Registered Users Posts: 641 ✭✭✭


    Ok so this is what my notes tell me..
    • Example: Show the IEEE 754 binary
    representatoin of the number 0.5 in single percision
    • This is equivalent to 1.0 × 2−1 in normalised
    binary scientific notation
    • Thus, the fraction is 00000 . . . 000 (i.e. we
    ignore the “1.” in the significand)
    • The sign is positive, which is 0
    • The exponent is
    −1 + 127 = 12610 = 011111102
    • We can now put it all together
    An Example Conversion
    • Thus the IEEE floating-point formatted number
    for 0.510 is
    00111111000000000000000000000000
    which, formatted differently, is
    0011 1111 0000 0000 0000 0000 0000 0000
    • We can also express this as
    3F00000016
    • Also, 0.5, 1.0 and 1.5 are represented
    in hexadecimal as 3F000000, 3F800000,
    3FC00000, respectively.

    What i can't understand is how you get the fraction if anyone can help it would be greatly appreciated
    Cheers
    Gav


Comments

  • Registered Users Posts: 190 ✭✭pan


    The basic algorithm is:
    to convert fractional part, repeatly multiply the fractional part by 2
    and note the whole part until zero is reached.

    E.g. 5.8125 Fractional decimal number (base 10)
    the integer 5 = 101 in binary (easy part)

    For the fractional part 0.8125
    2*0.8125 = 1.625 keep the 1 and use the 0.625
    2*0.625 = 1.25 keep the 1 and use the 0.25
    2*0.25 = 0.5 keep the 0 and use the 0.5
    2*0.5 = 1.0 keep the 1 and use the 0.0
    2*0.0 = 0.0 keep the 0 and use the 0.0
    etc... for the required number of fractional bits (e.g mantissa should 23 bits long for IEEE 754)

    put it together
    101.1101000000000000... a fractional binary number

    Good luck!

    pan


  • Registered Users Posts: 641 ✭✭✭Dimitri


    Ah, thanks the penny has finally dropped cheers pan much appreciated!


  • Closed Accounts Posts: 79 ✭✭Newb


    I wrote this to demonstrate:
    http://www.tuxpages.com/math/ieee754.shtml


  • Closed Accounts Posts: 79 ✭✭Newb




Advertisement