ICU-11276 Fixing test failure related to number range.

This commit is contained in:
Shane Carr 2018-09-07 07:41:19 -07:00
parent 55974b2fb6
commit d717184948
No known key found for this signature in database
GPG Key ID: FCED3B24AAB18B5C
2 changed files with 30 additions and 14 deletions

View File

@ -1154,8 +1154,13 @@ const char16_t* DecimalQuantity::checkHealth() const {
}
bool DecimalQuantity::operator==(const DecimalQuantity& other) const {
bool basicEquals = scale == other.scale && precision == other.precision && flags == other.flags
&& lOptPos == other.lOptPos && lReqPos == other.lReqPos && rReqPos == other.rReqPos
bool basicEquals =
scale == other.scale
&& precision == other.precision
&& flags == other.flags
&& lOptPos == other.lOptPos
&& lReqPos == other.lReqPos
&& rReqPos == other.rReqPos
&& rOptPos == other.rOptPos;
if (!basicEquals) {
return false;
@ -1163,13 +1168,16 @@ bool DecimalQuantity::operator==(const DecimalQuantity& other) const {
if (precision == 0) {
return true;
}
for (int m = getUpperDisplayMagnitude(); m >= getLowerDisplayMagnitude(); m--) {
if (getDigit(m) != other.getDigit(m)) {
return false;
} else if (isApproximate) {
return origDouble == other.origDouble && origDelta == other.origDelta;
} else {
for (int m = getUpperDisplayMagnitude(); m >= getLowerDisplayMagnitude(); m--) {
if (getDigit(m) != other.getDigit(m)) {
return false;
}
}
return true;
}
return true;
}
UnicodeString DecimalQuantity::toString() const {

View File

@ -1027,8 +1027,13 @@ public abstract class DecimalQuantity_AbstractBCD implements DecimalQuantity {
}
DecimalQuantity_AbstractBCD _other = (DecimalQuantity_AbstractBCD) other;
boolean basicEquals = scale == _other.scale && precision == _other.precision && flags == _other.flags
&& lOptPos == _other.lOptPos && lReqPos == _other.lReqPos && rReqPos == _other.rReqPos
boolean basicEquals =
scale == _other.scale
&& precision == _other.precision
&& flags == _other.flags
&& lOptPos == _other.lOptPos
&& lReqPos == _other.lReqPos
&& rReqPos == _other.rReqPos
&& rOptPos == _other.rOptPos;
if (!basicEquals) {
return false;
@ -1036,13 +1041,16 @@ public abstract class DecimalQuantity_AbstractBCD implements DecimalQuantity {
if (precision == 0) {
return true;
}
for (int m = getUpperDisplayMagnitude(); m >= getLowerDisplayMagnitude(); m--) {
if (getDigit(m) != _other.getDigit(m)) {
return false;
} else if (isApproximate) {
return origDouble == _other.origDouble && origDelta == _other.origDelta;
} else {
for (int m = getUpperDisplayMagnitude(); m >= getLowerDisplayMagnitude(); m--) {
if (getDigit(m) != _other.getDigit(m)) {
return false;
}
}
return true;
}
return true;
}
/**