BDE 4.14.0 Production release
|
Provide an attribute class to configure decimal formatting.
This component provides a single, simply constrained (value-semantic) attribute class, bdldfp::DecimalFormatConfig
, that is used to configure various aspects of decimal value formatting.
style
: control how the decimal number is written. If style
is e_SCIENTIFIC
, the number is written as its sign, then a single digit, then the decimal point, then precision
digits, then the exponent
character, then a -
or +
, then an exponent with no leading zeroes (with a zero exponent written as 0
). If style
is e_FIXED
, the number is written as its sign, then one or more digits, then the decimal point, then precision
digits. If the precision
value equals 0
then precision
digits and the decimal point are not written. If style
is e_NATURAL
, the number is written according to the description of to-scientific-string
found in http://speleotrove.com/decimal/decarith.pdf (and no other specified formatting values are used, including precision).precision
: control how many digits are written after the decimal point if the decimal number is rendered in e_FIXED
and e_SCIENTIFIC
formats. Note that precision
attribute is ignored in e_NATURAL
format.sign
: control how the sign is output. If a decimal value has its sign bit set, a -
is always written. Otherwise, if sign
is e_NEGATIVE_ONLY
, no sign is written. If it is e_ALWAYS
, a +
is written.infinity
: specify a string to output infinity value.nan
: specify a string to output NaN value.snan
: specify a string to output signaling NaN value.point
: specify the character to use for decimal points.exponent
: specify the character to use for exponent when style
is e_SCIENTIFIC
or e_NATURAL
.showpoint
: specify whether a decimal point is always displayed.expwidth
: control the minimum number of digits used to write the exponent.