pTAL Reference Manual (H06.03+)
Expressions
HP pTAL Reference Manual—523746-005
5-6
Signed Arithmetic Operators
A condition code cannot appear inside an arithmetic expression; for example, the
following is not valid in pTAL:
a := <; !Illegal
Signed Arithmetic Operators
In Table 5-5 on page 5-6, the order of the data types is interchangeable.
Table 5-3. Arithmetic Expressions
Syntax Example
operand var-1
- operand -var-1
+ operand arithmetic-operator operand +var-1 * 2
operand arithmetic-operator operand var-1 / var-2
operand arithmetic-operator operand var-1 / (-var-2)
expression operand expression 2 *3 + var / 2
expression operand expression 2 * var * 4
Table 5-4. Signed Arithmetic Operators
Operator Operation Operand Type
*
Example
+ Unary plus Any data type +5
- Unary minus Any data type -5
+ Binary signed addition Any data type alpha + beta
- Binary signed subtraction Any data type alpha - beta
* Binary signed multiplication Any data type alpha
*
beta
/ Binary signed division Any data type alpha / beta
* The data type of the operands must match, except as noted in Data Types of Expressions on page 5-2.
Table 5-5. Signed Arithmetic Operand and Result Types (page 1 of 2)
Operand Type Operand Type Result Type Example
STRING STRING INT byte1 + byte2
INT INT INT word1 - word2
INT(32) INT(32) INT(32) dbl1
*
dbl2
REAL REAL REAL real1 + real2
REAL(64) REAL(64) REAL(64) quad1 + quad2
FIXED FIXED FIXED fixed1
*
fixed2
INT STRING INT word1 / byte1










