SHA256
1
0
forked from pool/icu

another try at icu-avoid-x87-excess-precision.diff

OBS-URL: https://build.opensuse.org/package/show/X11:common:Factory/icu?expand=0&rev=94
This commit is contained in:
Jan Engelhardt 2018-08-07 12:01:01 +00:00 committed by Git OBS Bridge
parent ae11f22b17
commit 7c06f078d1

View File

@ -1,46 +1,38 @@
From: Jan Engelhardt <jengelh@inai.de>
Date: 2018-08-06 22:57:07.717647182 +0200
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 ++++---- source/test/intltest/dcfmapts.cpp | 10 ++++++----
1 file changed, 4 insertions(+), 4 deletions(-) 1 file changed, 6 insertions(+), 4 deletions(-)
Index: icu/source/test/intltest/dcfmapts.cpp Index: icu/source/test/intltest/dcfmapts.cpp
=================================================================== ===================================================================
--- icu.orig/source/test/intltest/dcfmapts.cpp --- icu.orig/source/test/intltest/dcfmapts.cpp
+++ icu/source/test/intltest/dcfmapts.cpp +++ icu/source/test/intltest/dcfmapts.cpp
@@ -851,7 +851,7 @@ void IntlTestDecimalFormatAPI::TestFixed @@ -851,7 +851,8 @@ void IntlTestDecimalFormatAPI::TestFixed
ASSERT_EQUAL(22, fd.getPluralOperand(PLURAL_OPERAND_V)); ASSERT_EQUAL(22, fd.getPluralOperand(PLURAL_OPERAND_V));
ASSERT_EQUAL(1234567890123456789LL, fd.getPluralOperand(PLURAL_OPERAND_F)); ASSERT_EQUAL(1234567890123456789LL, fd.getPluralOperand(PLURAL_OPERAND_F));
ASSERT_EQUAL(1234567890123456789LL, fd.getPluralOperand(PLURAL_OPERAND_T)); ASSERT_EQUAL(1234567890123456789LL, fd.getPluralOperand(PLURAL_OPERAND_T));
- ASSERT_EQUAL(345678901234567890LL, fd.getPluralOperand(PLURAL_OPERAND_I)); - ASSERT_EQUAL(345678901234567890LL, fd.getPluralOperand(PLURAL_OPERAND_I));
+ ASSERT_EQUAL(345678901234567890LL, (long long)fd.getPluralOperand(PLURAL_OPERAND_I)); + volatile double xxa = fd.getPluralOperand(PLURAL_OPERAND_I);
+ ASSERT_EQUAL(345678901234567890LL, xxa);
ASSERT_EQUAL(FALSE, fd.hasIntegerValue()); ASSERT_EQUAL(FALSE, fd.hasIntegerValue());
ASSERT_EQUAL(FALSE, fd.isNegative()); ASSERT_EQUAL(FALSE, fd.isNegative());
@@ -948,13 +948,13 @@ void IntlTestDecimalFormatAPI::TestFixed @@ -947,14 +948,15 @@ void IntlTestDecimalFormatAPI::TestFixed
// note: going through DigitList path to FixedDecimal, which is trimming
// int64_t fields to 18 digits. See ticket Ticket #10374 // int64_t fields to 18 digits. See ticket Ticket #10374
// ASSERT_EQUAL(223372036854775807LL, fd.getPluralOperand(PLURAL_OPERAND_I); // ASSERT_EQUAL(223372036854775807LL, fd.getPluralOperand(PLURAL_OPERAND_I);
+ volatile double xxb = fd.getPluralOperand(PLURAL_OPERAND_I);
if (!( if (!(
- fd.getPluralOperand(PLURAL_OPERAND_I) == 223372036854775807LL || - fd.getPluralOperand(PLURAL_OPERAND_I) == 223372036854775807LL ||
- fd.getPluralOperand(PLURAL_OPERAND_I) == 9223372036854775807LL)) { - fd.getPluralOperand(PLURAL_OPERAND_I) == 9223372036854775807LL)) {
+ (long long)fd.getPluralOperand(PLURAL_OPERAND_I) == 223372036854775807LL || + xxb == 223372036854775807LL ||
+ (long long)fd.getPluralOperand(PLURAL_OPERAND_I) == 9223372036854775807LL)) { + xxb == 9223372036854775807LL)) {
dataerrln( dataerrln(
"File %s, Line %d, fd.getPluralOperand(PLURAL_OPERAND_I = %lld", "File %s, Line %d, fd.getPluralOperand(PLURAL_OPERAND_I = %lld",
__FILE__, __FILE__,
__LINE__, __LINE__,
- fd.getPluralOperand(PLURAL_OPERAND_I)); - fd.getPluralOperand(PLURAL_OPERAND_I));
+ (long long)fd.getPluralOperand(PLURAL_OPERAND_I)); + xxb);
} }
ASSERT_EQUAL(TRUE, fd.hasIntegerValue()); ASSERT_EQUAL(TRUE, fd.hasIntegerValue());
ASSERT_EQUAL(FALSE, fd.isNegative()); ASSERT_EQUAL(FALSE, fd.isNegative());