bi_internal var a:Array
bi_internal var s:int
public var t:int
public function BigInteger(value:* = null, radix:int = 0, unsigned:Boolean = false)
Parameters
| value:* (default = null) |
| |
| radix:int (default = 0) — WARNING: If value is ByteArray, this holds the number of bytes to use.
|
| |
| unsigned:Boolean (default = false) |
public function abs():BigInteger
|this|
Returns
public function add(a:BigInteger):BigInteger
Parameters
Returns
protected function addTo(a:BigInteger, r:BigInteger):void
Parameters
bi_internal function am(i:int, x:int, w:BigInteger, j:int, c:int, n:int):int
am: Compute w_j += (xhis_i), propagates carries,
c is initial carry, returns final carry.
c < 3value, x < 2value, this_i < dvalue
Parameters
Returns
public function and(a:BigInteger):BigIntegerParameters
Returns
public function andNot(a:BigInteger):BigIntegerParameters
Returns
public function bitCount():int
Returns
public function bitLength():int
returns the number of bits in this
Returns
protected function bitwiseTo(a:BigInteger, op:Function, r:BigInteger):void
Parameters
| a:BigInteger — a BigInteger to perform the operation with
|
| |
| op:Function — a Function implementing the operation
|
| |
| r:BigInteger — a BigInteger to store the result of the operation
|
public function byteValue():int
Returns
protected function changeBit(n:int, op:Function):BigInteger
Parameters
Returns
protected function chunkSize(r:Number):int
Parameters
Returns
bi_internal function clamp():void
clamp off excess high words
public function clearBit(n:int):BigInteger
Parameters
Returns
public function clone():BigInteger
Returns
public function compareTo(v:BigInteger):int
return + if this > v, - if this < v, 0 if equal
Parameters
Returns
bi_internal function copyTo(r:BigInteger):void
copy this to r
Parameters
bi_internal function dAddOffset(n:int, w:int):void
this += n << w words, this >= 0
Parameters
public function dispose():void
public function divide(a:BigInteger):BigInteger
Parameters
Returns
public function divideAndRemainder(a:BigInteger):Array
Parameters
Returns
bi_internal function divRemTo(m:BigInteger, q:BigInteger = null, r:BigInteger = null):void
divide this by m, quotient and remainder to q, r (HAC 14.20)
r != q, this != m. q or r may be null.
Parameters
bi_internal function dlShiftTo(n:int, r:BigInteger):void
r = this << nB
Parameters
bi_internal function dMultiply(n:int):void
this n, this >=0, 1 < n < DV
Parameters
bi_internal function drShiftTo(n:int, r:BigInteger):void
r = this >> nB
Parameters
public function equals(a:BigInteger):BooleanParameters
Returns
bi_internal function exp(e:int, z:IReduction):BigInteger
this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
Parameters
Returns
public function flipBit(n:int):BigInteger
Parameters
Returns
bi_internal function fromArray(value:ByteArray, length:int, unsigned:Boolean = false):void
set from ByteArray and length,
starting a current position
If length goes beyond the array, pad with zeroes.
Parameters
| value:ByteArray |
| |
| length:int |
| |
| unsigned:Boolean (default = false) |
bi_internal function fromInt(value:int):void
set from integer value "value", -DV <= value < DV
Parameters
protected function fromRadix(s:String, b:int = 10):void
Parameters
| s:String — a string to convert from using radix.
|
| |
| b:int (default = 10) — a radix
|
public function gcd(a:BigInteger):BigInteger
Parameters
Returns
public function getLowestSetBit():int
Returns
| int — index of lowest 1-bit (or -1 if none)
|
bi_internal function intAt(str:String, index:int):intParameters
Returns
public function intValue():int
Returns
bi_internal function invDigit():int
return "-1/this % 2^DB"; useful for Mont. reduction
justification:
xy == 1 (mod n)
xy = 1+km
xy(2-xy) = (1+km)(1-km)
x[y(2-xy)] = 1-k^2.m^2
x[y(2-xy)] == 1 (mod m^2)
if y is 1/x mod m, then y(2-xy) is 1/x mod m^2
should reduce x and y(2-xy) by m^2 at each step to keep size bounded
[XXX unit test the living shit out of this.]
Returns
bi_internal function isEven():Boolean
true iff this is even
Returns
public function isProbablePrime(t:int):Boolean
Parameters
Returns
| Boolean — primality with certainty >= 1-.5^t
|
bi_internal function lShiftTo(n:int, r:BigInteger):void
r = this << n
Parameters
public function max(a:BigInteger):BigIntegerParameters
Returns
protected function millerRabin(t:int):Boolean
Parameters
Returns
| Boolean — true if probably prime (HAC 4.24, Miller-Rabin)
|
public function min(a:BigInteger):BigIntegerParameters
Returns
public function mod(v:BigInteger):BigInteger
Parameters
Returns
protected function modInt(n:int):int
Parameters
Returns
public function modInverse(m:BigInteger):BigInteger
Parameters
Returns
public function modPow(e:BigInteger, m:BigInteger):BigInteger
Parameters
Returns
public function modPowInt(e:int, m:BigInteger):BigInteger
this^e % m, 0 <= e < 2^32
Parameters
Returns
public function multiply(a:BigInteger):BigInteger
Parameters
Returns
bi_internal function multiplyLowerTo(a:BigInteger, n:int, r:BigInteger):void
Parameters
bi_internal function multiplyTo(v:BigInteger, r:BigInteger):void
r = this v, r != this,a (HAC 14.12)
"this" should be the larger one if appropriate
Parameters
bi_internal function multiplyUpperTo(a:BigInteger, n:int, r:BigInteger):void
Parameters
protected function nbi():*
Returns
bi_internal function nbits(x:int):int
returns bit length of the integer x
Parameters
Returns
public static function nbv(value:int):BigInteger
return bigint initialized to value
Parameters
Returns
public function negate():BigInteger
-this
Returns
public function not():BigInteger
Returns
public function or(a:BigInteger):BigIntegerParameters
Returns
public function pow(e:int):BigInteger
Parameters
Returns
public function primify(bits:int, t:int):void
Tweak our BigInteger until it looks prime enough
Parameters
public function remainder(a:BigInteger):BigIntegerParameters
Returns
bi_internal function rShiftTo(n:int, r:BigInteger):void
r = this >> n
Parameters
public function setBit(n:int):BigInteger
Parameters
Returns
public function shiftLeft(n:int):BigIntegerParameters
Returns
public function shiftRight(n:int):BigIntegerParameters
Returns
public function shortValue():int
Returns
| int — value as short (assumes DB>=16)
|
public function sigNum():int
Returns
| int — 0 if this ==0, 1 if this >0
|
bi_internal function squareTo(r:BigInteger):void
r = this^2, r != this (HAC 14.16)
Parameters
bi_internal function subTo(v:BigInteger, r:BigInteger):void
r = this - v
Parameters
public function subtract(a:BigInteger):BigInteger
Parameters
Returns
public function testBit(n:int):Boolean
Parameters
Returns
| Boolean — true iff nth bit is set
|
public function toArray(array:ByteArray):uintParameters
Returns
public function toByteArray():ByteArray
Returns
| ByteArray — a byte array.
|
protected function toRadix(b:uint = 10):String
Parameters
| b:uint (default = 10) — radix to use
|
Returns
| String — a string representing the integer converted to the radix.
|
public function toString(radix:Number = 16):StringParameters
| radix:Number (default = 16) |
Returns
public function valueOf():Number
best-effort attempt to fit into a Number.
precision can be lost if it just can't fit.
Returns
public function xor(a:BigInteger):BigIntegerParameters
Returns
public static const BI_FP:int = 52
public static const DB:int = 30
public static const DM:int
public static const DV:int
public static const F1:int = 22
public static const F2:int = 8
public static const FV:Number
public static const lowprimes:Array
public static const lplim:int
public static const ONE:BigInteger
public static const ZERO:BigInteger