AMT Datasouth PAL User Manual

Page 194

Advertising
background image

sub

188

sub

Description

Subtracts the second number from the first number and returns the difference.

Usage

Any1Num Any2Num

sub

DifNum

Any1Num

Integer or fixed-point. First number from which to subtract the second number.

Any2Num

Integer or fixed-point. Second number to subtract from the first number.

DifNum

Integer or fixed-point. Integer if Any1Num and Any2Num are both integer,
otherwise fixed-point. Result of Any2Num subtracted from Any1Num.

Comments

The sub operator pops the top two objects from the operand stack, subtracts the second from the
first, and pushes the result back onto the operand stack. The interpreter must find two numeric
objects on the top of the stack or a typecheck error will result.

If the stack contains two integer objects, the interpreter will perform integer subtraction and push
an integer result onto the stack. The interpreter will perform fixed point subtraction and push a
fixed point result if the stack contains a fixed point object as either operand.

Advertising