@@ -31,12 +31,12 @@ extension Decimal {
31
31
32
32
public var significand : Decimal {
33
33
get {
34
- return Decimal ( _exponent: 1 , _length: _length, _isNegative: _isNegative, _isCompact: _isCompact, _reserved: 0 , _mantissa: _mantissa)
34
+ return Decimal ( _exponent: 0 , _length: _length, _isNegative: _isNegative, _isCompact: _isCompact, _reserved: 0 , _mantissa: _mantissa)
35
35
}
36
36
}
37
37
38
38
public init ( sign: FloatingPointSign , exponent: Int , significand: Decimal ) {
39
- self . init ( _exponent: Int32 ( exponent) , _length: significand. _length, _isNegative: sign == . plus ? 1 : 0 , _isCompact: significand. _isCompact, _reserved: 0 , _mantissa: significand. _mantissa)
39
+ self . init ( _exponent: Int32 ( exponent) + significand . _exponent , _length: significand. _length, _isNegative: sign == . plus ? 0 : 1 , _isCompact: significand. _isCompact, _reserved: 0 , _mantissa: significand. _mantissa)
40
40
}
41
41
42
42
public init ( signOf: Decimal , magnitudeOf magnitude: Decimal ) {
@@ -50,7 +50,8 @@ extension Decimal {
50
50
public static var radix : Int { return 10 }
51
51
52
52
public var ulp : Decimal {
53
- return Decimal ( _exponent: 1 , _length: _length, _isNegative: _isNegative, _isCompact: _isCompact, _reserved: 0 , _mantissa: _mantissa)
53
+ if !self . isFinite { return Decimal . nan }
54
+ return Decimal ( _exponent: _exponent, _length: 8 , _isNegative: 0 , _isCompact: 1 , _reserved: 0 , _mantissa: ( 0x0001 , 0x0000 , 0x0000 , 0x0000 , 0x0000 , 0x0000 , 0x0000 , 0x0000 ) )
54
55
}
55
56
56
57
@available ( * , unavailable, message: " Decimal does not yet fully adopt FloatingPoint. " )
0 commit comments