SUB

Use the SUB script function to return the difference between two values as a 16-digit alphanumeric string with leading zeros.

Syntax

SUB (Operand1, Operand2)

Parameters

Notes:

Tip: You can remove leading zeros and otherwise edit the format of results with the FORMAT script function.

Examples

The example below stores the result of a subtraction in a script variable. Operand1 and Operand2 are specified as numeric expressions.

:SET &RESULT# = SUB(1000,999)

The example below shows a subtraction with floating-point numbers: 

:DEFINE &RESULT#,float
:SET &RESULT#SUB(10.31,-5.45)
:P &RESULT#

The following result is output in the activation report:

U0020408 +0000000000000015.7600000000000000

The example below shows another way of subtracting values, by using an arithmetic expression and storing the result in a script variable.

:SET &SUBTRACT# = 3 - 2
:
P &SUBTRACT#

The following result is output in the activation report:

U0020408 0000000000000001

See also:

seealso

Arithmetic Calculations in Scripts