Return the dBASE III PLUS modulus of two numbers

     MOD(<nDividend>, <nDivisor>) --> nRemainder


     <nDividend> is the dividend of the division operation.

     <nDivisor> is the divisor of the division operation.


     MOD() returns a number representing the remainder of <nDividend> divided
     by <nDivisor>.


     MOD() is a numeric function that emulates the dBASE III PLUS MOD()
     function.  It is implemented using the Clipper modulus operator (%).
     Note that there are differences between the dBASE III PLUS MOD()
     function and the Clipper modulus operator which are described in the
     following table:

     Differences Between dBASE III PLUS MOD() Function and the
     Clipper Modulus Operator
     Dividend     Divisor   Modulus Operator    MOD()     dBASE III PLUS
                                                          MOD() function
      3             0            Error          Error           3
      3            -2             1             -1             -1
     -3             2            -1              1              1
     -3             0            Error          Error          -3
     -1             3            -1              2              2
     -2             3            -2              1              1
      2            -3             2             -1             -1
      1            -3             1             -2             -2

     MOD() is supplied as a compatibility function and therefore not
     recommended.  It is superseded entirely by the modulus operator (%).


     .  Zero divisor in dBASE III PLUS: In dBASE III PLUS, a zero
        divisor returns the dividend for every value of the dividend.  In
        Clipper, by contrast, the modulus of any dividend using a zero
        divisor causes a runtime error.

     .  Zero divisor in earlier versions: In versions of Clipper
        prior to Summer '87, a modulus operation with a zero divisor returned
        zero for all dividends.  In Summer '87 and later versions, it returns
        a runtime error.

 Files   Library is EXTEND.LIB, source file is SOURCE\SAMPLE\MOD.PRG.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.