Thread: Bit packing floating points

  1. #1
    Noob AnishaKaul's Avatar
    Join Date
    Jan 2010
    Location
    Gurgaon, India
    Posts
    115

    Bit packing floating points

    Little Endian machine
    Which 5 digits from this number should be packed in a char* ?
    Code:
    234.21234567
    Last edited by AnishaKaul; 10-01-2010 at 06:55 AM. Reason: Modified question

  2. #2
    Registered User
    Join Date
    Jul 2009
    Posts
    3

    float as it's packed into a 32/64-bit word

    To see how the number looks in 32/64-bit IEEE-754 floating-point format, take a look here:

    IEEE-754 Floating-Point Conversion from Floating-Point to Hexadecimal

    That might help you answer your question.


    The real answer to the question "Which 5 bits?" imo must be "every one of them."

    HTH

    -- pete
    Last edited by pete142; 10-01-2010 at 05:28 AM. Reason: expand answeer

  3. #3
    Noob AnishaKaul's Avatar
    Join Date
    Jan 2010
    Location
    Gurgaon, India
    Posts
    115
    Many thanks to you for the useful link.
    The question has been modified now. I hope it is clear now.

  4. #4
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Quote Originally Posted by AnishaKaul View Post
    Little Endian machine
    Which 5 digits from this number should be packed in a char* ?
    Code:
    234.21234567
    That makes as much sense as which 5 pieces of clothing should I pack in my suitcase.
    The answer to both of course being, whichever 5 you feel like.

    Endian: It's not clear that anything here has to do with endianness
    5 digits: Why would you want to pick exactly 5 of anything, where does the 5 come from? If you're supposed to only pick digits, then what's the dot for?
    packed: This could mean a bunch of different things as there are plenty of ways of "packing" things.
    char*: In other words a pointer. How is a pointer related to anything else here?

    Whilst each of these things could mean something useful in the right context, they don't actually come together to form a meaningful question here.
    Care to try again?
    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. How to Make This code more efficient
    By Soulzityr in forum C Programming
    Replies: 9
    Last Post: 04-12-2010, 01:29 AM
  2. Floating Point Addition
    By ggraz in forum C Programming
    Replies: 10
    Last Post: 10-12-2008, 12:29 PM
  3. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  4. 32 bit floating point multiplication
    By HelpMePlease in forum C Programming
    Replies: 1
    Last Post: 11-30-2004, 08:39 AM
  5. floating point binary program, need help
    By ph34r me in forum C Programming
    Replies: 4
    Last Post: 11-10-2004, 07:10 AM