Siebel eScript Language Reference > C Language Library Reference > Clib Mathematical Methods >

Clib Divide Method


The Clib Divide method performs integer division and returns a quotient and remainder.

Format

Clib.div(numerator, denominator)
Clib.ldiv(numerator, denominator)

Siebel eScript does not distinguish between integers and long integers, so clib.div and clib.ldiv are identical.

Table 164 describes the arguments for the Clib Divide method.

Table 164. Arguments for the Clib Divide Method
Argument
Description

numerator

The number that this method divides.

denominator

The number by which this method divides the numerator.

Table 165 describes the structure of the return value.

Table 165. Elements That the Clib Divide Method Returns

Element

Description

.quot

quotient

.rem

remainder

Example

The following example accepts two numbers as input from the user, divides the first number by the second number, and then 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 + ".");

If run this example with the values of n=9 and d=4, then it produces the following result:

The quotient is 2.

The remainder is 1.

Siebel eScript Language Reference Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices.