// length of the key minus one. We only support magnitudes less than COMPACT_MAX_DIGITS;
// ignore entries that have greater magnitude.
auto magnitude = static_cast<int8_t> (strlen(key) - 1);
- if (magnitude >= COMPACT_MAX_DIGITS) {
+ U_ASSERT(magnitude < COMPACT_MAX_DIGITS); // debug assert
+ if (magnitude >= COMPACT_MAX_DIGITS) { // skip in production
continue;
}
int8_t multiplier = data.multipliers[magnitude];
U_NAMESPACE_BEGIN namespace number {
namespace impl {
-static const int32_t COMPACT_MAX_DIGITS = 15;
+static const int32_t COMPACT_MAX_DIGITS = 20;
class CompactData : public MultiplierProducer {
public:
{1.23456789E11, "1200\\u5104"},
{1.23456789E12, "1.2\\u5146"},
{1.23456789E13, "12\\u5146"},
- {1.23456789E14, "120\\u5146"}};
+ {1.23456789E14, "120\\u5146"},
+ {1.23456789E15, "1200\\u5146"},
+ {1.23456789E16, "1.2\\u4EAC"},
+ {1.23456789E17, "12\\u4EAC"},
+ {1.23456789E18, "120\\u4EAC"},
+ {1.23456789E19, "1200\\u4EAC"}};
static ExpectedResult kSwahiliShort[] = {
{1234.0, "elfu\\u00a01.2"},
private byte largestMagnitude;
private boolean isEmpty;
- private static final int COMPACT_MAX_DIGITS = 15;
+ private static final int COMPACT_MAX_DIGITS = 20;
public CompactData() {
patterns = new String[(CompactData.COMPACT_MAX_DIGITS + 1) * StandardPlural.COUNT];
{1234567890123f, "1.2兆"},
{12345678901234f, "12兆"},
{123456789012345f, "120兆"},
+ {1234567890123456f, "1200兆"},
+ {12345678901234567f, "1.2京"},
+ {123456789012345678f, "12京"},
+ {1234567890123456789f, "120京"},
+ {12345678901234567890f, "1200京"},
};
Object[][] ChineseTestData = {