Help - Method for converting float to double

Discussion in 'The Lounge' started by mcvishnuprasad, Jan 3, 2008.

  1. mcvishnuprasad

    mcvishnuprasad

    Joined:
    Jan 3, 2008
    Messages:
    1
    Likes Received:
    0
    Could anybody suggest an efficient method for converting float to double?

    Thanks in advance...
     
    mcvishnuprasad, Jan 3, 2008
    #1
    1. Advertisements

  2. mcvishnuprasad

    Andre khoury

    Joined:
    Mar 9, 2008
    Messages:
    1
    Likes Received:
    0
    Location:
    i live in lebanon beirut
    first of al u want to know in java langauge or c++
    anyway in java u have to convert float to String then String to double i will show u how :
    float a=123.3333f;
    System.out.println(a);
    String b=String.valueOf(a);
    double c=Double.valueOf(b);
    doube test=c;//just tomakesure that it will work and it does:)
    System.out.println(test);//output double value
    Ejoy;
    Sincerly Andre
     
    Andre khoury, Mar 9, 2008
    #2
    1. Advertisements

  3. mcvishnuprasad

    d_wzrdv_z

    Joined:
    Jul 24, 2008
    Messages:
    3
    Likes Received:
    0
    Location:
    Melbourne
    yeah - js and vb are a pain, but c, c++, c# and java should be able to cast it quite similarly. just remember to make sure that the precision is correct if its a spaceman or geneticists double!

    dwiz
     
    d_wzrdv_z, Jul 24, 2008
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.