Skip to content

Commit b25e610

Browse files
committed
[SR-14974] Fix 'Decimal.ulp' to reflect spacing between consecutive values.
1 parent 662217d commit b25e610

File tree

4 files changed

+199
-96
lines changed

4 files changed

+199
-96
lines changed

Darwin/Foundation-swiftoverlay-Tests/TestDecimal.swift

+34-18
Original file line numberDiff line numberDiff line change
@@ -206,21 +206,6 @@ class TestDecimal : XCTestCase {
206206
XCTAssertEqual(11, sm5)
207207
XCTAssertEqual(12, sm6)
208208
XCTAssertEqual(13, sm7)
209-
210-
let ulp = explicit.ulp
211-
XCTAssertEqual(0x7f, ulp.exponent)
212-
XCTAssertEqual(1, ulp._length)
213-
XCTAssertEqual(0, ulp._isNegative)
214-
XCTAssertEqual(1, ulp._isCompact)
215-
XCTAssertEqual(0, ulp._reserved)
216-
XCTAssertEqual(1, ulp._mantissa.0)
217-
XCTAssertEqual(0, ulp._mantissa.1)
218-
XCTAssertEqual(0, ulp._mantissa.2)
219-
XCTAssertEqual(0, ulp._mantissa.3)
220-
XCTAssertEqual(0, ulp._mantissa.4)
221-
XCTAssertEqual(0, ulp._mantissa.5)
222-
XCTAssertEqual(0, ulp._mantissa.6)
223-
XCTAssertEqual(0, ulp._mantissa.7)
224209
}
225210

226211
func test_Maths() {
@@ -285,8 +270,6 @@ class TestDecimal : XCTestCase {
285270
XCTAssertTrue(Decimal(2) < Decimal(3))
286271
XCTAssertTrue(Decimal(3) > Decimal(2))
287272
XCTAssertEqual(Decimal(-9), Decimal(1) - Decimal(10))
288-
XCTAssertEqual(Decimal(3), Decimal(2).nextUp)
289-
XCTAssertEqual(Decimal(2), Decimal(3).nextDown)
290273
XCTAssertEqual(Decimal(-476), Decimal(1024).distance(to: Decimal(1500)))
291274
XCTAssertEqual(Decimal(68040), Decimal(386).advanced(by: Decimal(67654)))
292275
XCTAssertEqual(Decimal(1.234), abs(Decimal(1.234)))
@@ -590,8 +573,41 @@ class TestDecimal : XCTestCase {
590573
}
591574

592575
func test_ULP() {
593-
let x = 0.1 as Decimal
576+
var x = 0.1 as Decimal
594577
XCTAssertFalse(x.ulp > x)
578+
579+
x = .nan
580+
XCTAssertTrue(x.ulp.isNaN)
581+
XCTAssertTrue(x.nextDown.isNaN)
582+
XCTAssertTrue(x.nextUp.isNaN)
583+
584+
x = .greatestFiniteMagnitude
585+
XCTAssertEqual(x.ulp, Decimal(string: "1e127")!)
586+
XCTAssertEqual(x.nextDown, x - Decimal(string: "1e127")!)
587+
XCTAssertTrue(x.nextUp.isNaN)
588+
589+
x = 1
590+
XCTAssertEqual(x.ulp, Decimal(string: "1e-38")!)
591+
XCTAssertEqual(x.nextDown, x - Decimal(string: "1e-38")!)
592+
XCTAssertEqual(x.nextUp, x + Decimal(string: "1e-38")!)
593+
594+
x = .leastNonzeroMagnitude
595+
// XCTAssertEqual(x.ulp, x) // SR-6671
596+
// XCTAssertEqual(x.nextDown, 0) // SR-6671
597+
// XCTAssertEqual(x.nextUp, x + x) // SR-6671
598+
XCTAssertNotEqual(x.ulp, 0)
599+
XCTAssertNotEqual(x.nextDown, x)
600+
XCTAssertNotEqual(x.nextUp, x)
601+
602+
x = 0
603+
XCTAssertEqual(x.ulp, Decimal(string: "1e-128")!)
604+
XCTAssertEqual(x.nextDown, -Decimal(string: "1e-128")!)
605+
XCTAssertEqual(x.nextUp, Decimal(string: "1e-128")!)
606+
607+
x = -1
608+
XCTAssertEqual(x.ulp, 1.ulp)
609+
XCTAssertEqual(x.nextDown, -(1.nextUp))
610+
XCTAssertEqual(x.nextUp, -(1.nextDown))
595611
}
596612

597613
func test_unconditionallyBridgeFromObjectiveC() {

Darwin/Foundation-swiftoverlay/Decimal.swift

+64-2
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,57 @@ extension Decimal : Strideable {
281281
}
282282
}
283283

284+
extension Decimal {
285+
// (Used by `_powersOfTen` and `ulp`; note that the representation isn't compact.)
286+
fileprivate init(_length: UInt32, _mantissa: (UInt16, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16)) {
287+
self.init(_exponent: 0, _length: _length, _isNegative: 0, _isCompact: 0,
288+
_reserved: 0, _mantissa: _mantissa)
289+
}
290+
}
291+
292+
private let _powersOfTen = [
293+
/*^00*/ 1 as Decimal,
294+
/*^01*/ Decimal(_length: 1, _mantissa: (0x000a,0,0,0,0,0,0,0)),
295+
/*^02*/ Decimal(_length: 1, _mantissa: (0x0064,0,0,0,0,0,0,0)),
296+
/*^03*/ Decimal(_length: 1, _mantissa: (0x03e8,0,0,0,0,0,0,0)),
297+
/*^04*/ Decimal(_length: 1, _mantissa: (0x2710,0,0,0,0,0,0,0)),
298+
/*^05*/ Decimal(_length: 2, _mantissa: (0x86a0, 0x0001,0,0,0,0,0,0)),
299+
/*^06*/ Decimal(_length: 2, _mantissa: (0x4240, 0x000f,0,0,0,0,0,0)),
300+
/*^07*/ Decimal(_length: 2, _mantissa: (0x9680, 0x0098,0,0,0,0,0,0)),
301+
/*^08*/ Decimal(_length: 2, _mantissa: (0xe100, 0x05f5,0,0,0,0,0,0)),
302+
/*^09*/ Decimal(_length: 2, _mantissa: (0xca00, 0x3b9a,0,0,0,0,0,0)),
303+
/*^10*/ Decimal(_length: 3, _mantissa: (0xe400, 0x540b, 0x0002,0,0,0,0,0)),
304+
/*^11*/ Decimal(_length: 3, _mantissa: (0xe800, 0x4876, 0x0017,0,0,0,0,0)),
305+
/*^12*/ Decimal(_length: 3, _mantissa: (0x1000, 0xd4a5, 0x00e8,0,0,0,0,0)),
306+
/*^13*/ Decimal(_length: 3, _mantissa: (0xa000, 0x4e72, 0x0918,0,0,0,0,0)),
307+
/*^14*/ Decimal(_length: 3, _mantissa: (0x4000, 0x107a, 0x5af3,0,0,0,0,0)),
308+
/*^15*/ Decimal(_length: 4, _mantissa: (0x8000, 0xa4c6, 0x8d7e, 0x0003,0,0,0,0)),
309+
/*^16*/ Decimal(_length: 4, _mantissa: (0x0000, 0x6fc1, 0x86f2, 0x0023,0,0,0,0)),
310+
/*^17*/ Decimal(_length: 4, _mantissa: (0x0000, 0x5d8a, 0x4578, 0x0163,0,0,0,0)),
311+
/*^18*/ Decimal(_length: 4, _mantissa: (0x0000, 0xa764, 0xb6b3, 0x0de0,0,0,0,0)),
312+
/*^19*/ Decimal(_length: 4, _mantissa: (0x0000, 0x89e8, 0x2304, 0x8ac7,0,0,0,0)),
313+
/*^20*/ Decimal(_length: 5, _mantissa: (0x0000, 0x6310, 0x5e2d, 0x6bc7, 0x0005,0,0,0)),
314+
/*^21*/ Decimal(_length: 5, _mantissa: (0x0000, 0xdea0, 0xadc5, 0x35c9, 0x0036,0,0,0)),
315+
/*^22*/ Decimal(_length: 5, _mantissa: (0x0000, 0xb240, 0xc9ba, 0x19e0, 0x021e,0,0,0)),
316+
/*^23*/ Decimal(_length: 5, _mantissa: (0x0000, 0xf680, 0xe14a, 0x02c7, 0x152d,0,0,0)),
317+
/*^24*/ Decimal(_length: 5, _mantissa: (0x0000, 0xa100, 0xcced, 0x1bce, 0xd3c2,0,0,0)),
318+
/*^25*/ Decimal(_length: 6, _mantissa: (0x0000, 0x4a00, 0x0148, 0x1614, 0x4595, 0x0008,0,0)),
319+
/*^26*/ Decimal(_length: 6, _mantissa: (0x0000, 0xe400, 0x0cd2, 0xdcc8, 0xb7d2, 0x0052,0,0)),
320+
/*^27*/ Decimal(_length: 6, _mantissa: (0x0000, 0xe800, 0x803c, 0x9fd0, 0x2e3c, 0x033b,0,0)),
321+
/*^28*/ Decimal(_length: 6, _mantissa: (0x0000, 0x1000, 0x0261, 0x3e25, 0xce5e, 0x204f,0,0)),
322+
/*^29*/ Decimal(_length: 7, _mantissa: (0x0000, 0xa000, 0x17ca, 0x6d72, 0x0fae, 0x431e, 0x0001,0)),
323+
/*^30*/ Decimal(_length: 7, _mantissa: (0x0000, 0x4000, 0xedea, 0x4674, 0x9cd0, 0x9f2c, 0x000c,0)),
324+
/*^31*/ Decimal(_length: 7, _mantissa: (0x0000, 0x8000, 0x4b26, 0xc091, 0x2022, 0x37be, 0x007e,0)),
325+
/*^32*/ Decimal(_length: 7, _mantissa: (0x0000, 0x0000, 0xef81, 0x85ac, 0x415b, 0x2d6d, 0x04ee,0)),
326+
/*^33*/ Decimal(_length: 7, _mantissa: (0x0000, 0x0000, 0x5b0a, 0x38c1, 0x8d93, 0xc644, 0x314d,0)),
327+
/*^34*/ Decimal(_length: 8, _mantissa: (0x0000, 0x0000, 0x8e64, 0x378d, 0x87c0, 0xbead, 0xed09, 0x0001)),
328+
/*^35*/ Decimal(_length: 8, _mantissa: (0x0000, 0x0000, 0x8fe8, 0x2b87, 0x4d82, 0x72c7, 0x4261, 0x0013)),
329+
/*^36*/ Decimal(_length: 8, _mantissa: (0x0000, 0x0000, 0x9f10, 0xb34b, 0x0715, 0x7bc9, 0x97ce, 0x00c0)),
330+
/*^37*/ Decimal(_length: 8, _mantissa: (0x0000, 0x0000, 0x36a0, 0x00f4, 0x46d9, 0xd5da, 0xee10, 0x0785)),
331+
/*^38*/ Decimal(_length: 8, _mantissa: (0x0000, 0x0000, 0x2240, 0x098a, 0xc47a, 0x5a86, 0x4ca8, 0x4b3b))
332+
/*^39 is on 9 shorts.*/
333+
]
334+
284335
// The methods in this extension exist to match the protocol requirements of
285336
// FloatingPoint, even if we can't conform directly.
286337
//
@@ -501,9 +552,20 @@ extension Decimal {
501552
}
502553

503554
public var ulp: Decimal {
504-
if !self.isFinite { return Decimal.nan }
555+
guard isFinite else { return .nan }
556+
557+
let exponent: Int32
558+
if isZero {
559+
exponent = .min
560+
} else {
561+
let significand = Decimal(_length: _length, _mantissa: _mantissa)
562+
let maxPowerOfTen = _powersOfTen.count
563+
let powerOfTen = _powersOfTen.firstIndex { $0 > significand } ?? maxPowerOfTen
564+
exponent = _exponent &- Int32(maxPowerOfTen &- powerOfTen)
565+
}
566+
505567
return Decimal(
506-
_exponent: _exponent, _length: 1, _isNegative: 0, _isCompact: 1,
568+
_exponent: max(exponent, -128), _length: 1, _isNegative: 0, _isCompact: 1,
507569
_reserved: 0, _mantissa: (0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000))
508570
}
509571

Sources/Foundation/Decimal.swift

+67-58
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,57 @@ extension Decimal : Strideable {
489489
}
490490
}
491491

492+
extension Decimal {
493+
// (Used by `_powersOfTen` and `ulp`; note that the representation isn't compact.)
494+
fileprivate init(_length: UInt32, _mantissa: (UInt16, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16)) {
495+
self.init(_exponent: 0, _length: _length, _isNegative: 0, _isCompact: 0,
496+
_reserved: 0, _mantissa: _mantissa)
497+
}
498+
}
499+
500+
private let _powersOfTen = [
501+
/*^00*/ 1 as Decimal,
502+
/*^01*/ Decimal(_length: 1, _mantissa: (0x000a,0,0,0,0,0,0,0)),
503+
/*^02*/ Decimal(_length: 1, _mantissa: (0x0064,0,0,0,0,0,0,0)),
504+
/*^03*/ Decimal(_length: 1, _mantissa: (0x03e8,0,0,0,0,0,0,0)),
505+
/*^04*/ Decimal(_length: 1, _mantissa: (0x2710,0,0,0,0,0,0,0)),
506+
/*^05*/ Decimal(_length: 2, _mantissa: (0x86a0, 0x0001,0,0,0,0,0,0)),
507+
/*^06*/ Decimal(_length: 2, _mantissa: (0x4240, 0x000f,0,0,0,0,0,0)),
508+
/*^07*/ Decimal(_length: 2, _mantissa: (0x9680, 0x0098,0,0,0,0,0,0)),
509+
/*^08*/ Decimal(_length: 2, _mantissa: (0xe100, 0x05f5,0,0,0,0,0,0)),
510+
/*^09*/ Decimal(_length: 2, _mantissa: (0xca00, 0x3b9a,0,0,0,0,0,0)),
511+
/*^10*/ Decimal(_length: 3, _mantissa: (0xe400, 0x540b, 0x0002,0,0,0,0,0)),
512+
/*^11*/ Decimal(_length: 3, _mantissa: (0xe800, 0x4876, 0x0017,0,0,0,0,0)),
513+
/*^12*/ Decimal(_length: 3, _mantissa: (0x1000, 0xd4a5, 0x00e8,0,0,0,0,0)),
514+
/*^13*/ Decimal(_length: 3, _mantissa: (0xa000, 0x4e72, 0x0918,0,0,0,0,0)),
515+
/*^14*/ Decimal(_length: 3, _mantissa: (0x4000, 0x107a, 0x5af3,0,0,0,0,0)),
516+
/*^15*/ Decimal(_length: 4, _mantissa: (0x8000, 0xa4c6, 0x8d7e, 0x0003,0,0,0,0)),
517+
/*^16*/ Decimal(_length: 4, _mantissa: (0x0000, 0x6fc1, 0x86f2, 0x0023,0,0,0,0)),
518+
/*^17*/ Decimal(_length: 4, _mantissa: (0x0000, 0x5d8a, 0x4578, 0x0163,0,0,0,0)),
519+
/*^18*/ Decimal(_length: 4, _mantissa: (0x0000, 0xa764, 0xb6b3, 0x0de0,0,0,0,0)),
520+
/*^19*/ Decimal(_length: 4, _mantissa: (0x0000, 0x89e8, 0x2304, 0x8ac7,0,0,0,0)),
521+
/*^20*/ Decimal(_length: 5, _mantissa: (0x0000, 0x6310, 0x5e2d, 0x6bc7, 0x0005,0,0,0)),
522+
/*^21*/ Decimal(_length: 5, _mantissa: (0x0000, 0xdea0, 0xadc5, 0x35c9, 0x0036,0,0,0)),
523+
/*^22*/ Decimal(_length: 5, _mantissa: (0x0000, 0xb240, 0xc9ba, 0x19e0, 0x021e,0,0,0)),
524+
/*^23*/ Decimal(_length: 5, _mantissa: (0x0000, 0xf680, 0xe14a, 0x02c7, 0x152d,0,0,0)),
525+
/*^24*/ Decimal(_length: 5, _mantissa: (0x0000, 0xa100, 0xcced, 0x1bce, 0xd3c2,0,0,0)),
526+
/*^25*/ Decimal(_length: 6, _mantissa: (0x0000, 0x4a00, 0x0148, 0x1614, 0x4595, 0x0008,0,0)),
527+
/*^26*/ Decimal(_length: 6, _mantissa: (0x0000, 0xe400, 0x0cd2, 0xdcc8, 0xb7d2, 0x0052,0,0)),
528+
/*^27*/ Decimal(_length: 6, _mantissa: (0x0000, 0xe800, 0x803c, 0x9fd0, 0x2e3c, 0x033b,0,0)),
529+
/*^28*/ Decimal(_length: 6, _mantissa: (0x0000, 0x1000, 0x0261, 0x3e25, 0xce5e, 0x204f,0,0)),
530+
/*^29*/ Decimal(_length: 7, _mantissa: (0x0000, 0xa000, 0x17ca, 0x6d72, 0x0fae, 0x431e, 0x0001,0)),
531+
/*^30*/ Decimal(_length: 7, _mantissa: (0x0000, 0x4000, 0xedea, 0x4674, 0x9cd0, 0x9f2c, 0x000c,0)),
532+
/*^31*/ Decimal(_length: 7, _mantissa: (0x0000, 0x8000, 0x4b26, 0xc091, 0x2022, 0x37be, 0x007e,0)),
533+
/*^32*/ Decimal(_length: 7, _mantissa: (0x0000, 0x0000, 0xef81, 0x85ac, 0x415b, 0x2d6d, 0x04ee,0)),
534+
/*^33*/ Decimal(_length: 7, _mantissa: (0x0000, 0x0000, 0x5b0a, 0x38c1, 0x8d93, 0xc644, 0x314d,0)),
535+
/*^34*/ Decimal(_length: 8, _mantissa: (0x0000, 0x0000, 0x8e64, 0x378d, 0x87c0, 0xbead, 0xed09, 0x0001)),
536+
/*^35*/ Decimal(_length: 8, _mantissa: (0x0000, 0x0000, 0x8fe8, 0x2b87, 0x4d82, 0x72c7, 0x4261, 0x0013)),
537+
/*^36*/ Decimal(_length: 8, _mantissa: (0x0000, 0x0000, 0x9f10, 0xb34b, 0x0715, 0x7bc9, 0x97ce, 0x00c0)),
538+
/*^37*/ Decimal(_length: 8, _mantissa: (0x0000, 0x0000, 0x36a0, 0x00f4, 0x46d9, 0xd5da, 0xee10, 0x0785)),
539+
/*^38*/ Decimal(_length: 8, _mantissa: (0x0000, 0x0000, 0x2240, 0x098a, 0xc47a, 0x5a86, 0x4ca8, 0x4b3b))
540+
/*^39 is on 9 shorts.*/
541+
]
542+
492543
// The methods in this extension exist to match the protocol requirements of
493544
// FloatingPoint, even if we can't conform directly.
494545
//
@@ -729,9 +780,20 @@ extension Decimal {
729780
}
730781

731782
public var ulp: Decimal {
732-
if !self.isFinite { return Decimal.nan }
783+
guard isFinite else { return .nan }
784+
785+
let exponent: Int32
786+
if isZero {
787+
exponent = .min
788+
} else {
789+
let significand = Decimal(_length: _length, _mantissa: _mantissa)
790+
let maxPowerOfTen = _powersOfTen.count
791+
let powerOfTen = _powersOfTen.firstIndex { $0 > significand } ?? maxPowerOfTen
792+
exponent = _exponent &- Int32(maxPowerOfTen &- powerOfTen)
793+
}
794+
733795
return Decimal(
734-
_exponent: _exponent, _length: 1, _isNegative: 0, _isCompact: 1,
796+
_exponent: max(exponent, -128), _length: 1, _isNegative: 0, _isCompact: 1,
735797
_reserved: 0, _mantissa: (0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000))
736798
}
737799

@@ -1227,14 +1289,14 @@ fileprivate func integerMultiplyByPowerOf10<T:VariableLengthNumber>(_ result: in
12271289
}
12281290
result = left
12291291

1230-
let maxpow10 = pow10.count - 1
1292+
let maxpow10 = _powersOfTen.count - 1
12311293
var error:NSDecimalNumber.CalculationError = .noError
12321294

12331295
while power > maxpow10 {
12341296
var big = T()
12351297

12361298
power -= maxpow10
1237-
let p10 = pow10[maxpow10]
1299+
let p10 = _powersOfTen[maxpow10]
12381300

12391301
if !isNegative {
12401302
error = integerMultiply(&big,result,p10)
@@ -1256,7 +1318,7 @@ fileprivate func integerMultiplyByPowerOf10<T:VariableLengthNumber>(_ result: in
12561318
var big = T()
12571319

12581320
// Handle the rest of the power (<= maxpow10)
1259-
let p10 = pow10[Int(power)]
1321+
let p10 = _powersOfTen[Int(power)]
12601322

12611323
if !isNegative {
12621324
error = integerMultiply(&big, result, p10)
@@ -1940,15 +2002,6 @@ fileprivate struct WideDecimal : VariableLengthNumber {
19402002
extension Decimal {
19412003
fileprivate static let maxSize: UInt32 = UInt32(NSDecimalMaxSize)
19422004

1943-
fileprivate init(length: UInt32, mantissa: (UInt16, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16)) {
1944-
precondition(length <= 15)
1945-
self._mantissa = mantissa
1946-
self.__exponent = 0
1947-
self.__lengthAndFlags = 0
1948-
self.__reserved = 0
1949-
self._length = length
1950-
}
1951-
19522005
fileprivate var isCompact: Bool {
19532006
get {
19542007
return _isCompact != 0
@@ -2207,50 +2260,6 @@ extension Decimal {
22072260
}
22082261
}
22092262

2210-
fileprivate let pow10 = [
2211-
/*^00*/ Decimal(length: 1, mantissa:( 0x0001,0,0,0,0,0,0,0)),
2212-
/*^01*/ Decimal(length: 1, mantissa:( 0x000a,0,0,0,0,0,0,0)),
2213-
/*^02*/ Decimal(length: 1, mantissa:( 0x0064,0,0,0,0,0,0,0)),
2214-
/*^03*/ Decimal(length: 1, mantissa:( 0x03e8,0,0,0,0,0,0,0)),
2215-
/*^04*/ Decimal(length: 1, mantissa:( 0x2710,0,0,0,0,0,0,0)),
2216-
/*^05*/ Decimal(length: 2, mantissa:( 0x86a0, 0x0001,0,0,0,0,0,0)),
2217-
/*^06*/ Decimal(length: 2, mantissa:( 0x4240, 0x000f,0,0,0,0,0,0)),
2218-
/*^07*/ Decimal(length: 2, mantissa:( 0x9680, 0x0098,0,0,0,0,0,0)),
2219-
/*^08*/ Decimal(length: 2, mantissa:( 0xe100, 0x05f5,0,0,0,0,0,0)),
2220-
/*^09*/ Decimal(length: 2, mantissa:( 0xca00, 0x3b9a,0,0,0,0,0,0)),
2221-
/*^10*/ Decimal(length: 3, mantissa:( 0xe400, 0x540b, 0x0002,0,0,0,0,0)),
2222-
/*^11*/ Decimal(length: 3, mantissa:( 0xe800, 0x4876, 0x0017,0,0,0,0,0)),
2223-
/*^12*/ Decimal(length: 3, mantissa:( 0x1000, 0xd4a5, 0x00e8,0,0,0,0,0)),
2224-
/*^13*/ Decimal(length: 3, mantissa:( 0xa000, 0x4e72, 0x0918,0,0,0,0,0)),
2225-
/*^14*/ Decimal(length: 3, mantissa:( 0x4000, 0x107a, 0x5af3,0,0,0,0,0)),
2226-
/*^15*/ Decimal(length: 4, mantissa:( 0x8000, 0xa4c6, 0x8d7e, 0x0003,0,0,0,0)),
2227-
/*^16*/ Decimal(length: 4, mantissa:( 0x0000, 0x6fc1, 0x86f2, 0x0023,0,0,0,0)),
2228-
/*^17*/ Decimal(length: 4, mantissa:( 0x0000, 0x5d8a, 0x4578, 0x0163,0,0,0,0)),
2229-
/*^18*/ Decimal(length: 4, mantissa:( 0x0000, 0xa764, 0xb6b3, 0x0de0,0,0,0,0)),
2230-
/*^19*/ Decimal(length: 4, mantissa:( 0x0000, 0x89e8, 0x2304, 0x8ac7,0,0,0,0)),
2231-
/*^20*/ Decimal(length: 5, mantissa:( 0x0000, 0x6310, 0x5e2d, 0x6bc7, 0x0005,0,0,0)),
2232-
/*^21*/ Decimal(length: 5, mantissa:( 0x0000, 0xdea0, 0xadc5, 0x35c9, 0x0036,0,0,0)),
2233-
/*^22*/ Decimal(length: 5, mantissa:( 0x0000, 0xb240, 0xc9ba, 0x19e0, 0x021e,0,0,0)),
2234-
/*^23*/ Decimal(length: 5, mantissa:( 0x0000, 0xf680, 0xe14a, 0x02c7, 0x152d,0,0,0)),
2235-
/*^24*/ Decimal(length: 5, mantissa:( 0x0000, 0xa100, 0xcced, 0x1bce, 0xd3c2,0,0,0)),
2236-
/*^25*/ Decimal(length: 6, mantissa:( 0x0000, 0x4a00, 0x0148, 0x1614, 0x4595, 0x0008,0,0)),
2237-
/*^26*/ Decimal(length: 6, mantissa:( 0x0000, 0xe400, 0x0cd2, 0xdcc8, 0xb7d2, 0x0052,0,0)),
2238-
/*^27*/ Decimal(length: 6, mantissa:( 0x0000, 0xe800, 0x803c, 0x9fd0, 0x2e3c, 0x033b,0,0)),
2239-
/*^28*/ Decimal(length: 6, mantissa:( 0x0000, 0x1000, 0x0261, 0x3e25, 0xce5e, 0x204f,0,0)),
2240-
/*^29*/ Decimal(length: 7, mantissa:( 0x0000, 0xa000, 0x17ca, 0x6d72, 0x0fae, 0x431e, 0x0001,0)),
2241-
/*^30*/ Decimal(length: 7, mantissa:( 0x0000, 0x4000, 0xedea, 0x4674, 0x9cd0, 0x9f2c, 0x000c,0)),
2242-
/*^31*/ Decimal(length: 7, mantissa:( 0x0000, 0x8000, 0x4b26, 0xc091, 0x2022, 0x37be, 0x007e,0)),
2243-
/*^32*/ Decimal(length: 7, mantissa:( 0x0000, 0x0000, 0xef81, 0x85ac, 0x415b, 0x2d6d, 0x04ee,0)),
2244-
/*^33*/ Decimal(length: 7, mantissa:( 0x0000, 0x0000, 0x5b0a, 0x38c1, 0x8d93, 0xc644, 0x314d,0)),
2245-
/*^34*/ Decimal(length: 8, mantissa:( 0x0000, 0x0000, 0x8e64, 0x378d, 0x87c0, 0xbead, 0xed09, 0x0001)),
2246-
/*^35*/ Decimal(length: 8, mantissa:( 0x0000, 0x0000, 0x8fe8, 0x2b87, 0x4d82, 0x72c7, 0x4261, 0x0013)),
2247-
/*^36*/ Decimal(length: 8, mantissa:( 0x0000, 0x0000, 0x9f10, 0xb34b, 0x0715, 0x7bc9, 0x97ce, 0x00c0)),
2248-
/*^37*/ Decimal(length: 8, mantissa:( 0x0000, 0x0000, 0x36a0, 0x00f4, 0x46d9, 0xd5da, 0xee10, 0x0785)),
2249-
/*^38*/ Decimal(length: 8, mantissa:( 0x0000, 0x0000, 0x2240, 0x098a, 0xc47a, 0x5a86, 0x4ca8, 0x4b3b))
2250-
/*^39 is on 9 shorts. */
2251-
]
2252-
2253-
22542263
// Could be silently inexact for float and double.
22552264
extension Scanner {
22562265

0 commit comments

Comments
 (0)