Siebel eScript Language Reference > Siebel eScript Commands > The 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)

Parameter
Description

numerator

The number to be divided

denominator

The number by which numerator is to be divided

Returns

A structure with the following elements, which are the result of dividing numerator by denominator:

.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 remainder is 1.

Siebel eScript Language Reference