### 11.2.4.1 F Editing

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

  Fw.d

The value of d (the number of places after the decimal point) must not exceed the value of w (the field width).

The specified I/O list item must be of type real, or it must be the real or imaginary part of a complex type.

Rules for Input Processing

On input, the F data edit descriptor transfers w characters from an external field and assigns their real value to the corresponding I/O list item. The external field data must be an integer or real constant.

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

If the input field does not contain a decimal point or an exponent, it is treated as a real number of w digits, with d digits to the right of the decimal point. (Leading zeros are added, if necessary.)

If the input field contains a decimal point, the location of that decimal point overrides the location specified by the F 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 shows input using the F edit descriptor:

    Format    Input         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

Rules for Output Processing

On output, the F data edit descriptor transfers the real value of the corresponding I/O list item, right-justified and rounded to d decimal positions, to an external field that is w characters long.

The w must be greater than or equal to d+3 to allow for the following:

- A sign (optional if the value is positive and descriptor SP is not in effect)
- At least one digit to the left of the decimal point
- The decimal point
- The d digits to the right of the decimal point

The following shows output using the F edit descriptor (the symbol ^ represents a nonprinting blank character):

    Format      Value             Output
    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

For More Information:

- On the form for data edit descriptors, see Section 11.2.1.
- On general rules for numeric editing, see Section 11.2.2.

Previous Page Next Page Table of Contents