StructureFoundation5.9.0
Decimal
struct Decimal
Citizens in Foundation
Conformances
protocol AdditiveArithmetic
A type with values that support addition and subtraction.
protocol Comparable
A type that can be compared using the relational operators
<
,<=
,>=
, and>
.protocol CustomStringConvertible
A type with a customized textual representation.
protocol Decodable
A type that can decode itself from an external representation.
protocol Encodable
A type that can encode itself to an external representation.
protocol Equatable
A type that can be compared for value equality.
protocol ExpressibleByFloatLiteral
A type that can be initialized with a floating-point literal.
protocol ExpressibleByIntegerLiteral
A type that can be initialized with an integer literal.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Numeric
A type with values that support multiplication.
protocol SignedNumeric
A numeric type with a negation operation.
protocol Strideable
A type representing continuous, one-dimensional values that can be offset and measured.
Members
init(
) init(Double
) init(Int
) init(UInt
) init(Int8
) init(Int16
) init(Int32
) init(Int64
) init(UInt8
) init(UInt16
) init(UInt32
) init(UInt64
) init?<T>(exactly: T
) init(floatLiteral: Double
) init(from: Decoder
) throws init(integerLiteral: Int
) init(sign: FloatingPointSign, exponent: Int, significand: Decimal
) init(signOf: Decimal, magnitudeOf: Decimal
) init?(string: String, locale: Locale?
) static let greatestFiniteMagnitude: Decimal
static let leastNonzeroMagnitude: Decimal
static let leastNormalMagnitude: Decimal
static var nan: Decimal
static let pi: Decimal
static var quietNaN: Decimal
static var radix: Int
var description: String
var exponent: Int
var floatingPointClass: FloatingPointClassification
The IEEE 754 “class” of this type.
var isCanonical: Bool
var isFinite: Bool
true
iffself
is zero, subnormal, or normal (not infinity or NaN).var isInfinite: Bool
true
iffself
is infinity.var isNaN: Bool
true
iffself
is NaN.var isNormal: Bool
true
iffself
is normal (not zero, subnormal, infinity, or NaN).var isSignMinus: Bool
true
iffself
is negative.var isSignaling: Bool
true
iffself
is a signaling NaN.var isSignalingNaN: Bool
true
iffself
is a signaling NaN.var isSubnormal: Bool
true
iffself
is subnormal.var isZero: Bool
true
iffself
is +0.0 or -0.0.var magnitude: Decimal
var nextDown: Decimal
var nextUp: Decimal
var sign: FloatingPointSign
var significand: Decimal
var ulp: Decimal
static func * (Decimal, Decimal
) -> Decimal static func *= (inout Decimal, Decimal
) static func + (Decimal, Decimal
) -> Decimal static func += (inout Decimal, Decimal
) static func - (Decimal, Decimal
) -> Decimal static func -= (inout Decimal, Decimal
) static func / (Decimal, Decimal
) -> Decimal static func /= (inout Decimal, Decimal
) static func < (Decimal, Decimal
) -> Bool static func == (Decimal, Decimal
) -> Bool func advanced(by: Decimal
) -> Decimal func distance(to: Decimal
) -> Decimal func encode(to: Encoder
) throws func hash(into: inout Hasher
) func isEqual(to: Decimal
) -> Bool func isLess(than: Decimal
) -> Bool func isLessThanOrEqualTo(Decimal
) -> Bool func isTotallyOrdered(belowOrEqualTo: Decimal
) -> Bool func negate(
) typealias CalculationError
typealias RoundingMode
static let leastFiniteMagnitude: Decimal
func add(Decimal
) func divide(by: Decimal
) func multiply(by: Decimal
) func subtract(Decimal
)
Features
var halfWidthCornerQuoted: String
static func != (Self, Self
) -> Bool static func + (Self
) -> Self Returns the given number unchanged.
static func ... (Self
) -> PartialRangeFrom<Self> Returns a partial range extending upward from a lower bound.
static func ... (Self
) -> PartialRangeThrough<Self> Returns a partial range up to, and including, its upper bound.
static func ... (Self, Self
) -> ClosedRange<Self> Returns a closed range that contains both of its bounds.
static func ..< (Self
) -> PartialRangeUpTo<Self> Returns a partial range up to, but not including, its upper bound.
static func ..< (Self, Self
) -> Range<Self> Returns a half-open range that contains its lower bound but not its upper bound.
static func == (Self, Self
) -> Bool