Skip to Content
avatar image
Former Member

Arithmatic Operations

What is the result of the following arithmetic operation?

DATA: intTYPEI.

int=5*(3/10).

Problem is they are suggesting the correct answer as 0. But how could this be possible. Need guide on this .

Being a newbie, these types of issues is common i think.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Oct 17, 2017 at 05:20 PM

    Hi Shantanu,

    By looking at the declaration the query looks related to ABAP. So however if its ABAP/PI(Java) yes the answer is 0.

    Go through the operator precedence for ABAP or JAVA . The result of 3/10 is returned as 0 and not 0.3 . If you would have declared the int as type Decimal in ABAP then the value would be 1.5

    DATA: int TYPE I.
    int=5*(3/10).
    Output : 0
    DATA: int TYPE P DECIMALS 1.
    int=5*(3/10).
    Output : 1.5

    Br,

    Manoj

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 17, 2017 at 04:05 PM

    You wish to execute this in pi mapping?

    Manually if you do answer should be 1.5

    Add comment
    10|10000 characters needed characters exceeded