Mod Function (Long, Long) | |
Return the remainder of one number divided by another number.
Namespace:
XSharp.Core
Assembly:
XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax FUNCTION Mod(
nDividend AS LONG,
nDivisor AS LONG
) AS LONG
public static int Mod(
int nDividend,
int nDivisor
)
Request Example
View SourceParameters
- nDividend
- Type: Long
The dividend of the division operation. - nDivisor
- Type: Long
The divisor of the division operation.
Return Value
Type:
Long
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