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