Re: Mod operator

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Myrna Larson (anonymous_at_discussions.microsoft.com)
Date: 09/02/04


Date: Wed, 01 Sep 2004 21:03:39 -0500

Some implementations of MOD work differently when the arguments have different
signs. The worksheet function uses the definition that the modulus is always
positive, i.e. =MOD(-10,3) yields -4 with a remainder of 2. OTOH, in VBA,
definition that's used is probably what you division in grade school: -10
divided by +3 is -3 with a remainder of -1.

On Wed, 01 Sep 2004 10:08:40 -0400, R Avery <ravery74@yahoo.co.uk> wrote:

>How come the Mod operator can return negative values? I've always
>wondered why.



Relevant Pages

  • Re: Speed/safety trade-offs and types vs. system classes
    ... (unsigned-byte 8), and no traps or errors either. ... You may be able to have this occur for certain implementations, ... the really lazy way to do this is to write your own macro to ... define these modulus operators. ...
    (comp.lang.lisp)
  • Re: The minimum RSA message size
    ... If you mean text book RSA, where n is the modulus, solve the following ... Have a look at padding schemes ... That's because the question is irrelevant to implementations. ...
    (sci.crypt)