Caché MultiValue Basic Reference
SDIV
[Back] [Next]
   
Server:docs2
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Divides two numeric strings.
Synopsis
SDIV(numstr1,numstr2)
Arguments
numstr1 The dividend. An expression that resolves to a number or numeric string.
numstr2 The divisor. An expression that resolves to a non-zero numeric or numeric string.
Description
The SDIV function divides numstr1 by numstr2 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.
Arithmetic Operations
Examples
The following examples use the SDIV function to divide a numeric string by another numeric string. All of these examples return 2.333333333:
PRINT SDIV(7,3)
PRINT SDIV("7","3")
PRINT SDIV("+7.00","003")
PRINT SDIV("7dwarves","3wishes")
All of the following examples return 0:
PRINT SDIV(0,7)
PRINT SDIV("","0")
PRINT SDIV("seven","3")
All of the following examples generate a <DIVIDE> error:
PRINT SDIV(7,0)
PRINT SDIV("7","")
PRINT SDIV("7","three")
See Also