ICU Proposal: change to scientific number format behavior
Doug Felt <[email protected]>
| Newsgroups | gmane.comp.lib.icu.general |
|---|---|
| Message-ID | <[email protected]> |
This proposal affects both ICU4J and ICU4C. Please comment by Oct 31, 2003.
In DecimalFormat, setScientificNotation(true) currently changes the state of
the formatter slightly-- it ensures that the minimum number of exponent digits
is at least 1. Although it makes this change, it does not make other changes--
for example, it does not ensure that the maximum number of integer digits is a
reasonable number. The problem with this (see jb2552) is that using a
formatter with a high maximum outputs text with a large number of 0's.
This proposal is to change the behavior of setScientificNotation in two ways:
1) no longer change the state of the formatter representing the number of
exponent digits (though it will continue to behave as though the minumum is 1)
2) if the maximum number of integer digits is > 8, behave as though the maximum
is 1.
This will allow a single call to setScientificNotation(true) to produce a
formatter that formats numbers in a reasonable manner, and will ensure that a
subsequent call to setScientificNotation(false) restores the original
formatter. The value 8 was chosen as a reasonable upper limit for people using
exponential notation.
Other than the implementation change, the only API change is the following
documentation change to setScientificNotation:
/**
* <strong><font face=helvetica color=red>NEW</font></strong>
* Set whether or not scientific notation is used. When scientific
notation
* is used, the effective maximum number of integer digits is <= 8. If the
* maximum number of integer digits is set to more than 8, the effective
* maximum will be 1. This allows this call to generate a 'default'
* scientific number format without additional changes.
[...]
*/
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com