mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-15 01:42:37 +00:00
ICU-8460 Fixed bug with formatting 0.
X-SVN-Rev: 31568
This commit is contained in:
parent
2d515412de
commit
4f9f1f602c
2 changed files with 5 additions and 1 deletions
|
@ -174,7 +174,7 @@ public class CompactDecimalFormat extends DecimalFormat {
|
|||
if (number < 0.0d) {
|
||||
throw new UnsupportedOperationException("CompactDecimalFormat doesn't handle negative numbers yet.");
|
||||
}
|
||||
int integerCount = (int) Math.log10(number);
|
||||
int integerCount = number <= 1.0d ? 0 : (int) Math.log10(number);
|
||||
int base = integerCount > 14 ? 14 : integerCount;
|
||||
number = number / divisor[base];
|
||||
setPositivePrefix(prefix[base]);
|
||||
|
|
|
@ -20,6 +20,9 @@ public class CompactDecimalFormatTest extends TestFmwk {
|
|||
|
||||
Object[][] EnglishTestData = {
|
||||
// default is 2 digits of accuracy
|
||||
{0.0d, "0.0"},
|
||||
{0.1d, "0.1"},
|
||||
{1d, "1"},
|
||||
{1234, "1.2K"},
|
||||
{12345, "12K"},
|
||||
{123456, "120K"},
|
||||
|
@ -32,6 +35,7 @@ public class CompactDecimalFormatTest extends TestFmwk {
|
|||
{1234567890123f, "1.2T"},
|
||||
{12345678901234f, "12T"},
|
||||
{123456789012345f, "120T"},
|
||||
{12345678901234567890f, "12000000T"},
|
||||
};
|
||||
|
||||
Object[][] JapaneseTestData = {
|
||||
|
|
Loading…
Add table
Reference in a new issue