インテル® Fortran コンパイラー XE 13.1 ユーザー・リファレンス・ガイド
The G data edit descriptor generally transfers values of real type, but it can be used to transfer values of any intrinsic type. It takes the following form:
Gw.d[Ee]
The value of d (the number of places after the decimal point) plus e (the number of digits in the exponent) must not exceed the value of w (the field width), unless w is zero. If w is zero, you can only specify forms G0 or G0.d.
When w is zero, the processor selects the field width. On input, w must not be zero.
The specified I/O list item can be of any intrinsic type.
When used to specify I/O for integer, logical, or character data, the edit descriptor follows the same rules as Iw, Lw, and Aw, respectively, and d and e have no effect.
On input, the G data edit descriptor transfers w characters from an external field and assigns their real value to the corresponding I/O list item. The G descriptor interprets and assigns input data in the same way as the F data edit descriptor.
Data Magnitude |
Effective Conversion |
---|---|
N = 0 |
F(w - n).(d -1), n('b') |
0.1 - r x 10-d-1 <= N < 1 - r x 10-d |
F(w - n).d, n('b') |
1 - r x 10-d <= N < 10 - r x 10-d+1 |
F(w - n).(d -1), n('b') |
10 - r x 10-d+1 <= N < 100 - r x 10-d+2 |
F(w - n).(d -2), n('b') |
. |
. |
. |
. |
. |
. |
10d-2 - r x 10-2 <= N < 10d-1 - r x 10-1 |
F(w - n).1, n('b') |
10d-1 - r x 10-1 <= N < 10d - r |
(w - n).0, n('b') |
The 'b' is a blank following the numeric data representation. For Gw.d, n('b') is 4 blanks. For Gw.dEe, n('b' ) is e+2 blanks.
Rounding Mode |
r |
---|---|
COMPATIBLE |
0.5 |
NEAREST |
0.5 if the higher value is even -0.5 if the lower value is even |
UP |
1 |
DOWN |
0 |
ZERO |
1 if the internal value is negative 0 if the internal value is positive |
The w should be greater than or equal to d+7 to allow for the following:
A sign (optional if the value is positive and descriptor SP is not in effect)
One digit to the left of the decimal point
The decimal point
The d digits to the right of the decimal point
The 4-digit or e+2-digit exponent
If e is specified, the w should be greater than or equal to d + e + 5.
For an internal value that is an IEEE infinity or an IEEE NaN, the form of the output field is the same as for Fw.d.
The following shows output using the G edit descriptor and compares it to output using equivalent F editing (the symbol ^ represents a nonprinting blank character):
Value Format Output with G Format Output with F
0.01234567 G13.6 ^0.123457E-01 F13.6 ^^^^^0.012346
-0.12345678 G13.6 -0.123457^^^^ F13.6 ^^^^-0.123457
1.23456789 G13.6 ^^1.23457^^^^ F13.6 ^^^^^1.234568
12.34567890 G13.6 ^^12.3457^^^^ F13.6 ^^^^12.345679
123.45678901 G13.6 ^^123.457^^^^ F13.6 ^^^123.456789
-1234.56789012 G13.6 ^-1234.57^^^^ F13.6 ^-1234.567890
12345.67890123 G13.6 ^^12345.7^^^^ F13.6 ^12345.678901
123456.78901234 G13.6 ^^123457.^^^^ F13.6 123456.789012
-1234567.89012345 G13.6 -0.123457E+07 F13.6 *************