Convert Float to Char

Hi,
I'm having problem when converting a float variable to char - it seems like the float value is automatically rounded into the char variable, but I don't want that.
Does anybody know a wafunction or a way of avoiding this convertion round?
Thanks,
Nuno Afonso

With the input parameters you gave me...
Error in ASSIGN: Memory protection error
The current program "SAPLSCFL " uses the ASSIGN statement. 
However, the offset of the segment (536) plus the length (1)
is greater than the length of the segment (536).           
This is not allowed.                                       

Similar Messages

  • Float to char

    Hi friends,
                   I want to convert float variable to char.For example 2e5 to 2000000 like that how to do this?
    Thanks.

    Bharat,
    Try this :
      write <float_variable> to <char_variable> .
    Define the char variable appropriately .
    ~ Laxmi
    Pls reward helpful answers

  • 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>

  • Converting a 6 char string to date

    Please help..
    How can I convert a 6 char date (ddmmyy) to date format
    that can be passed as input to function module?

    Hi,
    Try FM,
    CONVERT_DATE_TO_INTERNAL
    Run this sample code,
    DATA:
      my_date(6) TYPE c VALUE '300708',
      w_date     TYPE sy-datum.
    CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
      EXPORTING
        date_external                  = my_date
    *   ACCEPT_INITIAL_DATE            = ACCEPT_INITIAL_DATE
    IMPORTING
       date_internal                  = w_date
    EXCEPTIONS
       date_external_is_invalid       = 1.
    WRITE: w_date.
    Regards
    Adil

  • Convert float to 4 bytes array

    How can I convert float type to 4 byte array -
    not with strings but to exact binary representation.

    See the javadoc of Float.floatToIntBits. Converting an int to an array of 4 bytes is easy, so I will left it as an exercise.
    floatToIntBits
    public static int floatToIntBits(float value)Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "single format" bit layout.
    Bit 31 (the bit that is selected by the mask 0x80000000) represents the sign of the floating-point number. Bits 30-23 (the bits that are selected by the mask 0x7f800000) represent the exponent. Bits 22-0 (the bits that are selected by the mask 0x007fffff) represent the significand (sometimes called the mantissa) of the floating-point number.
    If the argument is positive infinity, the result is 0x7f800000.
    If the argument is negative infinity, the result is 0xff800000.
    If the argument is NaN, the result is 0x7fc00000.
    In all cases, the result is an integer that, when given to the intBitsToFloat(int) method, will produce a floating-point value the same as the argument to floatToIntBits (except all NaN values are collapsed to a single "canonical" NaN value).
    Parameters:
    value - a floating-point number.
    Returns:
    the bits that represent the floating-point number.

  • Convert float to rational

    Hello,
    The TIFF tag header protocol requires a data type I am not really conversant with, the Rational Data type: http://en.wikipedia.org/wiki/Rational_data_type
    I need to convert double precision numbers to this data type, e.g. 24.5 needs to be a ratio of two integers: {49,2}. Is there an existing LabVIEW algorithm to perform this operation? All my NI searches keep resulting in Rational ClearCase or Rational Array interpolation. I seem to have found a lot of the theory behind this: http://stackoverflow.com/questions/95727/how-to-convert-floats-to-human-readable-fractions
    But, is this implemented in labVIEW already, or should I implement the above-referenced c-code?
    Thanks,
    Mello
    Data Science Automation
    CTA, CLA, CPI
    SHAZAM!
    Solved!
    Go to Solution.

    I was curious if there were other ways to do this and found that Scilab combined with the LabVIEW Gateway works quite well. The 'rat' function is available in Scilab; Scilab and the LabVIEW gateway were both easy to install...
    http://www.scilab.org/products/other/labview_gateway
    Message Edited by Phillip Brooks on 03-04-2010 08:29 AM
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness
    Attachments:
    scilab_rat.JPG ‏46 KB

  • Converting float array to Float array

    Hi, is there any efficent way to convert float[][] to Float[][] without iterating the array and creating Float object for each float data? I have a method performing calculations based on a 2D array( float[][]) and then need to store the result in a TreeMap data structure. The "put" method for TreeMap ask Object type.
    Thanks in advance!

    1) No
    2) An array of float is an object as well:
    Object obj = new float[]{1.0, 2.0, 3.0};3) What you want to store? If your structure is somewhat like this:
    float[][] f = {
       { 1.0, 2.0, 3.0 },
       { 4.0, 5.0, 6.0 },
    };and you want to "index" your TreeMap by the first element of each row of your float[] array, you could do something like this:
        SortedMap sm = new TreeMap();
        sm.put(new Float(f[0][0]), f[0]); // Arrays are objects as well
        sm.put(new Float(f[1][0]), f[1]); //and so on.

  • Arithmetic Overflow error converting float to data type numeric

    Hi,
    Am facing strange issue,I have function which returns money datatype and assigning the return money value to float datatype in table.
    Error msg:
    Msg 8115, Level 16, State 6, Procedure GBCalcCatalogPriceNewV2, Line 204
    Arithmetic overflow error converting float to data type numeric.
    The statement has been terminated.
    Strange thing is the same stored procedure is working fine in production environment,but in the deveopment i see this error.Am scared if the same happens in the production environment.Please advice and advance
    thanks
    Regards
    RAj

    Strange thing is the same stored procedure is working fine in production environment,
    How could that be strange? This is an error that occurs depending on the data. Accidents that are waiting to happen will happen sooner or later.
    Then again, a development database may be more prone to such errors, because data that entered are completely out of whack with real life data. Still it is a warning sign. If you have some place where you convert data from float to numeric, you must consider
    the risk that the float value is outside the range for the numeric data type. How do you prevent that from happening? Maybe a CHECK constraint on the column? Of if the data origins from a money column, use a numeric data type with sufficient precision.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Convert float to Float

    Hi,
    How can I convert float to Float?
    thanks
    andrew

    I got the answer myself, Float Q = new Float(q);

  • Convert float to integer

    how to convert float to integer?
    and convert it back from integer to float?

    You can cast a float to an integer using the following syntax:
    float f = 1.245;
    int i = (int)f;
    To convert an int to a float you use a similar syntax:
    int i = 3;
    float f = (float)i;
    You'll also find some interesting methods for the Float and Integer object s in the Java API documentation.

  • Converting int to char

    Hi!..
    I have a problem!...
    I need to convert integers to chars, but i`m using char(int)....
    So, only accept until ascii code 128..
    Please, What can I do?
    This is my code:
    Thanks!
    public Convert() {
    public static void main(String[] args) {
    Convert convert1 = new Convert();
    System.out.print(f_Transforma("ABCD"));
    public static String f_Transforma(String Password)
    int IntStrLong=Password.length();
    String StrResultado=new String();
    while (IntStrLong >=1)
    int tmpchar=(int)Password.charAt(IntStrLong-1); //valor ascii
    tmpchar=256-tmpchar+IntStrLong;
    String aChar = new Character((char)tmpchar).toString(); //ASCII code to String
    StrResultado=StrResultado+aChar;
    IntStrLong-=1;
    return (StrResultado);
    }

    I did what you told me and nothing happened...
    int tmpchar=(int)Password.charAt(IntStrLong-1); //valor ascii
    tmpchar=256-tmpchar+IntStrLong;
    tmpchar=tmpchar>>8;
    String aChar = new Character((char)tmpchar).toString(); //ASCII code to String

  • FM to convert double byte chars

    Hi All,
    Is there anyone know what are the function module to convert double-byte chars? Thanks.

    Seems like Blue Sky is not clear
    You want to convert what into what?
    Whats the purpose of this requirement, kindly give more details.
    Regards
    Karthik D

  • How to convert ASCII to CHAR?

    Hi, experts.
    Now I want to convert ASCII to CHAR, can you give me some methods? And I also want to know what's my ABAP Version.
    Thanks in advance!

    *After look so bad code that no work i did my own code, a gift for all you:*
    FORM CHARACTER_ASCII   using    p_letra
                                                 changing p_nro   type i.
    field-symbols: <n> type x.
    assign p_letra to <n> casting.
    move <n> to p_nro.
    ENDFORM.
    FORM ASCII_CHARACTER using    p_nro type i
                                               changing p_letra.
    DATA: c    TYPE c,
          x(4) TYPE x.
    FIELD-SYMBOLS: <fc>  TYPE c.
    x = p_nro.
    ASSIGN x to <fc> CASTING TYPE c.
    MOVE <fc>+1(1) to p_letra.
    ENDFORM.

  • Converting raw to char

    Hi SDN,
    I have to convert raw to char.
    data : lv_raw(16) type RAW.
    data : lv_char(16) type c.
    lv_raw = some value.
    i want to convert this value in lv_raw to lv_char in character format.
    please let me know.
    i tried the FM BANK_API_PP_UT_CHAR16_TO_RAW16 but no use.
    Regards,
    Rahul Wagh

    HI Vikranth,
    i tried that FM also but it is not giving me correct value.
    my hex value = 16D7A4FCA7442DDA3AD93C9A726597E4
    the character value for this should come as = test1234
    but FM given by u gives me junk values.
    is there any other way for this
    Regards,
    Rahul

  • Convert number to char

    Hi,
    I need to format numbers when converting it to char.
    I need to show the number with a precision of 3, and when between -1 and 1 to show the 0.
    ex:
    0.234
    -0.234
    1.220
    not .234
    thanks in advance

    I need to show the number with a precision of 3, and when between -1 and 1 to show the 0.This ?
    SQL> with t as (
    select 0.234 n from dual union all
    select -0.234 from dual union all
    select  13.22 from dual union all
    select 1.220 from dual
    select n, to_char(n, '990.000')  n2 from t
             N N2     
          ,234    0.234
        -0,234   -0.234
         13,22   13.220
          1,22    1.220
    4 rows selected.

Maybe you are looking for