Re: ICU Proposal: change to scientific number format behavior
George Rhoten <[email protected]>
| Newsgroups | gmane.comp.lib.icu.general |
|---|---|
| Message-ID | <OF3D2623EC.A1A32813-ON86256DC9.0056C238-88256DC9.005D5474@us.ibm.com> |
What does the value of 1 for maximum integer digits really mean? The maximum integer digits won't affect the exponent digits, right? Can you give an example? Will this change prevent me from setting the maximum number of integer digits to something like 20? If I format a 64-bit number, there are times that I will want to format the complete precision of that number (both with integer and scientific notation). George Rhoten IBM Globalization Center of Competency/ICU San José, CA, USA Doug Felt <[email protected]> Sent by: [email protected] 10/23/2003 04:56 PM To: [email protected] cc: Subject: ICU Proposal: change to scientific number format behavior 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 _______________________________________________ icu mailing list [email protected] http://oss.software.ibm.com/developerworks/oss/mailman/listinfo/icu