Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>% modulus of two numbers -- binary (mathematical)</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
%              Modulus of two numbers -- binary           (Mathematical)


Syntax:        <expN1> % <expN2>

Type:          Numeric

Operands:      <expN1> is the dividend of the division operation.

               <expN2> is the divisor of the division operation.

Description:   % returns a number representing the remainder of <expN1>
               divided by <expN2>.

Notes:         . The modulus of a any dividend using a zero divisor
                 causes an Expression error.

               . In versions of Clipper prior to Summer '87, a modulus
                 operation with a zero divisor returned zero for all
                 dividends.  In Summer '87, it returns an Expression
                 error.  To restore the previous behavior, place the
                 following block of code in your Expr_error() error
                 function:

                     IF M->info = "zero divide" .AND. "%" $ M->model
                        RETURN 0
                     END


----------------------------------- Examples -------------------------------

   ?  3 %  0                            && Result: Expression error
   ?  3 % -2                            && Result:  1
   ? -3 %  2                            && Result: -1
   ? -3 %  0                            && Result: Expression error
   ? -1 %  3                            && Result: -1
   ? -2 %  3                            && Result: -2
   ?  2 % -3                            && Result:  2
   ?  1 % -3                            && Result:  1


See Also: * ** + - / Mod() Expr_error() SET FIXED

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson