Skip to Content
avatar image
Former Member

Arithmetic Multiply Function Problem

Hello everybody,

I have a strange situation, I'm using in message mapping the Multiply Function of the Arithmetic Group, and the situation is that is working really strange with some values as example:

135525.07 * -1

this operation gives as a result -135525.06, so it's not rounding or something like that is just working strange with quantities with decimals between .01 and .09, I've tried types strings, floats, doubles, decimals and longs, and all of them gives the same result, a wrong result, has anyone front this before?, thanks in advance.

Regards,

Paul

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Dec 18, 2008 at 12:45 AM

    Hi Paul

    I have observed this behavior

    it will round of the values irrespective of data type and provide incorrect value.

    135525.07112 * 1 this will turn to 135525.08

    Thanks

    Gaurav

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 18, 2008 at 02:37 AM

    Hi Paul,

    Yes, the Multiply function is doing what you mentioned.

    try using this UDF:

    double orgArg = Double.parseDouble(argument);

    double mulArg=aDouble*(-1);

    String str = Double.toString(mulArg);

    return str;

    I tried with these values and the function returns:

    3383.435434353232342 and function returns -3383.4354343532323

    6744533.7454353543 and funtion returns -6744533.745435354

    But for a larger number, say 8734537533.564545 the output is -8.734537533564545E9

    If your inputs are not going be as large, then you can use the code.

    Regards,

    Balaji.M

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 18, 2008 at 06:03 AM

    hi ,

    i tried these examples its working fine with the normal aritmetic multiply... if u sure ur value 135525.07 or the source field is of two decimal place use Format number standard function after that source field ..

    Format number of form 0000.00

    Edited by: ROBIN C on Dec 18, 2008 12:29 PM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 18, 2008 at 06:35 AM

    Hi Paul

    generaly multiply function round offs the values in float

    If you are sure that you out put value must be upto 2 decimal then use FORMATNUm function and it will give you the exact result

    thanks

    sandeep

    Add comment
    10|10000 characters needed characters exceeded