### 8.3.2.1 F Field Descriptor

The F field descriptor transfers real values. It takes the following form:

    Fw.d

The corresponding I/O list element must have a real data type or it must be either the real or the imaginary part of a complex data type.

Input Processing

In an input statement, the F field descriptor transfers w characters from the external field and assigns them as a real value to the corresponding I/O list element.

Input processing with the F field descriptor behaves in the following ways:

- If the first nonblank character of the external field is a minus sign, the field is treated as a negative value.

- If the first nonblank character is a plus sign or if no sign appears in the field, the field is treated as a positive value.

- If a field is all blank, it is treated as a zero value.

- If a field contains only an exponent letter or decimal point, it is treated as a zero value.

- If the field contains neither a decimal point nor an exponent, it is treated as a real number of w digits, in which the rightmost d digits are to the right of the decimal point, with leading zeros assumed, if necessary.

- If the field contains an explicit decimal point, the location of that decimal point overrides the location specified by the field descriptor. If the field contains an exponent, that exponent is used to establish the magnitude of the value before it is assigned to the list element.

The following list illustrates valid input processing using the F field descriptor:

    Format    External Field       Internal Value

    F8.5      123456789              123.45678

    F8.5      -1234.567            -1234.56

    F8.5      24.77E+2              2477.0

    F5.2      1234567.89             123.45

Output Processing

In an output statement, the F field descriptor transfers the value of the corresponding I/O list element, rounded to d decimal positions and right-justified, to an external field that is w characters long.

If the value does not fill the field, leading spaces are inserted; if the value is too large for the field, the entire field is filled with asterisks.

The term w must be large enough to include all of the following:

- A minus sign (when necessary) or a plus sign (if SP editing is in effect)

- At least one digit to the left of the decimal point

- A decimal point

- The d digits to the right of the decimal

Therefore, w must be greater than or equal to d+3.

The following list illustrates valid output processing using the F field descriptor (the symbol ^ represents a nonprinting space character):

    Format     Internal Value       External Representation

    F8.5           2.3547188        ^2.35472

    F9.3        8789.7361           ^8789.736

    F2.1          51.44             **

    F10.4        -23.24352          ^^-23.2435

    F5.2         325.013            ******

    F5.2           -.2              -0.20

Previous Page Next Page Table of Contents