on 05-30-2008 4:49 PM
Hello,
Can anyone explain why I get the following results in abap?
-129 mod 60 = 51
-129 div 60 = -3
In .net you get -9 and 2 which I would say is correct. I've spotted that (-3x60)+51=-129 , but I can't explain mathematically why sap is giving -3 especially when .net and my logic says it should be -2.
Kind regards
Ash Thomas
hi thomas,
DIV gives u the rounded result of ur division, if u wants the decimal part go for '/' instead of DIV and MOD gives u remainder of ur division.
regards,
pritam.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
-129 mod 60 = 51
-129 div 60 = -3
1. -129 mod 60 = 51
-129 mod 60 => ( -9 mod value is -ve but mod value only +ve so 60 - 9 = 51.
MOD - Integer remainder of the division of the left by the right operand
2. -129 div 60 = -3
if use -129/60 = -2.15.
but if use -129 DIV 60 = -3 here 0.15 => 1 so decimals convert interger.
if have any decimals value ( low or high ) it convert to one for using DIV.
DIV - Integer portion of the division of the left by the right operand
if you want Ans -2 using ' / '
-129 / 60 = -3.
Thanks,
Durai.V
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.