scala

class BigInt

[source: scala/BigInt.scala]

@serializable

class BigInt(val bigInteger : java.math.BigInteger)
extends java.lang.Number with AnyRef
Author
Martin Odersky
Version
1.0, 15/07/2003
 Method Summary def % (that : BigInt) : BigInt Remainder of BigInts def & (that : BigInt) : BigInt Bitwise and of BigInts def &~ (that : BigInt) : BigInt Bitwise and-not of BigInts. Returns a BigInt whose value is (this & ~that). def * (that : BigInt) : BigInt Multiplication of BigInts def + (that : BigInt) : BigInt Addition of BigInts def - (that : BigInt) : BigInt Subtraction of BigInts def / (that : BigInt) : BigInt Division of BigInts def /% (that : BigInt) : (BigInt, BigInt) Returns a pair of two BigInts containing (this / that) and (this % that). def < (that : BigInt) : Boolean Less-than of BigInts def << (n : Int) : BigInt Leftshift of BigInt def <= (that : BigInt) : Boolean Less-than-or-equals comparison of BigInts def > (that : BigInt) : Boolean Greater-than comparison of BigInts def >= (that : BigInt) : Boolean Greater-than-or-equals comparison of BigInts def >> (n : Int) : BigInt (Signed) rightshift of BigInt def ^ (that : BigInt) : BigInt Bitwise exclusive-or of BigInts def abs : BigInt Returns the absolute value of this BigInt def bitCount : Int Returns the number of bits in the two's complement representation of this BigInt that differ from its sign bit. def bitLength : Int Returns the number of bits in the minimal two's-complement representation of this BigInt, excluding a sign bit. override def byteValue : Byte Converts this BigInt to a byte. If the BigInt is too big to fit in a byte, only the low-order 8 bits are returned. Note that this conversion can lose information about the overall magnitude of the BigInt value as well as return a result with the opposite sign. def charValue : Char Converts this BigInt to a char. If the BigInt is too big to fit in a char, only the low-order 16 bits are returned. Note that this conversion can lose information about the overall magnitude of the BigInt value and that it always returns a positive result. def clearBit (n : Int) : BigInt Returns a BigInt whose value is equivalent to this BigInt with the designated bit cleared. def compare (that : BigInt) : Int Compares this BigInt with the specified BigInt def doubleValue : Double Converts this BigInt to a double. if this BigInt has too great a magnitude to represent as a float, it will be converted to Float.NEGATIVE_INFINITY or Float.POSITIVE_INFINITY as appropriate. def equals (that : BigInt) : Boolean Compares this BigInt with the specified BigInt for equality. override def equals (that : Any) : Boolean Compares this BigInt with the specified value for equality. def flipBit (n : Int) : BigInt Returns a BigInt whose value is equivalent to this BigInt with the designated bit flipped. def floatValue : Float Converts this BigInt to a float. if this BigInt has too great a magnitude to represent as a float, it will be converted to Float.NEGATIVE_INFINITY or Float.POSITIVE_INFINITY as appropriate. def gcd (that : BigInt) : BigInt Returns the greatest common divisor of abs(this) and abs(that) override def hashCode : Int Returns the hash code for this BigInt. def intValue : Int Converts this BigInt to an int. If the BigInt is too big to fit in a char, only the low-order 32 bits are returned. Note that this conversion can lose information about the overall magnitude of the BigInt value as well as return a result with the opposite sign. def isProbablePrime (certainty : Int) : Boolean Returns true if this BigInt is probably prime, false if it's definitely composite. def longValue : Long Converts this BigInt to a long. If the BigInt is too big to fit in a char, only the low-order 64 bits are returned. Note that this conversion can lose information about the overall magnitude of the BigInt value as well as return a result with the opposite sign. def lowestSetBit : Int Returns the index of the rightmost (lowest-order) one bit in this BigInt (the number of zero bits to the right of the rightmost one bit). def max (that : BigInt) : BigInt Returns the maximum of this and that def min (that : BigInt) : BigInt Returns the minimum of this and that def mod (that : BigInt) : BigInt Returns a BigInt whose value is (this mod m). This method differs from `%' in that it always returns a non-negative BigInt. def modInverse (m : BigInt) : BigInt Returns a BigInt whose value is (the inverse of this modulo m). def modPow (exp : BigInt, m : BigInt) : BigInt Returns a BigInt whose value is (this raised to the power of exp modulo m). def pow (exp : Int) : BigInt Returns a BigInt whose value is (this raised to the power of exp). def setBit (n : Int) : BigInt Returns a BigInt whose value is equivalent to this BigInt with the designated bit set. override def shortValue : Short Converts this BigInt to a short. If the BigInt is too big to fit in a byte, only the low-order 16 bits are returned. Note that this conversion can lose information about the overall magnitude of the BigInt value as well as return a result with the opposite sign. def signum : Int Returns the sign of this BigInt, i.e. -1 if it is less than 0, +1 if it is greater than 0 0 if it is equal to 0 def testBit (n : Int) : Boolean Returns true if and only if the designated bit is set. def toByteArray : Array[Byte] Returns a byte array containing the two's-complement representation of this BigInt. The byte array will be in big-endian byte-order: the most significant byte is in the zeroth element. The array will contain the minimum number of bytes required to represent this BigInt, including at least one sign bit. def toString (radix : Int) : java.lang.String Returns the String representation in the specified radix of this BigInt. override def toString : java.lang.String Returns the decimal String representation of this BigInt. def unary_- : BigInt Returns a BigInt whose value is the negation of this BigInt def | (that : BigInt) : BigInt Bitwise or of BigInts def ~ : BigInt Returns the bitwise complement of this BigNum
 Methods inherited from AnyRef getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
 Methods inherited from Any ==, !=, isInstanceOf, asInstanceOf
 Method Details
override def hashCode : Int
Returns the hash code for this BigInt.

override def equals(that : Any) : Boolean
Compares this BigInt with the specified value for equality.

def equals(that : BigInt) : Boolean
Compares this BigInt with the specified BigInt for equality.

def compare(that : BigInt) : Int
Compares this BigInt with the specified BigInt

def <=(that : BigInt) : Boolean
Less-than-or-equals comparison of BigInts

def >=(that : BigInt) : Boolean
Greater-than-or-equals comparison of BigInts

def <(that : BigInt) : Boolean
Less-than of BigInts

def >(that : BigInt) : Boolean
Greater-than comparison of BigInts

def +(that : BigInt) : BigInt

def -(that : BigInt) : BigInt
Subtraction of BigInts

def *(that : BigInt) : BigInt
Multiplication of BigInts

def /(that : BigInt) : BigInt
Division of BigInts

def %(that : BigInt) : BigInt
Remainder of BigInts

def /%(that : BigInt) : (BigInt, BigInt)
Returns a pair of two BigInts containing (this / that) and (this % that).

def <<(n : Int) : BigInt
Leftshift of BigInt

def >>(n : Int) : BigInt
(Signed) rightshift of BigInt

def &(that : BigInt) : BigInt
Bitwise and of BigInts

def |(that : BigInt) : BigInt
Bitwise or of BigInts

def ^(that : BigInt) : BigInt
Bitwise exclusive-or of BigInts

def &~(that : BigInt) : BigInt
Bitwise and-not of BigInts. Returns a BigInt whose value is (this & ~that).

def gcd(that : BigInt) : BigInt
Returns the greatest common divisor of abs(this) and abs(that)

def mod(that : BigInt) : BigInt
Returns a BigInt whose value is (this mod m). This method differs from `%' in that it always returns a non-negative BigInt.

def min(that : BigInt) : BigInt
Returns the minimum of this and that

def max(that : BigInt) : BigInt
Returns the maximum of this and that

def pow(exp : Int) : BigInt
Returns a BigInt whose value is (this raised to the power of exp).

def modPow(exp : BigInt, m : BigInt) : BigInt
Returns a BigInt whose value is (this raised to the power of exp modulo m).

def modInverse(m : BigInt) : BigInt
Returns a BigInt whose value is (the inverse of this modulo m).

def unary_- : BigInt
Returns a BigInt whose value is the negation of this BigInt

def abs : BigInt
Returns the absolute value of this BigInt

def signum : Int
Returns the sign of this BigInt, i.e. -1 if it is less than 0, +1 if it is greater than 0 0 if it is equal to 0

def ~ : BigInt
Returns the bitwise complement of this BigNum

def testBit(n : Int) : Boolean
Returns true if and only if the designated bit is set.

def setBit(n : Int) : BigInt
Returns a BigInt whose value is equivalent to this BigInt with the designated bit set.

def clearBit(n : Int) : BigInt
Returns a BigInt whose value is equivalent to this BigInt with the designated bit cleared.

def flipBit(n : Int) : BigInt
Returns a BigInt whose value is equivalent to this BigInt with the designated bit flipped.

def lowestSetBit : Int
Returns the index of the rightmost (lowest-order) one bit in this BigInt (the number of zero bits to the right of the rightmost one bit).

def bitLength : Int
Returns the number of bits in the minimal two's-complement representation of this BigInt, excluding a sign bit.

def bitCount : Int
Returns the number of bits in the two's complement representation of this BigInt that differ from its sign bit.

def isProbablePrime(certainty : Int) : Boolean
Returns true if this BigInt is probably prime, false if it's definitely composite.
Parameters
certainty - a measure of the uncertainty that the caller is willing to tolerate: if the call returns true the probability that this BigInt is prime exceeds (1 - 1/2 ^ certainty). The execution time of this method is proportional to the value of this parameter.

override def byteValue : Byte
Converts this BigInt to a byte. If the BigInt is too big to fit in a byte, only the low-order 8 bits are returned. Note that this conversion can lose information about the overall magnitude of the BigInt value as well as return a result with the opposite sign.
Overrides
java.lang.Number.java.lang.Number.byteValue

override def shortValue : Short
Converts this BigInt to a short. If the BigInt is too big to fit in a byte, only the low-order 16 bits are returned. Note that this conversion can lose information about the overall magnitude of the BigInt value as well as return a result with the opposite sign.
Overrides
java.lang.Number.java.lang.Number.shortValue

def charValue : Char
Converts this BigInt to a char. If the BigInt is too big to fit in a char, only the low-order 16 bits are returned. Note that this conversion can lose information about the overall magnitude of the BigInt value and that it always returns a positive result.

def intValue : Int
Converts this BigInt to an int. If the BigInt is too big to fit in a char, only the low-order 32 bits are returned. Note that this conversion can lose information about the overall magnitude of the BigInt value as well as return a result with the opposite sign.
Overrides
java.lang.Number.java.lang.Number.intValue

def longValue : Long
Converts this BigInt to a long. If the BigInt is too big to fit in a char, only the low-order 64 bits are returned. Note that this conversion can lose information about the overall magnitude of the BigInt value as well as return a result with the opposite sign.
Overrides
java.lang.Number.java.lang.Number.longValue

def floatValue : Float
Converts this BigInt to a float. if this BigInt has too great a magnitude to represent as a float, it will be converted to Float.NEGATIVE_INFINITY or Float.POSITIVE_INFINITY as appropriate.
Overrides
java.lang.Number.java.lang.Number.floatValue

def doubleValue : Double
Converts this BigInt to a double. if this BigInt has too great a magnitude to represent as a float, it will be converted to Float.NEGATIVE_INFINITY or Float.POSITIVE_INFINITY as appropriate.
Overrides
java.lang.Number.java.lang.Number.doubleValue

override def toString : java.lang.String
Returns the decimal String representation of this BigInt.

def toString(radix : Int) : java.lang.String
Returns the String representation in the specified radix of this BigInt.

def toByteArray : Array[Byte]
Returns a byte array containing the two's-complement representation of this BigInt. The byte array will be in big-endian byte-order: the most significant byte is in the zeroth element. The array will contain the minimum number of bytes required to represent this BigInt, including at least one sign bit.