This is a library providing advanced numeric data types for the Swift 2 programming language. The current version implements three new numeric types:
BigInt
: arbitrary-precision signed integersRational
: signed rational numbersComplex
: complex numbers
Requirements: XCode 7.0 (beta) with Swift 2
BigInt
objects are immutable, signed, arbitrary-precision integers that can be used as a
drop-in replacement for the existing integer types of Swift 2. Class BigInt
defines all
the standard arithmetic integer operations and implements the corresponding protocols defined
in the standard library.
Struct Rational<T>
defines rational numbers based on an existing signed integer type
T
, like Int32
, Int64
, or BigInt
. A rational number is a signed number that can
be expressed as the quotient of two integers a and b: a / b.
Struct Complex<T>
defines complex numbers based on an existing floating point type T
,
like Float
or Double
. A complex number consists of two components, a real part re
and an imaginary part im and is typically written as: re + im * i where i is
the imaginary unit.