The E specifier is for the exponential form of decimal real data items. The general form is:
E [ w [ .d ] [ Ee ] ]
w indicates that the field to be edited occupies w positions.
d indicates that the fractional part of the number (the part to the right of the decimal point) has d digits. However, if the input datum contains a decimal point, that decimal point overrides the d value.
e indicates the number of digits in the exponent field. The default is 2.
The specified input/output list item must be of type real. On input, the specified list item becomes defined with a real datum. On output, the specified list item must be defined as a real datum.
The output field for the E w.d edit specifier has the width w. The value is right-justified in that field. The field consists of zero or more leading blanks followed by either a minus if the value is negative, or an optional plus, followed by a zero, a decimal point, the magnitude of the value of the list item rounded to d decimal digits, and an exponent.
For the form Ew.d:
If | exponent | .le. 99, it has the form Enn or 0nn.
If 99 .le. | exponent | .le. 999, it has the form nnn.
For the form Ew.dEe, if | exponent | .le. ( 10^{e} ) - 1, then the exponent has the form nnn.
For the form Dw.d:
If | exponent | .le. 99, it has the form Dnn or Enn or 0nn.
If 99 £ | exponent | .le. 999, it has the form nnn.
n is any digit.
The sign in the exponent is required.
w need not allow for a minus sign, but must allow for a zero, the decimal point, and d digits to the right of the decimal point, and an exponent. Therefore, for nonnegative numbers, w .le. d+6; if e is present, then w .le. d+e+4. For negative numbers, w .le. d+7; if e is present, then w .le. d+e+5.
Example: Real input with E editing in the program, Einp.f:
CHARACTER L*40/'1234567E2 1234.67E-3 12.4567 '/ READ( L, '( E9.3, E12.3, E12.6 )') R, S, T PRINT '( E15.6, E15.6, E15.7 )', R, S, T END
¤¤¤0.123457E+06¤¤¤0.123467E+01¤¤0.1245670E+02
In the above example, the first input data item has no decimal point, so E9.3 determines the decimal point. The other input data items have decimal points, so those decimal points override the D edit descriptor as far as decimal points are concerned.
Example: Real output with E editing in the program Eout.f:
R = 1234.678 PRINT 1, R, R, R 1 FORMAT( E9.3 / E8.4 / E13.4 ) END
0.123E+04 ******** ¤¤¤0.1235E+04
In the above example, E8.4 does not allow for the sign, so we get asterisks. Also, the extra wide field of the E13.4 results in three leading blanks.
Example: Real output with Ew.dEe editing in the program EwdEe.f:
REAL X / 0.000789 / WRITE(*,'( E13.3)') X WRITE(*,'( E13.3E4)') X WRITE(*,'( E13.3E5)') X END
¤¤¤¤0.789E-03 ¤¤0.789E-0003 ¤0.789E-00003