|
Siebel eScript Language Reference > Siebel eScript Commands > Clib Object Math Methods >
Clib.div() Method and Clib.ldiv() Method
These methods perform integer division and return a quotient and remainder in a structure. Syntax
Clib.div(numerator, denominator) Clib.ldiv(numerator, denominator)
|
|
numerator |
The number to be divided |
denominator |
The number by which numerator is to be divided |
Returns
A structure with the elements shown in the following table, which are the result of dividing numerator by denominator.
Return Element |
|
.quot |
quotient |
.rem |
remainder |
Usage
Because Siebel eScript does not distinguish between integers and long integers, the Clib.div() and Clib.ldiv() methods are identical. Example
The following example accepts two numbers as input from the user, divides the first by the second, and displays the result: var division = Clib.div(ToNumber(n), ToNumber(d)); TheApplication().RaiseErrorText("The quotient is " + division.quot + ".\n\n" + "The remainder is " + division.rem + ".");
When run with the values of n=9 and d=4, this example produces this result. The quotient is 2.
The remainder is 1.
|