var abs: BInt
The absolute value of self
var bitWidth: Int
The number of bits in the binary representation of the magnitude of self
. 0 if self
= 0
var description: String
Base 10 string value of self
var isEven: Bool
Is true
if self
is even, false
if self
is odd
var isNegative: Bool
The sign, true
if self
< 0, false
if self
>= 0
var isNotZero: Bool
Is false
if self
= 0, true
otherwise
var isOdd: Bool
Is true
if self
is odd, false
if self
is even
var isOne: Bool
Is true
if self
= 1, false
otherwise
var isPositive: Bool
Is true
if self
> 0, false
otherwise
var isPow2: Bool
Is true
if self
is a power of 2: 1, 2, 4, 8 …, false
otherwise
var isZero: Bool
Is true
if self
= 0, false
otherwise
var leadingZeroBitCount: Int
The number of leading zero bits in the magnitude of self
. 0 if self
= 0
var magnitude: BInt
var population: Int
The number of 1 bits in the magnitude of self
var signum: Int
Is 0 if self
= 0, 1 if self
> 0, and -1 if self
< 0
var trailingZeroBitCount: Int
The number of trailing zero bits in the magnitude of self
. 0 if self
= 0
var words: [UInt]
func asDouble() -> Double
self
as a Double
func asInt() -> Int?
self
as an Int
func asMagnitudeBytes() -> Bytes
Byte array representation of magnitude value
func asSignedBytes() -> Bytes
Byte array representation of 2’s complement value
func asString(radix: Int, uppercase: Bool) -> String
self
as a String
with a given radix
func clearBit(Int)
Clear a specified bit - a no-op if bit number < 0
func expMod(BInt, BInt) -> BInt
Modular exponentiation - BInt version
func expMod(BInt, Int) -> Int
Modular exponentiation - Int version
func flipBit(Int)
Invert a specified bit - a no-op if bit number < 0
func gcd(BInt) -> BInt
Greatest common divisor - BInt version
func gcd(Int) -> BInt
Greatest common divisor - Int version
func gcdExtended(BInt) -> (g: BInt, a: BInt, b: BInt)
Extended greatest common divisor - BInt version
func gcdExtended(Int) -> (g: BInt, a: BInt, b: BInt)
Extended greatest common divisor - Int version
func isPerfectRoot() -> Bool
Check whether self
is a perfect root, that is, for some integer x
and n
> 1 self
= x^n
func isPerfectSquare() -> Bool
Check whether self
is a perfect square, that is, for some integer x
, self
= x^2
func jacobiSymbol(Int) -> Int
Jacobi symbol - Int version. If m
is an odd prime, this is also the Legendre symbol
func jacobiSymbol(BInt) -> Int
Jacobi symbol - BInt version. If m is an odd prime, this is also the Legendre symbol
func kroneckerSymbol(Int) -> Int
Kronecker symbol - Int version. If m
is positive and odd, this is also the Jacobi symbol
func kroneckerSymbol(BInt) -> Int
Kronecker symbol - BInt version. If m
is positive and odd, this is also the Jacobi symbol
func lcm(BInt) -> BInt
Least common multiple - BInt version
func lcm(Int) -> BInt
Least common multiple - Int version
func mod(BInt) -> BInt
Modulus - BInt version
func mod(Int) -> Int
Modulus - Int version
func modInverse(BInt) -> BInt
Inverse modulus - BInt version
func modInverse(Int) -> Int
Inverse modulus - Int version
func negate()
Negates self
func quotientAndRemainder(dividingBy: BInt) -> (quotient: BInt, remainder: BInt)
Division
func quotientAndRemainder(dividingBy: Int) -> (quotient: BInt, remainder: Int)
Division
func quotientAndRemainder(dividingBy: BInt, inout BInt, inout BInt)
Division
func quotientAndRemainder(dividingBy: Int, inout BInt, inout Int)
Division
func quotientExact(dividingBy: BInt) -> BInt
Exact division - that is, the remainder of the division is known to be 0
func randomFrom(BInt) -> BInt
Random value
func randomLessThan() -> BInt
Random value
func randomTo(BInt) -> BInt
Random value
func root(Int) -> BInt
n’th root
func rootRemainder(Int) -> (root: BInt, rem: BInt)
n’th root and remainder
func setBit(Int)
Set a specified bit - a no-op if bit number < 0
func sqrt() -> BInt
Square root of a non-negative number
func sqrtMod(BInt) -> BInt?
Square root modulo a prime number - BInt version
func sqrtMod(Int) -> Int?
Square root modulo a prime number - Int version
func sqrtRemainder() -> (root: BInt, rem: BInt)
Square root and remainder of a non-negative number
func testBit(Int) -> Bool
Test a specified bit - false
if bit number < 0