Location:
e32std.h
Supported from 5.0
Constants which define the format of the character representation of a real number.
These values are set into the iType
data member of
TRealFormat
.
These constants define the general format of the character
representation of a real number. The iType
data member of
TRealFormat
is set to one of these:
const TInt KRealFormatFixed
The real number is converted to fixed format which has the general pattern: "nnn.ddd", where nnn is the integer portion and ddd is the decimal portion. A negative value is prefixed by a minus sign.
The number of decimal places generated is defined by the
value of TRealFormat::iPlaces
. Trailing zeroes are generated as
required. If necessary, the decimal portion is rounded to fit the
specification. If this value is zero, no decimal point and no decimal portion
is generated.
Triad separation is available — defined by
TRealFormat::iTriad
and TRealFormat::iTriLen
.
(N.B. a zero value is converted either to the form "0.000..."
with iPlaces
'0' characters after the decimal point, if
iPlaces
is greater than zero, or to "0" if iPlaces
is
zero.)
const TInt KRealFormatExponent
The real number is converted to scientific format with one non-zero digit before the decimal point and a number of digits after the decimal point. Hence the number has the general pattern: "n.dddE+ee" or "n.dddE-ee", or "n.dddE+eee" or "n.dddE-eee".
The decimal portion is followed by the character 'E', a sign ('+' or '-') and the exponent as two digits, including leading zeroes, if necessary. If necessary, the decimal portion is rounded.
A negative value is prefixed by a minus sign.
If the flag KUseSigFigs
is not set,
TRealFormat::iPlaces
defines the number of digits which follow the
decimal point. If the flag KUseSigFigs
is set,
iPlaces
defines the maximum number of significant digits to be
generated.
Note that, by default, exponents are limited to two digits.
Those numbers that require three digits must have the flag
KAllowThreeDigitExp
set. If iPlaces
is zero, the
value is rounded to one digit of precision and no decimal point is
included.
Triad separation is not available.
(N.B. a zero value is converted either to the form
"0.000...E+00" with iPlaces
'0' characters after the decimal
point, if iPlaces
is greater than zero, or to "0E+00" if
iPlaces
is zero.)
const TInt KRealFormatGeneral
The real number is converted either to fixed or scientific format. The format chosen is the one which can present the greater number of significant digits. Where both formats can present the same number of significant digits, fixed format is used.
The number of decimal places generated depends only on the
value of TRealFormat::iWidth
; the value of the
iPlaces
member is ignored.
Trailing zeroes in the decimal portion are discarded.
Triad separation is not available.
(N.B. a zero value is converted to "0")
const TInt KRealFormatNoExponent
The same as KRealFormatFixed
but the
TRealFormat::iPlaces
is interpreted as specifying the maximum
number of significant digits.
Trailing zeroes in the decimal portion are discarded.
const TInt KRealFormatCalculator
The same as KRealFormatGeneral
but
TRealFormat::iPlaces
is interpreted as specifying the maximum
number of significant digits, and the number is displayed without an exponent
whenever possible.
Trailing zeroes in the decimal portion are discarded.
These flags modify the format of the character representation
of a real number as defined by the format types. One of more of these flags
should be set into the iType
data member of
TRealFormat
after setting one of the format
types.
const TInt KExtraSpaceForSign
This flag reduces the effective width by one character. This
forces a large enough value for TRealFormat::iWidth
to be chosen
to guarantee that positive and negative numbers can be shown to the same
precision.
Applies when TRealFormat::iType
is set to
KRealFormatFixed
or
KRealFormatGeneral
.
const TInt KAllowThreeDigitExp
Setting this flag allows an exponent to be formatted whose magnitude is greater than 100. If this flag is not set, an attempt to format such a number fails.
If set, three digit exponents are allowed. If not set, only two digit exponents are allowed.
Applies when TRealFormat::iType
is set
toKRealFormatExponent
orKRealFormatGeneral
.
const TInt KDoNotUseTriads
Disables triad separation.
Applies when TRealFormat::iType
is set
toKRealFormatFixed
orKRealFormatNoExponent
.
const TInt KGeneralLimit
If set, this flag limits the precision to
KPrecisionLimit
digits. If not set, the precision defaults to
KMaxPrecision
digits.
const TInt KUseSigFigs
If set, the TRealFormat::iPlaces
member is
interpreted as the maximum number of significant digits to be generated.
Applies when TRealFormat::iType
is set
toKRealFormatExponent
.