mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-21 04:29:31 +00:00
ICU-13287 Add explicit casts for conversions between long/int64 and double.
X-SVN-Rev: 40310
This commit is contained in:
parent
0ed701f7bb
commit
0a3a7fb889
2 changed files with 6 additions and 6 deletions
|
@ -111,7 +111,7 @@ public:
|
|||
return newRuleValue * divisor;
|
||||
}
|
||||
|
||||
virtual double calcUpperBound(double /*oldUpperBound*/) const { return divisor; }
|
||||
virtual double calcUpperBound(double /*oldUpperBound*/) const { return static_cast<double>(divisor); }
|
||||
|
||||
virtual UChar tokenChar() const { return (UChar)0x003c; } // '<'
|
||||
|
||||
|
@ -148,7 +148,7 @@ public:
|
|||
virtual void doSubstitution(double number, UnicodeString& toInsertInto, int32_t pos, int32_t recursionCount, UErrorCode& status) const;
|
||||
|
||||
virtual int64_t transformNumber(int64_t number) const { return number % divisor; }
|
||||
virtual double transformNumber(double number) const { return uprv_fmod(number, divisor); }
|
||||
virtual double transformNumber(double number) const { return uprv_fmod(number, static_cast<double>(divisor)); }
|
||||
|
||||
virtual UBool doParse(const UnicodeString& text,
|
||||
ParsePosition& parsePosition,
|
||||
|
@ -158,10 +158,10 @@ public:
|
|||
Formattable& result) const;
|
||||
|
||||
virtual double composeRuleValue(double newRuleValue, double oldRuleValue) const {
|
||||
return oldRuleValue - uprv_fmod(oldRuleValue, divisor) + newRuleValue;
|
||||
return oldRuleValue - uprv_fmod(oldRuleValue, static_cast<double>(divisor)) + newRuleValue;
|
||||
}
|
||||
|
||||
virtual double calcUpperBound(double /*oldUpperBound*/) const { return divisor; }
|
||||
virtual double calcUpperBound(double /*oldUpperBound*/) const { return static_cast<double>(divisor); }
|
||||
|
||||
virtual UBool isModulusSubstitution() const { return TRUE; }
|
||||
|
||||
|
|
|
@ -239,10 +239,10 @@ FixedPrecision::initVisibleDigits(
|
|||
}
|
||||
}
|
||||
// Try fast path
|
||||
if (n >= 0 && initVisibleDigits(scaled, -n, digits, status)) {
|
||||
if (n >= 0 && initVisibleDigits(static_cast<int64_t>(scaled), -n, digits, status)) {
|
||||
digits.fAbsDoubleValue = fabs(value);
|
||||
digits.fAbsDoubleValueSet = U_SUCCESS(status) && !digits.isOverMaxDigits();
|
||||
// Adjust for negative 0 becuase when we cast to an int64,
|
||||
// Adjust for negative 0 because when we cast to an int64,
|
||||
// negative 0 becomes positive 0.
|
||||
if (scaled == 0.0 && uprv_isNegative(scaled)) {
|
||||
digits.setNegative();
|
||||
|
|
Loading…
Add table
Reference in a new issue