One Logo Pool Ball
Foundation · IOS API REFERENCE

Decimal

struct · SDK 27.1

struct Decimal

Members (56)

get · iOS 8.0+

isInfinite

TypeScript
get isInfinite(): boolean
Swift declaration
var isInfinite: Bool { get }

A Boolean value indicating whether this decimal is infinity.

get · iOS 8.0+

description

TypeScript
get description(): string
Swift declaration
var description: String { get }

A textual representation of this instance. Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the `String(describing:)` initializer. This initializer works with any type, and uses the custom `description` property for types that conform to `CustomStringConvertible`: struct Point: CustomStringConvertible { let x: Int, y: Int var description: String { return "(\(x), \(y))" } } let p = Point(x: 21, y: 30) let s = String(describing: p) print(s) // Prints "(21, 30)" The conversion of `p` to a string in the assignment to `s` uses the `Point` type's `description` property.

get · iOS 8.0+

isCanonical

TypeScript
get isCanonical(): boolean
Swift declaration
var isCanonical: Bool { get }

A Boolean value indicating whether the representation of this decimal is canonical.

get · iOS 8.0+

isSignMinus

TypeScript
get isSignMinus(): boolean
Swift declaration
var isSignMinus: Bool { get }

A Boolean value indicating whether this decimal has a negative sign. This property is `true` when the value is negative or `-0.0`; otherwise, `false`.

get · iOS 8.0+

isSignaling

TypeScript
get isSignaling(): boolean
Swift declaration
var isSignaling: Bool { get }

A Boolean value indicating whether this decimal is a signaling NaN.

get · iOS 8.0+

isSubnormal

TypeScript
get isSubnormal(): boolean
Swift declaration
var isSubnormal: Bool { get }

A Boolean value indicating whether this decimal is subnormal.

get · iOS 8.0+

significand

TypeScript
get significand(): Decimal
Swift declaration
var significand: Decimal { get }

The significand of the decimal.

init · iOS 8.0+

init

TypeScript
static initFloatLiteral(value: number): Decimal
Swift declaration
init(floatLiteral value: Double)

Creates and initializes a decimal with the provided floating point value.

init · iOS 8.0+

init

TypeScript
static initIntegerLiteral(value: number): Decimal
Swift declaration
init(integerLiteral value: Int)

Creates and initializes a decimal with the provided integer value.

get · iOS 8.0+

isSignalingNaN

TypeScript
get isSignalingNaN(): boolean
Swift declaration
var isSignalingNaN: Bool { get }

A Boolean value indicating whether this decimal is a signaling NaN.

method · iOS 8.0+

isTotallyOrdered

TypeScript
isTotallyOrdered(other: Decimal): boolean
Swift declaration
func isTotallyOrdered(belowOrEqualTo other: Decimal) -> Bool

Returns a Boolean value indicating whether this instance should precede the given value in an ascending sort.

get · iOS 8.0+

floatingPointClass

TypeScript
get floatingPointClass(): SDKHandle
Swift declaration
var floatingPointClass: FloatingPointClassification { get }

The IEEE 754 class of this type.

method · iOS 8.0+

isLessThanOrEqualTo

TypeScript
isLessThanOrEqualTo(other: Decimal): boolean
Swift declaration
func isLessThanOrEqualTo(_ other: Decimal) -> Bool

Indicates whether this decimal is less than or equal to the specified one.

get · iOS 8.0+

leastFiniteMagnitude

TypeScript
static get leastFiniteMagnitude(): Decimal
Swift declaration
static let leastFiniteMagnitude: Decimal

The decimal that contains the smallest possible non-infinite magnitude for the underlying representation.

get · iOS 8.0+

leastNormalMagnitude

TypeScript
static get leastNormalMagnitude(): Decimal
Swift declaration
static let leastNormalMagnitude: Decimal

The decimal value that represents the smallest possible normal magnitude for the underlying representation.

get · iOS 8.0+

leastNonzeroMagnitude

TypeScript
static get leastNonzeroMagnitude(): Decimal
Swift declaration
static let leastNonzeroMagnitude: Decimal

The decimal value that represents the smallest possible non-zero value for the underlying representation.

get · iOS 8.0+

greatestFiniteMagnitude

TypeScript
static get greatestFiniteMagnitude(): Decimal
Swift declaration
static let greatestFiniteMagnitude: Decimal

The decimal that contains the largest possible non-infinite magnitude for the underlying representation.

get · iOS 8.0+

pi

TypeScript
static get pi(): Decimal
Swift declaration
static let pi: Decimal

The mathematical constant pi.

get · iOS 8.0+

nan

TypeScript
static get nan(): Decimal
Swift declaration
static var nan: Decimal { get }

The value that represents "not a number."

get · iOS 8.0+

ulp

TypeScript
get ulp(): Decimal
Swift declaration
var ulp: Decimal { get }

The unit in the last place of the decimal.

init · iOS 8.0+

init

TypeScript
static initSignExponentSignificand(sign: SDKHandle, exponent: number, significand: Decimal): Decimal
Swift declaration
init(sign: FloatingPointSign, exponent: Int, significand: Decimal)

Creates a decimal initialized with the given sign, exponent, and significand.

get · iOS 8.0+

sign

TypeScript
get sign(): SDKHandle
Swift declaration
var sign: FloatingPointSign { get }

The sign of the decimal.

get · iOS 8.0+

isNaN

TypeScript
get isNaN(): boolean
Swift declaration
var isNaN: Bool { get }

A Boolean value indicating whether this decimal is NaN.

get · iOS 8.0+

radix

TypeScript
static get radix(): number
Swift declaration
static var radix: Int { get }

The radix used by decimal numbers.

method · iOS 8.0+

isLess

TypeScript
isLess(other: Decimal): boolean
Swift declaration
func isLess(than other: Decimal) -> Bool

Indicates whether this decimal is less than the specified one.

get · iOS 8.0+

isZero

TypeScript
get isZero(): boolean
Swift declaration
var isZero: Bool { get }

A Boolean value indicating whether this value is zero. This property is `true` for `-0.0` and `+0.0` and `false` for all other values.

method · iOS 8.0+

negate

TypeScript
negate(): void
Swift declaration
mutating func negate()

Negates this decimal.

get · iOS 8.0+

nextUp

TypeScript
get nextUp(): Decimal
Swift declaration
var nextUp: Decimal { get }

The least representable value that is greater than this decimal.

init · iOS 8.0+

init

TypeScript
static initSignOfMagnitudeOf(signOf: Decimal, magnitude: Decimal): Decimal
Swift declaration
init(signOf: Decimal, magnitudeOf magnitude: Decimal)

Creates and initializes a decimal with the sign and magnitude of the given decimals. - Parameters: - signOf: A `Decimal` to use for the sign of the newly-created `Decimal`. - magnitude: A `Decimal` to use for the magnitude of the newly-created `Decimal`.

init · iOS 8.0+

init

TypeScript
static initStringLocale(string: string, locale?: (Locale) | null): (Decimal) | null
Swift declaration
init?(string: String, locale: Locale? = nil)

Creates and initializes a decimal by parsing a string according to the provided locale's conventions. - Parameters: - string: A string containing a formatted decimal value. - locale: A locale that indicates the formatting conventions used by `string`.

init · iOS 8.0+

init

TypeScript
static initExactly(source: number): (Decimal) | null
Swift declaration
init?<T>(exactly source: T) where T : BinaryInteger

Creates a new decimal value exactly representing the provided integer. If `source` isn't representable as a `Decimal` instance, the result is `nil`. - Parameter source: The integer to convert.

method · iOS 8.0+

isEqual

TypeScript
isEqual(other: Decimal): boolean
Swift declaration
func isEqual(to other: Decimal) -> Bool

Indicates whether this decimal is equal to the specified one.

method · iOS 8.0+

advanced

TypeScript
advanced(n: Decimal): Decimal
Swift declaration
func advanced(by n: Decimal) -> Decimal

Returns a new value advanced by the given distance.

method · iOS 8.0+

distance

TypeScript
distance(other: Decimal): Decimal
Swift declaration
func distance(to other: Decimal) -> Decimal

Returns the distance from this value to the specified value.

get · iOS 8.0+

exponent

TypeScript
get exponent(): number
Swift declaration
var exponent: Int { get }

The exponent of the decimal.

get · iOS 8.0+

isFinite

TypeScript
get isFinite(): boolean
Swift declaration
var isFinite: Bool { get }

A Boolean value indicating whether this decimal is zero, subnormal, or normal (not infinity or NaN).

get · iOS 8.0+

isNormal

TypeScript
get isNormal(): boolean
Swift declaration
var isNormal: Bool { get }

A Boolean value indicating whether this decimal is normal (not zero, subnormal, infinity, or NaN).

get · iOS 8.0+

nextDown

TypeScript
get nextDown(): Decimal
Swift declaration
var nextDown: Decimal { get }

The greatest representable value that is less than this decimal.

get · iOS 8.0+

quietNaN

TypeScript
static get quietNaN(): Decimal
Swift declaration
static var quietNaN: Decimal { get }

A quiet representation of not-a-number.

method · iOS 15.0+

formatted

TypeScript
formatted(): string
Swift declaration
func formatted() -> String

Formats the decimal using a default localized format style. - Returns: A string representation of the decimal, formatted according to the default format style.

get · iOS 8.0+

magnitude

TypeScript
get magnitude(): Decimal
Swift declaration
var magnitude: Decimal { get }

The magnitude of this decimal.

init · iOS 15.0+

init

TypeScript
static initFormatLenient(value: string, format: Decimal_FormatStyle_Percent, lenient?: boolean): Decimal
Swift declaration
init(_ value: String, format: Decimal.FormatStyle.Percent, lenient: Bool = true) throws
init · iOS 15.0+

init

TypeScript
static initFormatLenient97749(value: string, format: Decimal_FormatStyle_Currency, lenient?: boolean): Decimal
Swift declaration
init(_ value: String, format: Decimal.FormatStyle.Currency, lenient: Bool = true) throws
init · iOS 15.0+

init

TypeScript
static initFormatLenient99272(value: string, format: Decimal_FormatStyle, lenient?: boolean): Decimal
Swift declaration
init(_ value: String, format: Decimal.FormatStyle, lenient: Bool = true) throws
init · iOS 8.0+

init

TypeScript
static init(value: number): Decimal
Swift declaration
init(_ value: Double)

Creates and initializes a decimal with the provided floating point value.

init · iOS 8.0+

init

TypeScript
static init66917(value: number): Decimal
Swift declaration
init(_ value: Int)

Creates and initializes a decimal with the provided integer value.

init · iOS 8.0+

init

TypeScript
static init10465(value: number): Decimal
Swift declaration
init(_ value: UInt)

Creates and initializes a decimal with the provided unsigned integer value.

init · iOS 8.0+

init

TypeScript
static init67929(value: number): Decimal
Swift declaration
init(_ value: Int8)

Creates and initializes a decimal with the provided integer value.

init · iOS 8.0+

init

TypeScript
static init4129(value: number): Decimal
Swift declaration
init(_ value: Int16)

Creates and initializes a decimal with the provided integer value.

init · iOS 8.0+

init

TypeScript
static init76231(value: number): Decimal
Swift declaration
init(_ value: Int32)

Creates and initializes a decimal with the provided integer value.

init · iOS 8.0+

init

TypeScript
static init66852(value: number): Decimal
Swift declaration
init(_ value: Int64)

Creates and initializes a decimal with the provided integer value.

init · iOS 8.0+

init

TypeScript
static init41211(value: number): Decimal
Swift declaration
init(_ value: UInt8)

Creates and initializes a decimal with the provided unsigned integer value.

init · iOS 8.0+

init

TypeScript
static init80811(value: number): Decimal
Swift declaration
init(_ value: UInt16)

Creates and initializes a decimal with the provided unsigned integer value.

init · iOS 8.0+

init

TypeScript
static init74909(value: number): Decimal
Swift declaration
init(_ value: UInt32)

Creates and initializes a decimal with the provided unsigned integer value.

init · iOS 8.0+

init

TypeScript
static init26262(value: number): Decimal
Swift declaration
init(_ value: UInt64)

Creates and initializes a decimal with the provided unsigned integer value.

init

init

TypeScript
static init47032(): Decimal
Swift declaration
init()

Skipped declarations

2 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

Decimal.formatted(_:)

This declaration needs Swift generic type arguments. (no canonical witness for S)

Decimal.init(_:strategy:)

This declaration needs Swift generic type arguments. (no canonical witness for S.ParseInput)

All Foundation types →