Hexvalue to float value conversion

Hi Everyone,
I have a hex value "40000000" which its value in float is supposed to be "2" in my xml file.When i do the conversion i get a different value.Can somebody help me figure this out.Thanks

I have a hex value "40000000" which its value in float is supposed to be "2" There exists a standard IEEE 754 floating point representation, and just by
coincidence it matches your conversion for this particular value:          int i= 0x40000000;
          float f= Float.intBitsToFloat(i);
          System.out.println("f= "+f);kind regards,
Jos

Similar Messages

  • Union two tables with diffrent count of fields with null and float value

    Hello,
    i want to union two tables, first one with 3 fields and second one with 4 fields (diffrent count of fields).
    I can add null value at end of first select but it does not work with float values in second table. Value form second table is convert to integer.
    For example:
    select null v1 from sessions
    union
    select 0.05 v1 from sessions
    result is set of null and 0 value.
    As workaround i can type:
    select null+0.0 v1 from sessions
    union
    select 0.05 v1 from sessions
    or simple change select's order.
    Is any better/proper way to do this? Can I somehow set float field type in first select?
    Best regards,
    Lukasz.
    WIN XP, MAXDB 7.6.03

    Hi Lukasz,
    in a UNION statement the first statement defines the structure (number, names and types of fields) of the resultset.
    Therefore you have to define a FLOAT field in the first SELECT statement in order to avoid conversion to VARCHAR.
    Be aware that NULL and 0.0 are not the same thus NULL+0.0 does not equal NULL.
    In fact NULL cannot equal to any number or character value at all.
    BTW: you may want to use UNION ALL to avoid the search and removal of duplicates - looks like your datasets won't contain duplicates anyhow...
    Regards,
    Lars

  • Function module to convert float value to data type 'dec'

    Hi experts,
      In a report i need to convert float value to the data type 'DEC'. How to convert it. Is there any function module for this conversion.
    Thanks and Regards,
    Vaibhav Tiwari.

    Hi ..
    We can do like this...
    Data : V_float type F value '12345.67'.
    Data: V_dec type P Decimals 2.
    Write:/ V_float exponent 0. "This will display it like Type P
    or
    Write V_float to V_dec EXPONENT 0.
    Write:/ V_dec.
    reward if Helpful.
    <b></b>

  • Float value converted into unwanted value

    Hello,
    I have a situation with a strange float(22) value conversion during insert. Value 244655737199025 appears as 244655700000000 in the desination table.
    It is a simple "insert into +table1+ select from +view1+" statement.
    The result of "select * from view1" is correct though.
    Any ideas?
    Edited by: avtandil on Apr 29, 2009 12:17 PM

    Sorry, my bad.
    I can see the source of the issue. In an OraEdit tool I use for Pl/Sql programming:
    SQL>desc table1 (target)
    FORMINDEX          FLOAT(22)
    SQL>desc view1
    FORMINDEX          FLOAT(22)
    In SQLPlus
    SQL>desc table1 (target)
    FORMINDEX          FLOAT(22)
    SQL>desc view1
    FORMINDEX          FLOAT(126)
    Thanks guys

  • How to extract an integer or a float value from a String of characters

    Hi i have a problem getting to a float value within a string of characters..
    for instance the string is
    "numberItem xxxxxxxxx 700.0" (each x is a space..the forum wouldnt let me put normal spaces for some reason)
    how do i store 700.0 in a float variable
    remember the string is obtained from an inputfile
    so far i got the program to store the inputfile data line by line in a String array..i tried tokenizing the string to get to the the float value but since i have mulitple spaces within my string, the token method only gets "numberItem" from the above String
    This is all i have so far:
    String c;
    String Array[] =new String[g]; (i used a while loop to obtain g(the nubmer of lines in the file))
    while((c=(cr.readLine()))!=null)
    Array[coun]=c;
    it would be reallllllllllllllllllllllllllllllllllllllly easy if there was a predefined method to extract numeric values from a string in java..
    Edited by: badmash on Feb 18, 2009 5:50 PM
    Edited by: badmash on Feb 18, 2009 5:50 PM
    Edited by: badmash on Feb 18, 2009 5:55 PM

    badmash wrote:
    Hi i have a problem getting to a float value within a string of characters..
    for instance the string is
    "numberItem xxxxxxxxx 700.0" (each x is a space..the forum wouldnt let me put normal spaces for some reason)
    with the space included
    how do i store 700.0 in a float variable
    remember the string is obtained from an inputfile
    so far i got the program to store the inputfile data line by line in a String array..i tried tokenizing the string to get to the the float value but since i have mulitple spaces within my string, the token method only gets "numberItem" from the above StringHuh?
    Not true.
    Anyway why not use string split, split on spaces and grab the last element (which by the format you posted would be your 700.0)
    Then there is the Float.parseFloat method.
    It is easy.
    And another thing why not use a List of Strings if you want to store each line? (And why did you post that code which doesn't really have anything to do with your problem?) Also in future please use the code formatting tags when posting code. Select the code you are posting in the message box and click the CODE button.

  • Rounding up of a float value

    i need some help in rounding up the float value to two places after the decimal point
    i have a value like 25.34446789 and i need to round it up like 25.34

    i tried this function but i am not getting the result
    correctly .if i am using the round () function i am
    getting a value like 55.0 when the original value is
    55.085673.
    i want to get it like 55.09. round to two places
    after the decimal point .is there any other way to do
    it ?How about doing what Chuck said you should do? Give it a try and think about what he wrote. It may actually work.

  • How do i convert a float value to a double value?

    How do i convert a float value to a double value? HELP PLEASE!! im very stuck!! i gota float data type and i need to convert it to a double data type in order to use it in another operation.....
    thank u so much!

    safe dint realise ppl were so arrogant. thanks for the reply but less of the sarcasm!

  • How can i write the floats value in Unitronics vision230 plc using modbus Ethernet

           How can i write the Float value in unitronics Vision230 PLC usinsg modbus ethernet (MB Ethernet Master Query.vi) I  read and write  the 32 bit register,  for e.g i want to write the 23.45 value on 2nd add. of MF. And MF register is 32 bit register. I  read and write  the 32 bit register.
    Narendra.
    Solved!
    Go to Solution.

     Thanks Amit for your solution but i can not use the string to write the value because  MB Ethernet master Query.vi only accepet the integer value its not take string values or any other i.e floats values etc.....otherwise i have  no problem to write or read the 32 bit register values , only problem is that the MB Ethernet master Query.vi only accept the integer value there4 how can write the float value.
    Narendra
    Message Edited by Artemistech on 01-30-2009 11:06 PM

  • Creating Value Conversion Filters in Import Manager

    Hello.
    I am trying to create some Value Conversion Filters that change street suffixes to abbreviations. Such as Lane to Ln.
    How would I go about doing this? Am I supposed to use the find/replace Conversion Filter?
    Points awarded to any helpful answers / helpful guides (besides the Import Manager Guide) <--- I have this already
    Thanks,
    Nichole

    Hi,
    Yes u can use the Find/Replace Conversion filter property in Import manager.
    In this u can write the word u want to change and then write the req format.
    But the conversions are permanent while if u do this in MDM data manager under transformations they are temporary.i.e they will not be syndicated.
    Hope this may help u.
    Rgds]
    Ankit
    Edited by: ankit jain on Aug 6, 2008 5:06 AM

  • Value conversion

    Hi everybody,
    i need a small help reg value conversion.
    for suppose:
    1>a = 1.234.567,89 in sap format
          we need to convert this to a = 1,234,567.89 into flat file.
    2>date format is showing as DD.MM.YYYY in sap format
    we need to convert this to MM/DD/YYYY
    (no matter which user is used to run the program)
    please give me reply.

    Hi Sunil,
    To dispaly the Date form System Format to User Format the FM 'CONVERT_DATE_TO_EXTERNAL' is used.
    Consider this code.
    REPORT zztest_arun_2.
    DATA: e_date(10) type c VALUE '2/2/2006',
          i_date(10).
    CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
      EXPORTING
        date_external            = e_date
      IMPORTING
        date_internal            = i_date
      EXCEPTIONS
        date_external_is_invalid = 1
        OTHERS                   = 2.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    WRITE : / 'CONVERT_DATE_TO_INTERNAL',
            / 'My   Date:' , e_date  ,
              'Conv Date:',  i_date.
              skip 2.
    CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
      EXPORTING
        DATE_INTERNAL                  = sy-datum
      IMPORTING
        DATE_EXTERNAL                  = e_date
      EXCEPTIONS
        DATE_INTERNAL_IS_INVALID       = 1
        OTHERS                         = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    WRITE : / 'CONVERT_DATE_TO_EXTERNAL',
             / 'My   Date:' , sy-datum,
               'Conv Date:',  e_date.
    Thanks,
    reward If Helpful.

  • Insert float value into ms sql server

    Hi.
    How do I insert a float value into my ms sql db.
    The Code:
    select.setFloat( 4, theForm.getVaerdi() );ERROR:
    "MakeClapetInsertAction.java": Error #: 300 : method setFloat(int, java.lang.Float) not found in interface java.sql.PreparedStatement at line 89, column 12

    setFloat takes a float primitive, not a Float object.
    select.setFloat( 4, theForm.getVaerdi().floatValue() );

  • Error in float value

    Hi,
    I am a newbie in JAVA. When I wrote the following code in java it gives me error:
    public class FloatTest
    public static void main(String[] args)
    float f=3.14;
    System.out.println(f);
    It gives me an error saying possible lose of precision. Aren't float value capable of storing values with decimal point?
    Thank you.

    You're giving your float a double literal. If you want to use a float literal, you should append f to the end of the number.
    By the way, there's usually very little reason to use float when a double will do as the precision of double is much greater and the cost of its use is very low if anything at all.

  • How to see decimal part of float value?

    How to see only value of decimal part of float value?
    For example, if I have 1.455, i need only to see .455 part.

    Read the floating point value.
    Convert that into a string.
    Use the String's substring and indexOf method to find
    the "." and then cut from there, to the end of the
    string.<sarcasm>
    Really? I'm sure pbrockway already said that but i must be mistaken.
    </sarcasm>

  • Rounding ist wrong for float value (MS SQL 2005)

    Hello
    I have a simple report with a command:
    select num = convert(float, 4.145)
    Field round over "Format Field" or ToText( num, 2) the result is 4.14  -> Wrong
    if  i use Round(num, 2)  result is 4.15 --> OK
    In CR 8.5 result is always correct
    Thx

    I know the problematic of the floating values.
    My big trouble is the inconsistency in the report!
    It can't be that the formula function Round(x,y) show another result than the integrated field-rounding function.
    Also in the formula that ToText(x, y) is different to Round(x,y).
    Following another stupid difference:
    Command.num = 4.145          Result: TRUE
    Command.num - 4.145 = 0     Result: FALSE
    Mathematical it's the same.
    CR8 was consistence, after migration we have different result on our reports!

  • Draw line with float values possible

    Hi,
    Using Canvas drawing is possible to draw line with float values.
    graphics.drawLine(int,int,int,int);
    graphics.drawLine(float,float,float,float);Thanks and regards,
    Rakesh.

    not possible
    graphics.drawLine(float,float,float,float);...there's no such method in MIDP API: [click here for javadoc of Graphics class methods|http://java.sun.com/javame/reference/apis/jsr118/javax/microedition/lcdui/Graphics.html#drawLine(int,%20int,%20int,%20int)]

Maybe you are looking for

  • Reverse Mapping Tutorial - Finder.java queries the wrong table?!

    I have been almost successful in running the Reverse Mapping Tutorial, by creating Java Classes from the hsqldb sample database, and running the JDO Enhancer on them. However, I cannot get he Finder.java to work. It seems to look in the wrong table:

  • Is there any difference between R/3 4.7 version and ECC 5.0????

    Hi All,   Is there any difference between R/3 4.7 version and ECC 5.0 for the transaction RSA5. Regards, Andy

  • Acrobat 9 crashes after startup window

    when I start Acrobat 9, it crashes right after the main window opens with a " Adobe Acrobat 9.0 has encountered a problem and needs to close. We are sorry for the inconvenience." erroe. I had it working on this machine but must have done something to

  • Rename persistence.xml

    I wrote a utility that will be reused by web-apps and relies on JPA. Those web-apps will likely also rely on JPA. This implies 2 persistence.xml files in the classpath... which can lead to conflicts (and according to posts I read - it does!). So I mu

  • ICR FBICR3 runtime error

    Hello experts, FBICR3 is performing an authority check on the field company. When I start the transaction for a company I have authorization on, the program is running fine. When I start the transaction for a company I'm not authorized on, I get the