Caché MultiValue Basic Reference
FSUB

 Server:docs2 Instance:LATEST User:UnknownUser

 [ Home ]  >  [ MultiValue Features of Caché ]  >  [ Caché MultiValue Basic Reference ]  >  [ Caché MultiValue Basic Functions ]  >  [ FSUB ] Go to: Description Examples See Also Search:

Subtracts two floating point numbers.
Synopsis
`FSUB(num1,num2)`
Arguments
 num1 The minuend. An expression that resolves to a number or numeric string. num2 The subtrahend. An expression that resolves to a number or numeric string.
Description
The FSUB function subtracts num2 from num1, expressed as either numbers or as strings, and returns the result. 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. If a num value is a null string or a non-numeric value, FSUB parses its value as 0 (zero).
The FSUB function performs a subtraction on two numbers and returns the result. You can perform the same operation using the subtraction operator (-). Refer to the Operators page of this manual.
Arithmetic Operations
• To perform arithmetic operations on floating point numbers, use the FADD, FSUB, FMUL, and FDIV functions, or use the standard arithmetic operators.
• To perform arithmetic operations on numeric strings, use the SADD, SSUB, SMUL, and SDIV functions.
• To perform integer division, use the DIV function. To perform modulo division, use the MOD function.
• To perform arithmetic operations on corresponding elements of dynamic arrays, use the ADDS, SUBS, MULS, DIVS, and MODS functions.
• To perform numeric comparison operations, use the SCMP function, or use the standard comparison operators.
Examples
The following example uses the FSUB function to subtract two floating point numbers:
```a=11.95
b=10.25
PRINT FSUB(a,b);  ! returns 1.7```