summaryrefslogtreecommitdiff
path: root/Build/source/libs/icu/icu-src/source/i18n/units_complexconverter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/icu/icu-src/source/i18n/units_complexconverter.cpp')
-rw-r--r--Build/source/libs/icu/icu-src/source/i18n/units_complexconverter.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/Build/source/libs/icu/icu-src/source/i18n/units_complexconverter.cpp b/Build/source/libs/icu/icu-src/source/i18n/units_complexconverter.cpp
index 78cefbf7ebb..ecbe3c78794 100644
--- a/Build/source/libs/icu/icu-src/source/i18n/units_complexconverter.cpp
+++ b/Build/source/libs/icu/icu-src/source/i18n/units_complexconverter.cpp
@@ -183,7 +183,7 @@ MaybeStackVector<Measure> ComplexUnitsConverter::convert(double quantity,
} else {
quantity = remainder;
}
- }
+ }
}
applyRounder(intValues, quantity, rounder, status);
@@ -210,7 +210,6 @@ MaybeStackVector<Measure> ComplexUnitsConverter::convert(double quantity,
}
}
-
// Transfer values into result and return:
for(int32_t i = 0, n = unitsConverters_.length(); i < n; ++i) {
U_ASSERT(tmpResult[i] != nullptr);
@@ -224,6 +223,12 @@ MaybeStackVector<Measure> ComplexUnitsConverter::convert(double quantity,
void ComplexUnitsConverter::applyRounder(MaybeStackArray<int64_t, 5> &intValues, double &quantity,
icu::number::impl::RoundingImpl *rounder,
UErrorCode &status) const {
+ if (uprv_isInfinite(quantity) || uprv_isNaN(quantity)) {
+ // Inf and NaN can't be rounded, and calculating `carry` below is known
+ // to fail on Gentoo on HPPA and OpenSUSE on riscv64. Nothing to do.
+ return;
+ }
+
if (rounder == nullptr) {
// Nothing to do for the quantity.
return;