HP Pascal/iX Reference Manual (31502-90022)

10- 24
| | |
| string literal | length of string literal |
| | |
---------------------------------------------------------------------------
* If $STANDARD_LEVEL$ is not ANSI or ISO, then the default width of TRUE
is 4.
NOTE If
e
is Boolean or an enumerated type, the case of the letters
written is implementation defined.
When
m
is specified and the value of
e
requires less than
m
characters
for its representation, the operation writes
e
on
f
preceded by an
appropriate number of blanks. If the value of
e
is longer than
m
, it is
written on
f
without loss of significance; such that
m
is defeated,
provided that
e
is a numeric type. Otherwise, the operation writes only
the leftmost
m
characters.
m
may be 0 if
e
is not a numeric type.
When
e
is type real or longreal, you may specify
n
as well as
m
. In this
case, the operation writes
e
in fixed-point format with
n
digits after
the decimal point. If
n
is 0, the decimal point and subsequent digits
are omitted. If
n
is not specified, the operation writes
e
in
floating-point format consisting of a coefficient and a scale factor. In
no case is it possible to write more significant digits than the internal
representation contains. This means write may change a fixed-point
format to a floating-point format in certain circumstances.
Example
PROGRAM show_formats (output);
VAR
x: real;
lr: longreal;
george: boolean;
list: (yes, no, maybe);
BEGIN
writeln(999); {default formatting}
writeln(999:1); {format defeated}
writeln('abc');
writeln('abc':2); {string literal truncated}
x:= 10.999;
writeln(x); {default formatting}
writeln(x:25);
writeln(x:25:5);
writeln(x:25:1);
writeln(x:25:0);
lr:= 19.1111;
writeln(lr);
george:= true;
writeln(george); {default format}
writeln(george:2);
list:= maybe;
writeln(list); {default formatting}
END.
Output:
999
999
abc
ab
1.099900E+01
1.099900E+01
10.99900