GF: Difference between revisions
Jump to navigation
Jump to search
(Created page with "GF reads and writes strings and numbers. It left justifies strings and right justifies numbers. Strings may be any value not exceeding the specified length. Numbers may includ...") |
No edit summary |
||
Line 1: | Line 1: | ||
GF | The '''GF (generic floating-point) format specification''' has been added for use by the FORM statement and by the INPUT / PRINT FIELDS. It is the same as [[G]] in that it can be used with either string or numeric data and in all other ways it is identical to [[L]] as used with INPUT and PRINT FIELDS. Note the following code fragment: | ||
00100 PRINT USING " 2*GF 10":333,444.44 | |||
;Outputs: | |||
333 444.44 | |||
GF left justifies strings and right justifies numbers. Strings may be any value not exceeding the specified length. Numbers may include a decimal point at any position and may have an exponent. | |||
The following program demonstrates this: | The following program demonstrates this: | ||
Line 7: | Line 15: | ||
00040 write #1,using 'form gf 14,c': 123456e-20,"X" | 00040 write #1,using 'form gf 14,c': 123456e-20,"X" | ||
This program produces a file with two records | This program produces a file with two records containing the following, where "bbb" represents three blank spaces: | ||
bbb1234.56X | bbb1234.56X | ||
1234.56bbbX | 1234.56bbbX | ||
bbb1.23456E-15X (the normalized form of the value) | bbb1.23456E-15X (the normalized form of the value) | ||
<noinclude> | |||
[[Category:Format Specifications]] | |||
</noinclude> |
Revision as of 01:03, 21 February 2013
The GF (generic floating-point) format specification has been added for use by the FORM statement and by the INPUT / PRINT FIELDS. It is the same as G in that it can be used with either string or numeric data and in all other ways it is identical to L as used with INPUT and PRINT FIELDS. Note the following code fragment:
00100 PRINT USING " 2*GF 10":333,444.44
- Outputs
333 444.44
GF left justifies strings and right justifies numbers. Strings may be any value not exceeding the specified length. Numbers may include a decimal point at any position and may have an exponent.
The following program demonstrates this:
00010 open #1: "name=xxx,recl=80,replace",internal,outin,relative 00020 write #1,using 'form gf 10,c': 1234.56,"X" 00030 write #1,using 'form gf 10,c': "1234.56","X" 00040 write #1,using 'form gf 14,c': 123456e-20,"X"
This program produces a file with two records containing the following, where "bbb" represents three blank spaces:
bbb1234.56X 1234.56bbbX bbb1.23456E-15X (the normalized form of the value)