FORTRAN Reference Manual

Statements
FORTRAN Reference Manual528615-001
7-45
Editing Numeric Data
The F Descriptor
The F descriptor specifies conversion between an internal real or double precision
number and an external floating-point number with or without an exponent. The F w. d
form specifies that the field occupies w positions, the fractional part of which consists of
d digits.
The input field consists of an optional sign, followed by a string of digits, optionally
containing a decimal point. If the input field does not contain a decimal point,
FORTRAN interprets the rightmost d digits, with leading zeros assumed if necessary,
as the fractional part of the value. The basic form can be followed by an exponent in
one of the following forms:
Signed integer constant
integer-constant
E or D, followed by zero or more blanks, followed by an optionally signed integer
constant
integer-constant
The output field consists of zero or more leading blanks followed by a minus sign if
the internal value is negative, or an optional plus sign, followed by a string of digits
containing a decimal point that represents the magnitude of the internal value,
modified by any scale factor in effect and rounded to d fractional digits. A leading
zero is inserted to the left of the decimal point only if the value is less than one.
The following example processes the input record and stores 452.301 in A and
1.E-04 in B. (Circumflexes indicate blanks.)
READ (*,8) a, b
8 FORMAT ( F7.3, 2X, F5.4)
Input record:
^
452301
^^
.001
^
The following example displays the values shown (circumflexes indicate blanks):
x = .32812
y = 45.439
WRITE (*,7) x, y
7 FORMAT (5X, F4.3, 2X, F4.0)
Output:
^^^^^
.328
^^^
45.
+
-
E
D



+
-