mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 22:44:49 +00:00
ICU-21693 Fix FormattedNumber::toDecimalNumber on 0
This commit is contained in:
parent
41aa7159ea
commit
e2acbdee22
2 changed files with 7 additions and 0 deletions
|
@ -639,6 +639,7 @@ DecNum& DecimalQuantity::toDecNum(DecNum& output, UErrorCode& status) const {
|
|||
// Special handling for zero
|
||||
if (precision == 0) {
|
||||
output.setTo("0", status);
|
||||
return output;
|
||||
}
|
||||
|
||||
// Use the BCD constructor. We need to do a little bit of work to convert, though.
|
||||
|
|
|
@ -5378,6 +5378,12 @@ void NumberFormatterApiTest::toDecimalNumber() {
|
|||
u"৯৮,৭৬,৫০,০০,০০,০০,০০০", fn.toString(status));
|
||||
assertEquals(u"Should have expected toDecimalNumber string result",
|
||||
"9.8765E+14", fn.toDecimalNumber<std::string>(status).c_str());
|
||||
|
||||
fn = NumberFormatter::withLocale("bn-BD").formatDouble(0, status);
|
||||
assertEquals("Should have expected localized string result",
|
||||
u"০", fn.toString(status));
|
||||
assertEquals(u"Should have expected toDecimalNumber string result",
|
||||
"0", fn.toDecimalNumber<std::string>(status).c_str());
|
||||
}
|
||||
|
||||
void NumberFormatterApiTest::microPropsInternals() {
|
||||
|
|
Loading…
Add table
Reference in a new issue