Generic Device Driver
Format Instructions in Detail
The optional parameters m and n of the general variable reference @[m][.n]f,<name>@ are of special interest.
In the simplest case, m is the abstract number for the entire length of the formatted numerical output, including a possibly existing decimal point. Additional information can also be included (for example: left-align or right-align numerical output in the output field, fill superfluous places with blank spaces ( ) or zero (0), etc.).
n represents the number of decimal places (sensible only for floating point numbers, not available for integer variables).
Example:
The following table contains various format instructions for integer and floating-point numbers. The output resulting from these instructions appears on the right. The quotation marks serve to indicate the orientation of the numbers within the output field that is part of the entire command string!
Number |
Type |
Format instruction |
Result |
1234 |
Integer |
@d |
"1234" |
1234 |
Integer |
@5d |
" 1234" |
1234 |
Integer |
@05d |
"01234" |
1234 |
Integer |
@09d |
"000001234" |
1234 |
Integer |
@-7d |
"1234 " |
1234 |
Integer |
@o |
"2332" |
1234 |
Integer |
@x |
"4d2" |
1234 |
Integer |
@X |
"4D2" |
-1234 |
Integer |
@x |
"fffffb2f" |
|
|
|
|
1234.5678 |
Floating point |
@f |
"1234.567800" |
1234.5678 |
Floating point |
@.4f |
"1234.5678" |
1234.5678 |
Floating point |
@.3f |
"1234.568" |
1234.5678 |
Floating point |
@6.2f |
"1234.57" |
1234.5678 |
Floating point |
@5.2f |
"1234.57 |
1234.5678 |
Floating point |
@-15.2f |
"1234.57 " |
1234.5678 |
Floating point |
@15.2f |
" 1234.57" |