Thread: Floating point manipulation

  1. #1
    Registered User
    Join Date
    Mar 2013

    Exclamation Floating point manipulation

    I am having trouble understanding the mantissa of a floating point number. I have divided up the floating point number into the sign bit, the exponent and the mantissa, I have found the exponent, but I am not sure what to do with the mantissa? From what I have gathered so far i divide the mantissa by ten until I get a number between 1 and 10. after that i convert the number into a decimal with everything after the decimal point (or radix) being a fractional number. But when I do that on paper I dont get my intended number. How do i put the exponent and mantissa together to make a decimal from my floating point?

    ex. input is 00111010000111111111011000001000
    sign is 0
    exponent is 01110100 which is 64+32+16+4-127=-11
    mantissa is
    00111111111011000001000 which would be 1.11111111011000001
    when i convert that i get 1.99756622314 i dont know what to do with the -11 exponent and the answer i want is 6.1e-4

    thank you in advance!!

  2. #2
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    New Zealand
    mantissa is 00111111111011000001000 which would be 1.11111111011000001
    Wrong. The significand has an implicit leading 1. Thus it is 1.00111111111011000001. Then the un-biased exponent of -11 means that the decimal point shifts left 11 places, giving: 0.0000000000100111111111011000001.
    Then to get the decimal digits out of that, you multiply by 10 in this case, not divide because you are dealing with the part right of the decimal point, until you have something left of the decimal point which becomes your decimal digit each time.

    Any further questions of comments - post your code.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. floating point in c
    By pathak in forum C Programming
    Replies: 5
    Last Post: 10-27-2012, 11:35 PM
  2. Floating point
    By anirban in forum C Programming
    Replies: 4
    Last Post: 08-16-2007, 07:11 AM
  3. floating point value
    By twans in forum C++ Programming
    Replies: 9
    Last Post: 04-07-2005, 08:55 AM
  4. fixed point / floating point
    By confuted in forum Game Programming
    Replies: 4
    Last Post: 08-13-2002, 01:25 PM
  5. Floating point faster than fixed-point
    By VirtualAce in forum A Brief History of
    Replies: 5
    Last Post: 11-08-2001, 10:34 PM

Tags for this Thread