pTAL Reference Manual (H06.03+)

Compiler Directives
HP pTAL Reference Manual523746-005
17-53
ROUND
ROUND
ROUND rounds FIXED values assigned to FIXED variables that have smaller fpoint
values than the values you are assigning.
ROUND
turns on rounding. If the fpoint of the assignment value is greater than that of
the variable, ROUND first truncates the assignment value so that its fpoint is
one greater than that of the destination variable. The truncated assignment value is
then rounded away from zero as follows:
value = (IF value < 0 THEN value 5 ELSE value + 5) / 10
In other words, if the truncated assignment value is negative, 5 is subtracted; if
positive, 5 is added. Then, an integer division by 10 is performed, and the result is
truncated again, this time by a factor of 10. Thus, if the absolute value of the least
significant digit of the initially truncated assignment value is 5 or more, a 1 is added
to the absolute value of the final least significant digit.
Default: None
Placement:
With a parenthesized list, it can appear anywhere
Without a parenthesized list, it must be the last directive on the
directive line or compilation command line
Scope: Applies to the compilation unit
Dependencies: Interacts with:
DEFINETOG
SETTOG
IF
IFNOT
ENDIF
See Toggles
on page 17-5.
References:
DEFINETOG on page 17-25
ENDIF on page 17-27
IF and IFNOT on page 17-36
SETTOG on page 17-56
ROUND
NOROUND
VST165.vsd