Mod Function | |
Return the remainder of one number divided by another number.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax FUNCTION Mod(
nDividend AS USUAL,
nDivisor AS USUAL
) AS USUAL
public static Usual Mod(
Usual nDividend,
Usual nDivisor
)
Request Example
View SourceParameters
- nDividend
- Type: Usual
The dividend of the division operation. - nDivisor
- Type: Usual
The divisor of the division operation.
Return Value
Type:
Usual
A number representing the remainder of
nDividend divided by
nDivisor.
Remarks
Mod() is not implemented using the X# modulus operator (%). Note that there are differences between the Mod() function and the modulus operator, which are described in the following table:
Dividend Divisor Modulus Operator Mod() function
3 0 Error 3
3 -2 1 -1
-3 2 -1 1
-3 0 Error -3
-1 3 -1 2
-2 3 -2 1
2 -3 2 -1
1 -3 1 -2
Tip |
---|
In dBASE III PLUS, a 0 divisor returns the dividend for every value of the dividend. In versions of CA-Clipper prior to Summer '87, a 0 divisor returned 0 for all dividends. In X#, by contrast, the modulus of any dividend using a 0 divisor causes a runtime error.
|
Examples See Also