SHA256
1
0
forked from pool/icu
icu/icu-avoid-x87-excess-precision.diff

47 lines
2.3 KiB
Diff

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 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: icu/source/test/intltest/dcfmapts.cpp
===================================================================
--- 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));
}
ASSERT_EQUAL(TRUE, fd.hasIntegerValue());
ASSERT_EQUAL(FALSE, fd.isNegative());