TAL Programmer's Guide

Simple Variables by Data Type
Using Simple Variables
096254 Tandem Computers Incorporated 6–11
FIXED Simple Variables A FIXED simple variable can contain a signed 64-bit fixed-point number in the range
–9,223,372,036,854,775,808 through 9,223,372,036,854,775,807, suffixed by F for decimal,
octal, or binary numbers or %F for hexadecimal numbers. For decimal numbers, you
can also specify a fractional part, preceded by a decimal point:
300.667F !FIXED decimal number with
! fractional part
You can initialize a FIXED variable with a character string when you declare the
variable. You cannot, however, use an assignment statement to assign a character
string to a FIXED variable.
Fixed-Point Settings (fpoints)
When you declare a FIXED variable, you can specify the implied fixed-point setting
(fpoint) for values stored in the variable. The fpoint is an integer in the range –19
through 19, enclosed in parentheses, following the FIXED keyword. The default fpoint
is 0. You can specify a positive or negative fpoint.
Positive fpoints. A positive fpoint specifies the number of decimal places to the right of
the decimal point:
FIXED(3) x := 0.642F; !Stored as 642; accessed
! as 0.642
Take care to specify an fpoint that allows enough decimal places for all the data that
you might assign to the variable. The system truncates any assignment value that
does not fit. For example, if you declare a FIXED(2) variable and then assign a value
that has three decimal places, the rightmost digit is lost:
FIXED(2) some_num; !
fpoint
is 2
some_num := 2.348F; !Stored as 234; accessed
! as 2.34
Negative fpoints. A negative fpoint specifies a number of integer places to the left of the
decimal point. To store a value, a negative fpoint truncates digits leftward from the
decimal point in accordance with the fpoint. When you access the value, zeros replace
the truncated digits:
FIXED(-3) y := 642913F; !Stored as 642; accessed
! as 642000
FIXED(*)
If you declare a FIXED(*) simple variable, the value stored in the variable is not scaled.