From d3dce5d2fbee9529e60427185831cdcc9ad33ff6 Mon Sep 17 00:00:00 2001 From: Xiaodi Wu Date: Sat, 1 Sep 2018 20:41:06 -0400 Subject: [PATCH] [Decimal] Make a minor edit to synchronize with overlay --- Foundation/Decimal.swift | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Foundation/Decimal.swift b/Foundation/Decimal.swift index 36ddff6ad0..33278f08c4 100644 --- a/Foundation/Decimal.swift +++ b/Foundation/Decimal.swift @@ -455,8 +455,8 @@ extension Decimal { var compactValue = value var exponent: Int32 = 0 while compactValue % 10 == 0 { - compactValue = compactValue / 10 - exponent = exponent + 1 + compactValue /= 10 + exponent += 1 } _isCompact = 1 _exponent = exponent @@ -470,11 +470,9 @@ extension Decimal { } public init(_ value: Int64) { + self.init(value.magnitude) if value < 0 { - self.init(value == Int64.min ? UInt64(Int64.max) + 1 : UInt64(abs(value))) _isNegative = 1 - } else { - self.init(UInt64(value)) } }