Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Can someone explain how mod(-4,3) returns a value of 2?
Thank
I think it's working like the Excel function, and this function can be (according to Excel Help) evaluated like:
MOD(n, d) = n - d*INT(n/d)
So:
mod(-4,3) = -4 - 3*(-2) = +2
When working with negative number we are looking for value larger absolute value.
In this case -6 is larger than -4
and
-4=-6+2
Robert,
Thanks for your reply but I am still not clear. Where are you getting the -6 from?
Is the first number greater than 4 divided by 3.
I think it's working like the Excel function, and this function can be (according to Excel Help) evaluated like:
MOD(n, d) = n - d*INT(n/d)
So:
mod(-4,3) = -4 - 3*(-2) = +2
Krishna,
Thanks for the explanation, now it makes sense!