Skip to content

Commit

Permalink
Update icu4c/source/i18n/messageformat2_function_registry.cpp
Browse files Browse the repository at this point in the history
Co-authored-by: Elango Cheran <[email protected]>
  • Loading branch information
catamorphism and echeran authored Sep 16, 2024
1 parent 2c18c92 commit 1a8fdb5
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions icu4c/source/i18n/messageformat2_function_registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,17 +482,12 @@ static int32_t parseDigits(const UnicodeString& s, int32_t& i) {

static double parseDecimalPart(const UnicodeString& s, int32_t& i) {
int32_t firstDigit = i;
// Assumes that i < s.length() and s[i] is a digit
while (isDigit(s[i])) {
i++;
}
int32_t numDigits = i - firstDigit;
double placeValue = 10;
double result = 0;
for (int32_t j = firstDigit; j < firstDigit + numDigits; j++) {
result += ((double) parseDigit(s[j])) / placeValue;
placeValue *= 10;
double result = (double) parseDigits(s, i);
int32_t denominator = 1;
for (int32_t j = i; j > firstDigit; j--) {
denominator *= 10;
}
result /= denominator;
return result;
}

Expand Down

0 comments on commit 1a8fdb5

Please sign in to comment.