Boolean objects, String objects – AMT Datasouth PAL User Manual
Page 18

12
PAL Language Reference
significant digits for their floating-point values. However, these six digits can represent the value 1
trillion (1,000,000,000,000) or 1 trillionth (0.000,000,000,001).
Floating-point values work very well in scientific applications. For example, specifying the dis-
tance to a star or the size of an atom. However, they do not work very well in business applica-
tions. Business applications tend to require a smaller range of values, but many more significant
digits. Few companies have the need to calculate their worth in the billions. And those companies
which do can afford super computers to count their money for them.
However, many companies require calculations in the tens of millions or less, with every digit
being significant. Floating-point values generally cannot keep track of sufficient digits to satisfy
this requirement. Therefore, PAL relies upon large fixed-point numbers instead of more con-
ventional floating-point values.
When the programmer includes a fixed-point value as part of a PAL sequence, the value must have
a particular format. The value may start with an optional plus (+) or minus (-) sign. If the
programmer does not include a plus or minus sign, PAL will assume a positive value. The value
must also have a digit, 0 through 9, both before and after a decimal point. When PAL sees the
decimal point, PAL knows to treat the value as a fixed-point value rather than an integer value.
The value may not include commas or other punctuation. If the programmer does not include a
digit both before and after the decimal point, PAL will treat the value as a name object rather than
a fixed-point object. For example, PAL treats "1." and ".1" as name objects. The programmer must
specify "1.0" or "0.1" in order for PAL to treat the objects as fixed-point numbers.
3.1.3.
Boolean Objects
Boolean objects can only have the value true or false. PAL usually creates boolean objects in
response to performing some test. For example, if the programmer instructs PAL to test two
integers for equality, PAL will create a boolean object which indicates the result of the test. If PAL
finds the integers equal, PAL will create a boolean object with the value true. If PAL does not find
the integers equal, PAL will create a boolean object with the value false.
PAL also includes definitions for the names true and false. The name true corresponds with a
boolean object having the value true. The name false corresponds with a boolean object having
the value false.
3.1.4. String Objects
Strings consists of a variable length collection of bytes. In simple applications, each byte usually
represents a printable character. A string can contain from zero to 30,000 bytes.
Since each string object can have a variable number of bytes associated with it, PAL stores the
string object and the collection of bytes (the string value) in separate parts of memory. The string
object contains only a reference to the string value.
When the programmer instructs PAL to perform an operation which causes PAL to duplicate a
string object, PAL only duplicates the object part of the string. PAL does not duplicate the value
portion of the string. As a result, the duplication creates two objects which both refer to the same
collection of bytes. Special operators exist which allow the programmer to instruct PAL to also
duplicate the value portion of the string.