Results 1 to 6 of 6

Thread: Conversion to binary to real

  1. #1
    Join Date
    Dec 2009
    Posts
    192

    Conversion to binary to real

    Hello,
    As part of a project compression, I have to implement an algorithm that can compress the given string. For that, I must convert real numbers to binary (using the IEEE standard I think, because unspecified). Is there a function in the API-made or should this be the same code? Any help on this is appreciated. Thanks in advance.

  2. #2
    Join Date
    Nov 2009
    Posts
    347

    Re: Conversion to binary to real

    Hello,
    To convert using the IEEE standard, it has the following methods:
    Code:
    - IntBitsToFloat (int)
    - FloatToIntBits (float value)
    I am not sure though with these methods. As I have not used them till now, I think you should use these methods in your program and see if they help and if you have any problem then post back with the query which you get.

  3. #3
    Join Date
    Nov 2008
    Posts
    240

    Re: Conversion to binary to real

    Hello,
    Even i want to convert this , I had used the following method in my code, but i think this was not successful
    Code:
    System.out.System.out.println(Double.doubleToLongBits(3.5));
    my reference was
    4615063418144915446
    while waiting:
    Code:
    01000000011000000001000100000000
    This is just the example and not the real one which is the out of the code. If you have any other method then this then please do post back.

  4. #4
    Join Date
    Nov 2009
    Posts
    518

    Re: Conversion to binary to real

    Hello,
    In fact, the method
    Code:
    Double.doubleToLongBits
    gives you a long. I think if you want to view, we must also dissect using & because the following bit will be converted into the number, then string and then give you a number. Why not directly use the & operator with a double? Because it is forbidden with the "double" and "float".

  5. #5
    Join Date
    Nov 2009
    Posts
    359

    Re: Conversion to binary to real

    Hello,
    If you add at the beginning of the 1st after 1 and 0 a 0, you have exactly 64 characters, then 64 bits. for the 2nd number, you have 32 characters, so a 32-bit number. As the double are 64 characters, I think 1 is more accurate. However, there may be a problem of little end and at the beginning of the string. In computing, for numbers of 32 bits (i.e 4 bytes), there may be as big end (high to: AABB), or as little end (low point before: BBAA), I think must be a similar system for 64-bit, but I do not know. Hope this information will help you.

  6. #6
    Join Date
    Nov 2009
    Posts
    347

    Re: Conversion to binary to real

    Hello,
    I have one question for you, the algorithm requires that I must take a certain number of digits after the decimal point And I see not too many commas, and finally how to define where it is. I think I am confused with your question , or your are not at the perfect target. What I mean is this
    Code:
    0101 , 1010 1010 0011 0011 1001
    If you want this result , then which method do you want in your code, is this what you are trying to ask?

Similar Threads

  1. binary and text conversion java
    By Ronguor in forum Software Development
    Replies: 1
    Last Post: 14-03-2012, 01:24 PM
  2. What are the Possible attacks of CGI binary in PHP?
    By warehouse peon in forum Software Development
    Replies: 5
    Last Post: 05-03-2010, 05:04 AM
  3. What are the different binary directories of Mac
    By Spiero in forum Operating Systems
    Replies: 5
    Last Post: 03-03-2010, 01:26 PM
  4. Standard binary conversion
    By Zool in forum Software Development
    Replies: 3
    Last Post: 04-12-2009, 12:07 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,752,125,719.76027 seconds with 16 queries