beautypg.com

AMT Datasouth PAL User Manual

Page 36

background image

add

30

add

Description

Adds two numbers and returns the sum.

Usage

Any1Num Any2Num

add

SumNum

Any1Num

Integer or fixed-point. First number to add.

Any2Num

Integer or fixed-point. Second number to add.

SumNum

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

Comments

The add operator pops the top two objects from operand stack, adds them together, 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 addition and push an
integer result onto the stack. The interpreter will perform fixed point addition and push a fixed-
point result if the stack contains a fixed-point object as either operand.