Formatting Output - IBM 5110 User Manual

Apl
Table of Contents

Advertisement

96
FORMATTING OUTPUT
You can use the DPP system variable to specify the number of digits
to be displayed and printed for decimal numbers and for integers with
more than 10 digits. In a clear workspace, the OPP system variable is
set to 5 (default value). For exampfe:
:I. 23
1
+!5 , 67 ..... - - - A decimal number with seven digits.
1
~~31+b
L
Only five digits are displayed, and the least significant
digit is rounded off.
The value of OPP does not affect the internal precision of the system.
For example:
- Only five digits are printed.
1?31.~6-
n
P P
-E"
7 .... - - - - -
Change the printing precision to seven digits.
(.~
1~~~~I+~5,
67 .....
- - - - - - - N o t i c e that the value of A is still seven digits.
IJ
P P
~
..
:::.~
A
1 ,
~.:.~EL~
...
, , - - - - - - - - - E v e n though only two digits are printed, the
internal value of A in the system is seven digits.
Although the OPP system variable allows you to specify the number of
significant digits printed for decimal numbers or integers with more
than 10 digits, there might be times when even more control is needed
for the printed output. The
~
(format) function allows you to
specify the precision and spacing of numeric data. The
~
function
also converts the numeric data to character data. This makes it easier
to print the formatted numeric data with other character data. For
example:
'THE CLASS AVERAGE
D()r'1f~~
I N E
I~ I~n I~
IS:
I
}
GO
~Numeric
Value
'THE CI .. ,ASB AVE 1: < (.lGE
IS:
I
}
B 0 "'''--You cannot join numeric
A
and character data
· THE
CLAnE AVE
r~AGE
I
B :
THE CLASS AVERAGE
IS:
80
t
• } 'f"BO
' - -The Format Function
The Printed Result

Advertisement

Table of Contents
loading

Table of Contents