Was this helpful?
Numeric Format G
The G format uses an F format specification if there is enough room in the field, or E format if there is not enough room.
The syntax of the G format specification is:
[-|*|+] gw[.d]
where:
w
Specifies the maximum field width.
d
Specifies the precision or the number of digits to print after the decimal point.
You can specify either an uppercase G or lowercase g, which determines the case of the “e” if the value is printed in scientific notation. For a full description of the meanings of w and d, see the descriptions of Numeric Format E and Numeric Format F.
Report-Writer aligns data on the decimal point and then justifies the entire column right or left, according to the sign specified. By default, the column of numbers is right justified. To align F format numbers with E format numbers, Report-Writer right justifies F format numbers to a location several spaces in from the right edge of the field to account for the space taken up by the E format's exponential power designator—that is, five spaces for E+|-ppp.
The following table of examples illustrates the G format. The carets (^) in the Output column are used here only to show where blanks occur in the output; they do not print in your report.
Format
Value
Output
g11.2
123.456
123.46^^^^^
G11.2
123456
^12.35E+004
g12.2
-134.65
-134.65^^^^^
g9
-123
^^^^^-123
+g11.2
123.45
^^^^^123.45
-g11.2
123.45
123.45^^^^^
Last modified date: 04/03/2024