pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
fpoint
is the implied fixed-point (decimal-point) setting. fpoint is an integer in the range -19 through
19. The default fpoint is 0 (no decimal places).
A positive fpoint specifies the number of places to the right of the decimal point:
FIXED(3) x := 0.642F; ! Stored as 642
A negative fpoint specifies a number of places to the left of the decimal point. When the
value is stored, it is truncated leftward from the decimal point by the specified number of digits.
When the value is accessed, zeros replace the truncated digits:
FIXED(-3) y := 642945F; ! Stored as 642; accessed as 642000
*(asterisk)
prevents scaling of the initialization values (for an explanation of scaling, see Scaling of FIXED
Operands (page 74)).
Example 5 Constant Expressions in Data Type Specifications
LITERAL a = 2,
b = 35;
INT(a + 30) aaa; ! OK: INT(32) is valid
INT(b - 5) bbb; ! ERROR: expression must evaluate to valid
! bit length (16, 32, or 64 for an INT)
REAL (b - 19) ccc; ! ERROR: expression must evaluate to valid
! bit length (32 or 64 for REAL)
REAL (b + 29) ddd; ! OK: REAL(64) is valid
UNSIGNED (a) eee; ! OK: UNSIGNED fields can be any number of
! bits from 1 to 31.
Data Type Aliases
The compiler accepts these data type aliases:
AliasesData Type
INT(16)INT
REAL(32)REAL
FIXED(0)INT(64)FIXED
The remainder of this manual avoids using data type aliases.
Operations by Data Type
The data type of a variable determines the operations you can perform on the variable.
Table 19 Operations by Data Type
REAL or REAL(64)FIXED
INT(32) or
UNSIGNED
(17-31)
INT or UNSIGNED
(1-16)STRINGOperation
NoNoYesYesYesUnsigned
arithmetic
YesYesYesYesYesSigned arithmetic
NoNoYesYesYesLogical
operations
YesYesYesYesYesRelational
operations
48 Data Representation