diff --git a/icu-avoid-x87-excess-precision.diff b/icu-avoid-x87-excess-precision.diff index 538627b..bc04971 100644 --- a/icu-avoid-x87-excess-precision.diff +++ b/icu-avoid-x87-excess-precision.diff @@ -1,24 +1,46 @@ ---- - source/i18n/plurrule.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) +From: Jan Engelhardt +Date: 2018-08-06 22:57:07.717647182 +0200 -Index: icu/source/i18n/plurrule.cpp +getPluralOperand returns double, which causes the other operand to get +upconverted from long long to double, and there seems to be rounding errors on +i586 (possibly from excess precision, aka 80-bit floats). + +Since the result of getPluralOption is printed with %lld at one point, this +suggests that the result is intended to be downconverted to long long instead +of upconverting the LL constant. That's why we do not use a (volatile double) +cast here like in opensuse icu 61. + +--- + source/test/intltest/dcfmapts.cpp | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +Index: icu/source/test/intltest/dcfmapts.cpp =================================================================== ---- icu.orig/source/i18n/plurrule.cpp -+++ icu/source/i18n/plurrule.cpp -@@ -1566,13 +1566,13 @@ int64_t FixedDecimal::getFractionalDigit - return 0; +--- icu.orig/source/test/intltest/dcfmapts.cpp ++++ icu/source/test/intltest/dcfmapts.cpp +@@ -851,7 +851,7 @@ void IntlTestDecimalFormatAPI::TestFixed + ASSERT_EQUAL(22, fd.getPluralOperand(PLURAL_OPERAND_V)); + ASSERT_EQUAL(1234567890123456789LL, fd.getPluralOperand(PLURAL_OPERAND_F)); + ASSERT_EQUAL(1234567890123456789LL, fd.getPluralOperand(PLURAL_OPERAND_T)); +- ASSERT_EQUAL(345678901234567890LL, fd.getPluralOperand(PLURAL_OPERAND_I)); ++ ASSERT_EQUAL(345678901234567890LL, (long long)fd.getPluralOperand(PLURAL_OPERAND_I)); + ASSERT_EQUAL(FALSE, fd.hasIntegerValue()); + ASSERT_EQUAL(FALSE, fd.isNegative()); + +@@ -948,13 +948,13 @@ void IntlTestDecimalFormatAPI::TestFixed + // int64_t fields to 18 digits. See ticket Ticket #10374 + // ASSERT_EQUAL(223372036854775807LL, fd.getPluralOperand(PLURAL_OPERAND_I); + if (!( +- fd.getPluralOperand(PLURAL_OPERAND_I) == 223372036854775807LL || +- fd.getPluralOperand(PLURAL_OPERAND_I) == 9223372036854775807LL)) { ++ (long long)fd.getPluralOperand(PLURAL_OPERAND_I) == 223372036854775807LL || ++ (long long)fd.getPluralOperand(PLURAL_OPERAND_I) == 9223372036854775807LL)) { + dataerrln( + "File %s, Line %d, fd.getPluralOperand(PLURAL_OPERAND_I = %lld", + __FILE__, + __LINE__, +- fd.getPluralOperand(PLURAL_OPERAND_I)); ++ (long long)fd.getPluralOperand(PLURAL_OPERAND_I)); } - n = fabs(n); -- double fract = n - floor(n); -+ volatile double fract = n - floor(n); - switch (v) { - case 1: return (int64_t)(fract*10.0 + 0.5); - case 2: return (int64_t)(fract*100.0 + 0.5); - case 3: return (int64_t)(fract*1000.0 + 0.5); - default: -- double scaled = floor(fract * pow(10.0, (double)v) + 0.5); -+ volatile double scaled = floor(fract * pow(10.0, (double)v) + 0.5); - if (scaled > U_INT64_MAX) { - return U_INT64_MAX; - } else { + ASSERT_EQUAL(TRUE, fd.hasIntegerValue()); + ASSERT_EQUAL(FALSE, fd.isNegative());