Thread: Binary conversion..

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    83

    Binary conversion..

    Dear All,
    i have doubt in floating point conversion to Binary...my problem is:-
    [code]
    5.62------binary is------->00000101.101000 (weather i am right?)
    00000101.101000>>8----> what is result?(right shift)
    [\code]

  2. #2
    Technical Lead QuantumPete's Avatar
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    894
    Firstly, code tags use a forward slash /
    Secondly, what's your question here? How floats are represented in binary? What happens when you right shift a float?
    Be a bit more specific about what you want to know.

    QuantumPete
    "No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
    "Have you tried turning it off and on again?" - The IT Crowd

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    5.62 is not representable in binary notation without using a repeating decimal (you have 5 and 5/8, or 5.625).

    If you're asking how that number is stored inside your computer, well, not like that (look up IEEE floating point if you really want to know).

    I know of no context when (floating point thing) >> 8 makes any sense whatsoever.

  4. #4
    Registered User
    Join Date
    Jul 2008
    Posts
    26
    Quote Originally Posted by shwetha_siddu View Post
    Dear All,
    i have doubt in floating point conversion to Binary...my problem is:-
    Code:
    5.62------binary is------->00000101.101000 (weather i am right?)
    That depends, what implementation are you using to store that number? There's more than one way to store a fractional number.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  2. binary decimal conversion
    By eerok in forum C Programming
    Replies: 2
    Last Post: 01-24-2006, 09:51 PM
  3. Header File Question(s)
    By AQWst in forum C++ Programming
    Replies: 10
    Last Post: 12-23-2004, 11:31 PM
  4. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  5. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM