Skip to content

Commit a481fd9

Browse files
xwuparkera
authored andcommitted
[Decimal] Make a minor edit to synchronize with overlay (#1683)
1 parent 71aaba2 commit a481fd9

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Foundation/Decimal.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,8 @@ extension Decimal {
455455
var compactValue = value
456456
var exponent: Int32 = 0
457457
while compactValue % 10 == 0 {
458-
compactValue = compactValue / 10
459-
exponent = exponent + 1
458+
compactValue /= 10
459+
exponent += 1
460460
}
461461
_isCompact = 1
462462
_exponent = exponent
@@ -470,11 +470,9 @@ extension Decimal {
470470
}
471471

472472
public init(_ value: Int64) {
473+
self.init(value.magnitude)
473474
if value < 0 {
474-
self.init(value == Int64.min ? UInt64(Int64.max) + 1 : UInt64(abs(value)))
475475
_isNegative = 1
476-
} else {
477-
self.init(UInt64(value))
478476
}
479477
}
480478

0 commit comments

Comments
 (0)