Caché MultiValue Basic Reference
Divides two numeric strings.
function divides numstr1
and returns the quotient. The two numeric values can be expressed as either numbers or as strings. Leading plus signs and leading and trailing zeros are ignored. A string is parsed as a number until a non-numeric character is encountered. Thus 7dwarves is parsed as 7. Non-numeric strings and null strings are parsed as 0.
Attempting to divide by zero generates a <DIVIDE> error, ending execution of the function and invoking an error trap handler, if available.
For compatibility, a third numeric argument is accepted, but ignored.
To perform arithmetic operations on numeric strings, use the SADD
, and SDIV
To perform arithmetic operations on floating point numbers, use the FADD
, and FDIV
functions, or use the standard arithmetic operators.
To perform integer division, use the DIV
function. To perform modulo division, use the MOD
To perform arithmetic operations on corresponding elements of dynamic arrays, use the ADDS
, and MODS
To perform numeric comparison operations, use the SCMP
function, or use the standard comparison operators.
The following examples use the SDIV
function to divide a numeric string by another numeric string. All of these examples return 2.333333333:
All of the following examples return 0:
All of the following examples generate a <DIVIDE> error: