Next: Flags, Up: Numeric Output Format [Contents][Index]
The format specification recognized with the --output-format
option is a subset of that for printf
. The format specification has
the form
%
[flags][width][.
precision]type;
it must begin with ‘%’, and must end with a floating-point type
specifier:
‘g’ or ‘G’ to specify the number of significant digits,
‘e’ or ‘E’ for scientific notation, and ‘f’ for
fixed-point decimal. The ISO C99 standard added the ‘F’ type for
fixed-point decimal and the ‘a’ and ‘A’ types for hexadecimal
floating point; these types are allowed with compilers that support
them. Type length modifiers (e.g., ‘L’ to indicate a long double)
are inapplicable and are not allowed.
The default format for units
is ‘%.8g’;
for greater precision, you could specify -o %.15g.
The ‘g’ and ‘G’ format types use exponential format whenever
the exponent would be less than
The format specification may include one or more optional flags: ‘+’, ‘ ’ (space), ‘#’, ‘-’, or ‘0’ (the digit zero). The digit-grouping flag ‘'’ (apostrophe) is allowed with compilers that support it. Flags are followed by an optional value for the minimum field width, and an optional precision specification that begins with a period (e.g., ‘.6’). The field width includes the digits, decimal point, the exponent, thousands separators (with the digit-grouping flag), and the sign if any of these are shown.
Next: Flags, Up: Numeric Output Format [Contents][Index]