Structures
The following structures are available globally.

An arbitary precision unsigned integer type, also known as a “big integer”.
Operations on big integers never overflow, but they may take a long time to execute. The amount of memory (and address space) available is the only constraint to the magnitude of these numbers.
This particular big integer type uses base2^64 digits to represent integers; you can think of it as a wrapper around
See moreArray<UInt64>
. (In fact,BigUInt
only uses an array if there are more than two digits.)Declaration
Swift
public struct BigUInt : UnsignedInteger
extension BigUInt: Codable
extension BigUInt: Comparable
extension BigUInt: Hashable
extension BigUInt: ExpressibleByIntegerLiteral
extension BigUInt: Strideable
extension BigUInt: ExpressibleByStringLiteral
extension BigUInt: CustomStringConvertible
extension BigUInt: CustomPlaygroundDisplayConvertible

An arbitary precision signed integer type, also known as a “big integer”.
Operations on big integers never overflow, but they might take a long time to execute. The amount of memory (and address space) available is the only constraint to the magnitude of these numbers.
This particular big integer type uses base2^64 digits to represent integers.
BigInt
is essentially a tiny wrapper that extendsBigUInt
with a sign bit and provides signed integer operations. Both the underlying absolute value and the negative/positive flag are available as readwrite properties.Not all algorithms of
BigUInt
are available forBigInt
values; for example, there is no square root or primality test for signed integers. When you need to call one of these, just extract the absolute value:
See moreBigInt(255).abs.isPrime() // Returns false
Declaration
Swift
public struct BigInt : SignedInteger
extension BigInt: Codable
extension BigInt: Hashable
extension BigInt: ExpressibleByIntegerLiteral
extension BigInt: Strideable
extension BigInt: ExpressibleByStringLiteral
extension BigInt: CustomStringConvertible
extension BigInt: CustomPlaygroundDisplayConvertible