@objc(RealmSwiftDecimal128)
public final class Decimal128 : RLMDecimal128, Decodable, @unchecked Sendable
extension Decimal128: Encodable
extension Decimal128: ExpressibleByIntegerLiteral
extension Decimal128: ExpressibleByFloatLiteral
extension Decimal128: ExpressibleByStringLiteral
extension Decimal128: Comparable
extension Decimal128: Numeric
extension Decimal128: _QueryNumeric
extension Decimal128: _RealmCollectionValueInsideOptional
extension Decimal128: MinMaxType
extension Decimal128: AddableType
extension Decimal128: SortableType
A 128-bit IEEE 754-2008 decimal floating point number.
This type is similar to Swift’s built-in Decimal type, but allocates bits differently, resulting in a different representable range. (NS)Decimal stores a significand of up to 38 digits long and an exponent from -128 to 127, while this type stores up to 34 digits of significand and an exponent from -6143 to 6144.
Creates a new zero-initialized Decimal128.
DeclarationSwift
public override required init()
Converts the given value to a Decimal128.
The following types can be converted to Decimal128:
Passing a value with a type not in this list is a fatal error. Passing a string which cannot be parsed as a valid Decimal128 is a fatal error.
DeclarationSwift
public override required init(value: Any)
Parameters value
The value to convert to a Decimal128.
Converts the given number to a Decimal128.
This initializer cannot fail and is never lossy.
DeclarationSwift
public override required init(number: NSNumber)
Parameters number
The number to convert to a Decimal128.
Parse the given string as a Decimal128.
Strings which cannot be parsed as a Decimal128 return a value where isNaN
is true
.
Swift
public override required init(string: String)
Parameters string
The string to parse.
Creates a new Decimal128 by decoding from the given decoder.
This initializer throws an error if the decoder is invalid or does not decode to a value which can be converted to Decimal128.
DeclarationSwift
public required init(from decoder: Decoder) throws
Parameters decoder
The decoder to read data from.
The minimum value for Decimal128
DeclarationSwift
public static var min: Decimal128 { get }
The maximum value for Decimal128
DeclarationSwift
public static var max: Decimal128 { get }
Encodes this Decimal128 to the given encoder.
This function throws an error if the given encoder is unable to encode a string.
DeclarationSwift
public func encode(to encoder: Encoder) throws
Parameters encoder
The encoder to write data to.
Creates a new Decimal128 from the given integer literal.
DeclarationSwift
public convenience init(integerLiteral value: Int64)
Creates a new Decimal128 from the given float literal.
DeclarationSwift
public convenience init(floatLiteral value: Double)
Creates a new Decimal128 from the given string literal.
DeclarationSwift
public convenience init(stringLiteral value: String)
Returns a Boolean value indicating whether two decimal128 values are equal.
DeclarationSwift
public static func == (lhs: Decimal128, rhs: Decimal128) -> Bool
Parameters lhs
A Decimal128 value to compare.
rhs
Another Decimal128 value to compare.
Returns a Boolean value indicating whether the decimal128 value of the first argument is less than that of the second argument.
DeclarationSwift
public static func < (lhs: Decimal128, rhs: Decimal128) -> Bool
Parameters lhs
A Decimal128 value to compare.
rhs
Another Decimal128 value to compare.
Returns a Boolean value indicating whether the decimal128 value of the first argument is less than or equal to that of the second argument.
DeclarationSwift
public static func <= (lhs: Decimal128, rhs: Decimal128) -> Bool
Parameters lhs
A Decimal128 value to compare.
rhs
Another Decimal128 value to compare.
Returns a Boolean value indicating whether the decimal128 value of the first argument is greater than or equal to that of the second argument.
DeclarationSwift
public static func >= (lhs: Decimal128, rhs: Decimal128) -> Bool
Parameters lhs
A Decimal128 value to compare.
rhs
Another Decimal128 value to compare.
Returns a Boolean value indicating whether the decimal128 value of the first argument is greater than that of the second argument.
DeclarationSwift
public static func > (lhs: Decimal128, rhs: Decimal128) -> Bool
Parameters lhs
A Decimal128 value to compare.
rhs
Another Decimal128 value to compare.
Creates a new instance from the given integer, if it can be represented exactly.
If the value passed as source
is not representable exactly, the result is nil
. In the following example, the constant x
is successfully created from a value of 100
, while the attempt to initialize the constant y
from 1_000
fails because the Int8
type can represent 127
at maximum:
Swift
public convenience init?<T>(exactly source: T) where T : BinaryInteger
Parameters source
A value to convert to this type of integer.
A type that can represent the absolute value of Decimal128
DeclarationSwift
public typealias Magnitude = Decimal128
The magnitude of this Decimal128.
DeclarationSwift
public var magnitude: Magnitude { get }
Adds two decimal128 values and produces their sum.
DeclarationSwift
public static func + (lhs: Decimal128, rhs: Decimal128) -> Decimal128
Parameters lhs
The first Decimal128 value to add.
rhs
The second Decimal128 value to add.
Subtracts one Decimal128 value from another and produces their difference.
DeclarationSwift
public static func - (lhs: Decimal128, rhs: Decimal128) -> Decimal128
Parameters lhs
A Decimal128 value.
rhs
The Decimal128 value to subtract from lhs
.
Multiplies two Decimal128 values and produces their product.
DeclarationSwift
public static func * (lhs: Decimal128, rhs: Decimal128) -> Decimal128
Parameters lhs
The first value to multiply.
rhs
The second value to multiply.
Multiplies two values and stores the result in the left-hand-side variable.
DeclarationSwift
public static func *= (lhs: inout Decimal128, rhs: Decimal128)
Parameters lhs
The first value to multiply.
rhs
The second value to multiply.
Returns the quotient of dividing the first Decimal128 value by the second.
DeclarationSwift
public static func / (lhs: Decimal128, rhs: Decimal128) -> Decimal128
Parameters lhs
The Decimal128 value to divide.
rhs
The Decimal128 value to divide lhs
by. rhs
must not be zero.
A type that represents the distance between two values.
DeclarationSwift
public typealias Stride = Decimal128
Returns the distance from this Decimal128 to the given value, expressed as a stride.
DeclarationSwift
public func distance(to other: Decimal128) -> Decimal128
Parameters other
The Decimal128 value to calculate the distance to.
Return ValueThe distance from this value to other
.
Returns a Decimal128 that is offset the specified distance from this value.
Use the advanced(by:)
method in generic code to offset a value by a specified distance. If you’re working directly with numeric values, use the addition operator (+
) instead of this method.
Swift
public func advanced(by n: Decimal128) -> Decimal128
Parameters n
The distance to advance this Decimal128.
Return ValueA Decimal128 that is offset from this value by n
.
true
if self
is a signaling NaN, false
otherwise.
Swift
public var isSignaling: Bool { get }
true
if self
is a signaling NaN, false
otherwise.
Swift
public var isSignalingNaN: Bool { get }
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4