pTAL Reference Manual (H06.08+)

Statements
HP pTAL Reference Manual523746-006
12-7
Assigning Numbers to FIXED Variables
You can use type-conversion built-in routines to convert some address types to other
address types. For more information:
Assigning Numbers to FIXED Variables
When you assign a number to a FIXED variable, the system scales the value up or
down to match the fpoint value. If the system scales the value down, you lose some
precision depending on the amount of scaling; for example:
FIXED(2) a;
a := 2.348F; ! System scales value to 2.34F
If the ROUND directive is active, the system scales the value as needed, then rounds
the value away from zero as follows:
(IF value < 0 THEN value - 5 ELSE value + 5) / 10
For example, if you assign 2.348F to a FIXED(2) variable, the ROUND directive scales
the value by one digit and then rounds it to 2.35F.
Assigning Character Strings
You can assign a character string to STRING, INT, or INT(32) variables.
If you assign a one-character string such as "A" to an INT simple variable, the system
places the value in the right byte of a word and 0 in the left byte. To store a character in
the left byte, assign the character and a space, as in:
"A "
If you assign a character string to a FIXED, REAL, or REAL(64) variable, the compiler
issues a type incompatibility error.
Topic See ...
Type-conversion built-in routines Section 15, Built-In Routines
Converting addresses Section 5, Expressions
Pointers Section 10, Pointers