We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 71aaba2 commit a481fd9Copy full SHA for a481fd9
Foundation/Decimal.swift
@@ -455,8 +455,8 @@ extension Decimal {
455
var compactValue = value
456
var exponent: Int32 = 0
457
while compactValue % 10 == 0 {
458
- compactValue = compactValue / 10
459
- exponent = exponent + 1
+ compactValue /= 10
+ exponent += 1
460
}
461
_isCompact = 1
462
_exponent = exponent
@@ -470,11 +470,9 @@ extension Decimal {
470
471
472
public init(_ value: Int64) {
473
+ self.init(value.magnitude)
474
if value < 0 {
- self.init(value == Int64.min ? UInt64(Int64.max) + 1 : UInt64(abs(value)))
475
_isNegative = 1
476
- } else {
477
- self.init(UInt64(value))
478
479
480
0 commit comments