Converting a double to binary

Hey all,
I am having difficultly trying to devise a simple method for converting a double to its binary representation. The value that I am dealing with is ~10^32, so I cannot use int or long. Any advice/suggestions would be appreciated. Shanks.

prometheuzz wrote:
Boojum317 wrote:
Value = 711051181013210910132971103265
Calculated binary = 100011000100001111100110000111110000000110000000100101001101011
Value of calculated binary = 5.0535875047965512E18I am not checking your numbers, but I suspect you are confused how a floating point is represented in a binary notation. This is different than an integer value.
Read the link that was posted earlier in your thread.Indeed.
Long.toBinaryString(Double.doubleToLongBits(1.0))
gives
11111111110000000000000000000000000000000000000000000000000000which is correct.

Similar Messages

  • How to convert numeric data to binary decimal in java

    How to convert numeric data to binary decimal in java Pleas egive me code example

    There is no numeric data. It's all binary. If you're talking about Strings, look at the Integer class.

  • How to convert   (pdf raw data) binary to (bitmap/TIFF) image.

    Dear gurus,
    I'm facing a problem to converting my raw data(binary), which i got from my uploaded PDF file.  I try a few methods from SDN itself to make the raw file can be download to my local PC as images.
    I already try to download the raw data, directly using FM GUI_DOWNLOAD, even though it is successfully downloaded to my local drive, but the file still cannot be opened. I debug a few program, which is use to download the bitmap inside the SAP directories to local directory but when i compared both debug data it's something differently written.
    Is there any other way for me to solve this problem? It's there the a way for me to convert the PDF's raw data into bitmap first, before change convert them to binary and download them to my local drive?
    Helping is a rewards. Thanks a lot.
    Edited by: muhamad husin on Mar 25, 2008 5:55 AM

    HI,
    Try this Standard program
    RSTXLDMC  -->    Uploading TIFF Files to SAPscript Texts
    Regrads,
    S.Nehru

  • How can i convert a double to float

    double gallons;
    double startOdometer;
    double endOdometer;
    double mpg;
    double miles;
    endOdometer = Double.parseDouble (inputs);
    miles = endOdometer - startOdometer;                                                                 
    mpg = (miles/gallons) ;
    gallons = miles/mpg;
    mpg = Float.parseFloat(double);

    You would use a cast.
    double d = 1.4;
    float f = (float) d;But why do you want to convert a double into a float and then store it back into a double?????

  • How to convert PDF file into binary using APIs of Adobe Workflow server?

    I m using the Adobe Workflow Server 6.2. I want to write a web services to convert PDF file into binary and embed this binary data with XML.
    I want to use the APIs (or libraries) of Adobe Workflow server but dont know abt the APIs or Libraries that can convert the PDF file into binary format.
    I will be very thankful to u,if u can help me as i m n this prblm frm the last one week.I tried alot but could nt find the solution.
    waiting for a better response.

    check objectlibrary.pdf
    Dim o As New EPSDK.BinaryData
    o.LoadFromFile(sfilename)
    write o.Value to xml

  • Do anyone know how to convert a decimal to binary, 1 into 01

    do anyone know how to convert a decimal to binary
    i wants to convert 1 into 01, but the computer print out 1, it didn't print 0
    also 0 it also print only 0, and 3 it print11
    so decimal of 3, the computer print correct, but 0 and 1 it print wrong
    how can i print 01 if my decimal is 1
    int a=1;
    System.out.print(Integer.toBinaryString(a));
    can anyone help me solve this question
    and
    you can use java or jsp
    if you can use jsp it would be better, if not use java

    it's not printing anything 'wrong'.
    0 in binary is 0
    1 in binary is 1
    All it's doing is cutting off leading zeros since they don't change the value.
    1 is the same as 01 is the same as 00000001...no difference
    Similarly, when you print decimal 3 as 11, it could just as easily say 00000011 and be correct, since the zeros don't change anything.

  • How to convert TIF image to Binary internal table.

    How to convert TIF image to Binary internal table

    Hi,
    this forum is for the SAP Integration Kit.
    I would first of all suggest you describe your problem in more details as you are not even describing which products you are using and second I would suggest you post it into the correct forum.
    regards
    Ingo Hilgefort

  • Converting a Double To A String

    Is it possible to convert a double to a string. I need to retrieve a double value from an array and display it as a label in an applet.
    How do I convert the double value to a string so that I can use it in the applet as a label?
    Thanks

    try this.
    double mydbl = 0;
    String mystr = null;
    mysstr=mydbl+"".trim();
    Paulthis one is nice paul, but it is also possible to do it that way:
    double d = 0;
    String dStr = Double.toString(d);see also API for classes Boolean, Character, Integer, Byte, Float, Short
    all primitives can easyli be turned int for in which you can print them out.

  • How can I convert a double to string

    Hello,
    how can I convert a double value to a string value?
    Werner

    an other way: ;)
    double yourDouble;
    int intTmp;
    yourDouble = yourDouble * 100;
    yourDouble = yourDouble + 0.5;
    intTmp = yourDouble.intValue();
    yourDouble = intTmp;
    yourDouble = yourDouble / 100;you can write it some shorter...
    double yourDouble;
    int intTmp;
    yourDouble = yourDouble * 100 + 0.5;
    yourDouble = yourDouble.intValue() / 100;*100 moves the comma about two steps to the left.
    + 0.5 enables rounding!
    if your value is x.5 or larger you get x+1.?
    if its smaller than x.5 you get x.?
    by parsing the double value to an int the ? is cut.
    /100 moves the comma two steps back
    you get a double value with 2 decimals which is rounded.
    just my coins :)
    happy progging,
    Thof

  • How do i convert a double array (with spaces and tabs) to a string?

    Hi
    In our files, we have a mixture of spaces and tabs as a delimeter. How do I convert a double array into a string?
    Thank you.

    Not sure about the last part of your question.
    The Search and Replace pattern can be better than the simple Search and Replace string when you have to do complex searchs, such as detecting multiple spaces.
    Have a look at the attachment.
    CC
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    ReplaceSpaces.vi ‏27 KB

  • Is it possible to convert ascii data in binary?

    Hi all.
    In my one table there is a column which contains ascii value. i want to convert it in binary. It it possible in oracle?
    eg field value:1250ÿ it should be 125011111111
    kindly tell how to do this.
    i have tried this using a simple java program but doesnot work for some ascii values.
    thank you

    I created two functions :
    create or replace FUNCTION dec2bin (N IN NUMBER) RETURN VARCHAR2 IS
    binval VARCHAR2(64);
    N2 NUMBER := N;
    BEGIN
    WHILE ( N2 > 0 ) LOOP
    binval := MOD(N2, 2) || binval;
    N2 := TRUNC( N2 / 2 );
    END LOOP;
    RETURN binval;
    END dec2bin;
    And other :
    create or replace function to_ascii( inSource IN VARCHAR2 )
    return varchar2 AS
    ResultString varchar2(381); -- 3 * possible length of source
    TempNumber number;
    begin
    for i in 1..length( inSource ) loop
    TempNumber := dec2bin ( ascii( substr( inSource,i,1 ) ) );
    ResultString := ResultString || trim( to_char(TempNumber,'00000009'));
    end loop;
    return ResultString;
    end;
    Now, in sqlplus : (just to show the binary string)
    column mybin for 9999999999999999999999999999999999999999
    SQL> select to_ascii('g') mybin from dual;
    MYBIN
    01100111
    SQL> select to_ascii('girish') mybin from dual;
    MYBIN
    011001110110100101110010011010010111001101101000
    SQL>Source:http://psoug.org/snippet/Convert-between-Decimal-Binary-Octal-and-Hex_536.htm
    http://www.dbforums.com/oracle/974944-converting-string-binary.html
    Is this you want or something else ?
    Regards
    Girish Sharma

  • How do I convert a double-byte encoded file to single-byte ASCII?

    Hello,
    I am working with XML files (apparently coded in UTF-8) which encoded in double-byte characters.
    The problem is the characters for end of line: 00 0D 00 0A
    This double byte end of line is causing a problem with a legacy conversion tool (which deals with 0D 0A). The file itself contains no
    accented/international characters, so in principle converting to single-byte should not cause any problems.
    I have tried to convert this file with tools like native2ascii and the conversion tools that are part of Notepad++ but without
    any luck - the "00 0D 00 0A" are still present in the output
    Can anyone point me to a tool or some code that can convet this file into single-byte?
    Thank you.

    Amiens wrote:
    native2ascii.exe -encoding UTF-16 -reverse INPUT.xml OUTPUT.xml
    gives 00 00 0 0D 00 00 00 0A
    so clearly that is not the required output.What you've got there is UTF-16 encoded text that's been converted to UTF-16. Get rid of the "-reverse" option and you should see the result you expect.

  • How do I convert a double to an int?

    I would like to use math.pow(), but math.pow() only take doubles as arguments and result and I need my result to be an int.
    Example:
    double a = 10;
    double b = 3;
    double c;
    c = math.pow(a,b);
    "Now, here I what to convert c to an int"

    Can't you say
    int d = Math.floor(c);
    ?

  • How to convert XML data into binary data (opaque data)

    Hi,
    I am trying to develop a process that delivers files after reading data from a database.
    However, it is required not to deliver the data immediately. We want to perform some checks before the files get written.
    So the way we want to design this is,
    1. Read data from database (or any other input). The data is in XML format (this is a requirement, as in general, we have xml data)
    2. This data is written, opaquely, to a JMS queue that can store binary data, along with what is the filename of the file that would be written (filename is passed using JMS Headers)
    3. When required, another process reads the JMS queue's binary data, and dumps into a file
    The reason I want to use opaque data while inserting in the JMS queue is, that enables me to develop a single process in Step 3 that can write any file, irrespective of the format.
    My questions are
    1. How to convert the xml data to opaque data. In BPEL I may use a embedded java, but how about ESB. Any other way....?
    2. how to pass filename to the jms queue, when payload is opaque. Can I use a header attribute...custom attributes?
    3. Which jms message type is better for this kind of requirement - SYS.AQ$_JMS_BYTES_MESSAGE or SYS.AQ$_JMS_STREAM_MESSAGE

    Ana,
    We are doing the same thing--using one variable with the schema as the source of the .xsl and assigning the resulting html to another variable--the content body of the email, in our case. I just posted how we did it here: Re: Using XSLT to generate the email HTML body
    Let me know if this helps.

  • Converting a double to an int

    Can I convert a variable of type double to a variable of type int? The reason for this is I am creating a program that will draw graphs of parabolas, cubics, etc. and the user will be able to change the values for stretches, translations, etc.
    So my code for the drawing of a parabola at the moment is somewhat primitive, I just want the basic parabola drawn in. I've done a program that does exactly this using Turing (of all things...) but Java is proving to be more picky.
    int count = 0;
    int X = 0;
    double tempY = 0;
    int Y = 0;
    while(count <= 600){
         tempY = Math.pow(X - 300,2) + 200;
         Y = tempY;     //error here
         if(Y >= 0 && Y <= 400){
              g.fillOval(X, Y, 1, 1);
         count++;
         X++;
         }Don't worry about paintComponent() and all that, it's there I'm just posting the necessary parts you guys need to see.
    So the error I get is 'possible loss of precision' at the line indicated, and I know this, it's pretty obvious, but this is what I want/need to do as the fillOval will only accept ints for it's coordinates. I also tried forgetting about having the double value of tempY and doing the math to an int but then I get 'possible loss of precision' in the math line. If anyone can give me ideas/fixes to change a double into an int it would be much appreciated as this is what I really want to do, or if you can come up with alternative ways of doing what I need to do that would also be appreciated.
    EDIT
    In case you are wondering why I am adding and subtracting those values it's because my panel I'm drawing on is (600,400) and of course (0,0) is the top left corner rather than the center where it would be on a Cartesian plane, so I think I've made all the necassary adjustments so (0,0) is now in essentially the center of the panel. It's basically scanning across from the left to right and finding X^2 from '-300' to '300' but only drawing it in if the value for Y will appear in the panel. I know it's pretty fucked up and probably some really messy code, lol. I'm somewhat inexperienced and probably being a bit too adventurous.
    Edited by: vortex on Jan 15, 2008 11:07 AM
    Edited by: vortex on Jan 15, 2008 11:15 AM

    I haven't tried that, I will try that when I get to school. I think the issue could be that -300^2 may be too big to be an int? I was just thinking before I fell asleep about it last night and that could be it too...So naturally I'll just start from say, -100, or even -25 as that isn't exactly gonna fit on the graph so I'm just wasting processor power currently I suppose. Anyways I'm gonna try both of these out and get back to you guys.
    Another issue I'm foreseeing is that one of the graphs is the root of x, so I'm going to be dealing with decimals, that's fine for double but when I turn that into an int (assuming I ever figure out how to, hoping your idea, possibly coupled with mine works) how can I round/drop the decimals?
    Edited by: vortex on Jan 16, 2008 8:10 AM

Maybe you are looking for

  • Read Sales Order Item Conditions

    Hi All, Quick question. If I have a sales order and item number how can I read the item condtions. Is there a function module I can use or is there a table? Many Thanks, Colm

  • Using Escape as a hot key?

    Hi Guys, I am working on an application where we are running into some inconsistencies in the use of our hotkeys that makes it confusing for the end user (some pages alt-c triggers "continue", and sub pages that do not contain the continue button it

  • How can  SAP XI JMS Queue communicate with external JMS Queue

    Dear All , we are Implementing SAP XI . Sender business system is splitting a file into small files and keeping them into JMS queues we want SAP XI JMS queue should communicate directly with the sender JMS queue (which is an external JMS queue) witho

  • Can't see NEF thumbnails in preview in import window - Nikon D90

    Hi, I am trying to import photos from my Nikon D90 using File/Import photos from device. When I check the preview option, I see jpegs, but not the NEFs/RAWs. Any ideas why this would be? Thanks in advance for any help. Mike

  • How do I get iPhone 3GS to unfreeze?

    Took call while sending group text to large number of people. Now it's frozen and can't even turn it off to reboot. Help!