Search This Blog

Sunday, February 28, 2010

What is the Value of 0/0 in SAP


What is the Value of 0/0?
If the same question is asked in a Mathematics class, what will the answer?
Here are some possible answers that I got from some of the students.
  1. Anything divided by zero is Infinity. So, first answer -> INFINITY
  2. If numerator of a ratio is zero (or we can say if Zero multiplied by anything –even a ratio) then the answer is ZERO.

  3. Now read this interesting answer –> 0/0 = 1.
    Didn't understood how, considering algebraic mathematics… I will convert the expression as X / X which will be equal to ONE.
    There is no end to this. Even some will say X/Y where X = 2Y resulting in TWO. There is no end to these somehow "Innovative" answers.
But the answer to all these arguments is the actual fact as per Mathematics Principles is that, 0/0 is UNDEFINED.

Now let us see what the value of 0/0 as per SAP. Write a small code as below:

DATA: VAR1 TYPE I,
            VAR2 TYPE I,
            VAR3 TYPE I.

    VAR3 = VAR1 / VAR2.
    WRITE: / VAR1, VAR2, VAR3.

You can see that there won't be any Run Time error and instead the answer will be ZERO.Now before the statement     VAR3 = VAR1 / VAR2, set VAR1 to a non-zero value. We can see that it will generate a Run Time Error of "Divide by Zero".

No comments:

Post a Comment