FORMAT edit descriptors

FORMAT edit descriptors

The following specifiers are edit descriptors that can be used with the FORMAT statement. Generally, w represents an integer specifying the field width and m represents an integer specifying the number of digits to be displayed. Under Fortran 95, if w is set to zero, then the field width is automatically set to the minimum value that can be used.

I <w.m>

B <w.m>
Integer as binary

O <w.m>
Integer as octal

Z <w.m>
Integer as hexadecimal

F <w.d>
Real, fixed form

E <w.dEe>
Real, exponent form

EN <w.dEe>
Engineering notation (exponent is 0 or divisible by 3)

ES <w.dEe>
Scientific notation, non-zero significands are greater than or equal to 1.0 and less than 10.0 (see note below)

G <w.dEe>
General, for any intrinsic data type

L <w>

A <w>

D <w.d>
Real (D used as exponent letter)

Hollerith (obsolescent feature, should be avoided)

ESw.d edit descriptors are explicitly restricted by the standard to numbers where the absolute value of the decimal exponent is less than 1000. If the decimal exponent of the number is outside of this range, then the decimal exponent is divided by 10 and preceded by a dollar sign "$" if positive and an equals sign "=" if negative. For example, if 1e2000 were written using ES12.3, the result would be "xxx1.000$200" where x is a space. If 1e-2000 were written using ES12.3, the result would be "xxx1.000=200" where x is a space. To avoid this situation use the ESw.dEe edit descriptor.



Copyright © 1999-2021 Silverfrost Limited