Click or drag to resize

Mod Function (Int64, Int64)

X#
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 INT64,
	nDivisor AS INT64
) AS INT64
Request Example View Source

Parameters

nDividend
Type: Int64
The dividend of the division operation.
nDivisor
Type: Int64
The divisor of the division operation.

Return Value

Type: Int64
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 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