Static Member Summary
Static Public Members | ||
public static get |
MINUS_ONE: BigInteger: * -1 |
|
public static get |
Negative Infinity. |
|
public static get |
NaN: BigInteger: * Not a Number. |
|
public static get |
ONE: BigInteger: * 1 |
|
public static get |
Positive infinity. |
|
public static get |
TEN: BigInteger: * 10 |
|
public static get |
TWO: BigInteger: * 2 |
|
public static get |
ZERO: BigInteger: * 0 |
Static Method Summary
Static Public Methods | ||
public static |
create(number: KBigIntegerInputData): BigInteger Create an entity object of this class. |
|
public static |
createRandomBigInteger(bitsize: KBigIntegerInputData, random: Random): BigInteger Random number of specified bit length. |
|
public static |
Return default Random class. |
|
public static |
probablePrime(bits: KBigIntegerInputData, random: Random, certainty: KBigIntegerInputData, create_count: KBigIntegerInputData): BigInteger Prime represented within the specified bit length. |
|
public static |
setDefaultRandom(random: Random) Set default class of random. |
|
public static |
valueOf(number: KBigIntegerInputData): BigInteger Create an arbitrary-precision integer. |
Constructor Summary
Public Constructor | ||
public |
constructor(number: KBigIntegerInputData) Create an arbitrary-precision integer. |
Member Summary
Public Members | ||
public get |
booleanValue: boolean: * boolean value. |
|
public get |
doubleValue: number: * 64-bit floating point. |
|
public get |
64-bit integer value. |
Private Members | ||
private |
An integer consisting of 16 bits per element of the array. |
|
private |
Numeric state. |
Method Summary
Public Methods | ||
public |
abs(): BigInteger Absolute value. |
|
public |
add(number: KBigIntegerInputData): BigInteger Add. |
|
public |
and(number: KBigIntegerInputData): BigInteger Logical AND. |
|
public |
Sum that the bit is 1 when represented in the two's complement. |
|
public |
Length when the number is binary. |
|
public |
cbrt(): BigInteger Cube root. |
|
public |
ceil(): BigInteger Ceil. |
|
public |
Lower a specific bit. |
|
public |
clip(min: KBigIntegerInputData, max: KBigIntegerInputData): BigInteger Clip number within range. |
|
public |
clone(): BigInteger Deep copy. |
|
public |
compareTo(number: KBigIntegerInputData): number Compare values. |
|
public |
compareToAbs(number: KBigIntegerInputData): number Compare values without sign. |
|
public |
div(number: KBigIntegerInputData): BigInteger Divide. |
|
public |
divide(number: KBigIntegerInputData): BigInteger Divide. |
|
public |
divideAndRemainder(number: KBigIntegerInputData): Array<BigInteger> Divide and rem. |
|
public |
equals(number: KBigIntegerInputData): boolean Equals. |
|
public |
equalsState(number: KBigIntegerInputData): boolean Numeric type match. |
|
public |
extgcd(number: KBigIntegerInputData): BigInteger[] Extended Euclidean algorithm. |
|
public |
factor(): BigInteger[] Factorization. |
|
public |
Factorial function, x!. |
|
public |
fix(): BigInteger To integer rounded down to the nearest. |
|
public |
Invert a specific bit. |
|
public |
floor(): BigInteger Floor. |
|
public |
fract(): BigInteger Fraction. |
|
public |
gcd(number: KBigIntegerInputData): BigInteger Euclidean algorithm. |
|
public |
Number of digits in which the number "1" appears first when expressed in binary. |
|
public |
getShort(point: KBigIntegerInputData): number Value at the specified position of the internally used array that composed of hexadecimal numbers. |
|
public |
inv(): BigInteger Inverse number of this value. |
|
public |
Return true if the value is finite number. |
|
public |
this === Infinity or -Infinity |
|
public |
this === NaN |
|
public |
this < 0 |
|
public |
this === -Infinity |
|
public |
this >= 0 |
|
public |
this === 1 |
|
public |
this > 0 |
|
public |
this === Infinity |
|
public |
Return true if the value is prime number. |
|
public |
isProbablePrime(certainty: KBigIntegerInputData): boolean Return true if the value is prime number by Miller-Labin prime number determination method. |
|
public |
this === 0 |
|
public |
lcm(number: KBigIntegerInputData): BigInteger Least common multiple. |
|
public |
log10(): BigInteger log_10(x) |
|
public |
log2(): BigInteger log_2(x) |
|
public |
max(number: KBigIntegerInputData): BigInteger Maximum number. |
|
public |
min(number: KBigIntegerInputData): BigInteger Minimum number. |
|
public |
mod(number: KBigIntegerInputData): BigInteger Modulo, positive rem of division. |
|
public |
Modular multiplicative inverse. |
|
public |
modPow(exponent: KBigIntegerInputData, m: KBigIntegerInputData): BigInteger Modular exponentiation. |
|
public |
mul(number: KBigIntegerInputData): BigInteger Multiply. |
|
public |
multiply(number: KBigIntegerInputData): BigInteger Multiply. |
|
public |
negate(): BigInteger this * -1 |
|
public |
nextProbablePrime(certainty: KBigIntegerInputData, search_max: KBigIntegerInputData): BigInteger Next prime. |
|
public |
not(): BigInteger Logical Not. |
|
public |
or(number: KBigIntegerInputData): BigInteger Logical OR. |
|
public |
pow(exponent: KBigIntegerInputData): BigInteger Power function. |
|
public |
rem(number: KBigIntegerInputData): BigInteger Remainder of division. |
|
public |
remainder(number: KBigIntegerInputData): BigInteger Remainder of division. |
|
public |
round(): BigInteger Rounding to the nearest integer. |
|
public |
Multiply a multiple of ten. |
|
public |
setBit(bit: KBigIntegerInputData): BigInteger this | (1 << n) |
|
public |
this << n |
|
public |
this << n |
|
public |
this >> n |
|
public |
The positive or negative sign of this number. |
|
public |
The positive or negative sign of this number. |
|
public |
sqrt(): BigInteger Square root. |
|
public |
square(): BigInteger Square. |
|
public |
sub(number: KBigIntegerInputData): BigInteger Subtract. |
|
public |
subtract(number: KBigIntegerInputData): BigInteger Subtract. |
|
public |
testBit(bit: KBigIntegerInputData): boolean Test if a particular bit is on. |
|
public |
return BigDecimal. |
|
public |
return BigInteger. |
|
public |
return Complex. |
|
public |
return Fraction. |
|
public |
Convert to JSON. |
|
public |
return Matrix. |
|
public |
toString(radix: KBigIntegerInputData): string Convert to string. |
|
public |
xor(number: KBigIntegerInputData): BigInteger Logical Exclusive-OR. |
Private Methods | ||
private |
_shift(shift_length: KBigIntegerInputData): BigInteger this <<= n |
|
private |
getTwosComplement(bit_length: number): BigInteger Create a numerical value for addition. |
Inherited Summary
From class KonpeitoInteger | ||
public static get |
-1 |
|
public static get |
Negative Infinity. |
|
public static get |
NaN: KonpeitoInteger: * Not a Number. |
|
public static get |
ONE: KonpeitoInteger: * 1 |
|
public static get |
Positive infinity. |
|
public static get |
TEN: KonpeitoInteger: * 10 |
|
public static get |
TWO: KonpeitoInteger: * 2 |
|
public static get |
ZERO: KonpeitoInteger: * 0 |
|
public static |
create(number: any): KonpeitoInteger Create an entity object of this class. |
|
public static |
valueOf(number: any): KonpeitoInteger Create number. |
|
public get |
booleanValue: boolean: * boolean value. |
|
public get |
doubleValue: number: * floating point. |
|
public get |
integer value. |
|
public |
Absolute value. |
|
public |
add(number: any): KonpeitoInteger Add. |
|
public |
and(number: any): KonpeitoInteger Logical AND. |
|
public |
Ceil. |
|
public |
Deep copy. |
|
public |
Compare values. |
|
public |
div(number: any): KonpeitoInteger Divide. |
|
public |
divide(number: any): KonpeitoInteger Divide. |
|
public |
Equals. |
|
public |
extgcd(number: any): KonpeitoInteger[] Extended Euclidean algorithm. |
|
public |
factor(): KonpeitoInteger[] Factorization. |
|
public |
Factorial function, x!. |
|
public |
To integer rounded down to the nearest. |
|
public |
Floor. |
|
public |
Fraction. |
|
public |
gcd(number: any): KonpeitoInteger Euclidean algorithm. |
|
public |
Inverse number of this value. |
|
public |
Return true if the value is finite number. |
|
public |
this === Infinity or -Infinity |
|
public |
this === NaN |
|
public |
this < 0 |
|
public |
this === -Infinity |
|
public |
this >= 0 |
|
public |
this === 1 |
|
public |
this > 0 |
|
public |
this === Infinity |
|
public |
Return true if the value is prime number. |
|
public |
isProbablePrime(certainty: any): boolean Return true if the value is prime number by Miller-Labin prime number determination method. |
|
public |
this === 0 |
|
public |
lcm(number: any): KonpeitoInteger Least common multiple. |
|
public |
mod(number: any): KonpeitoInteger Modulo, positive rem of division. |
|
public |
modInverse(m: any): KonpeitoInteger Modular multiplicative inverse. |
|
public |
modPow(exponent: any, m: any): KonpeitoInteger Modular exponentiation. |
|
public |
mul(number: any): KonpeitoInteger Multiply. |
|
public |
multiply(number: any): KonpeitoInteger Multiply. |
|
public |
this * -1 |
|
public |
nextProbablePrime(certainty: any, search_max: any): KonpeitoInteger Next prime. |
|
public |
Logical Not. |
|
public |
or(number: any): KonpeitoInteger Logical OR. |
|
public |
pow(exponent: any): KonpeitoInteger Power function. |
|
public |
rem(number: any): KonpeitoInteger Remainder of division. |
|
public |
remainder(number: any): KonpeitoInteger Remainder of division. |
|
public |
Rounding to the nearest integer. |
|
public |
scaleByPowerOfTen(n: any): KonpeitoInteger Multiply a multiple of ten. |
|
public |
shift(n: any): KonpeitoInteger this << n |
|
public |
sign(): any The positive or negative sign of this number. |
|
public |
signum(): any The positive or negative sign of this number. |
|
public |
Square. |
|
public |
sub(number: any): KonpeitoInteger Subtract. |
|
public |
subtract(number: any): KonpeitoInteger Subtract. |
|
public |
return BigDecimal. |
|
public |
return BigInteger. |
|
public |
return Complex. |
|
public |
return Fraction. |
|
public |
Convert to JSON. |
|
public |
return Matrix. |
|
public |
Convert to string. |
|
public |
xor(number: any): KonpeitoInteger Logical Exclusive-OR. |
Static Public Members
public static get NEGATIVE_INFINITY: BigInteger: * source
Negative Infinity.
Override:
KonpeitoInteger#NEGATIVE_INFINITYpublic static get POSITIVE_INFINITY: BigInteger: * source
Positive infinity.
Override:
KonpeitoInteger#POSITIVE_INFINITYStatic Public Methods
public static create(number: KBigIntegerInputData): BigInteger source
Create an entity object of this class.
Override:
KonpeitoInteger#createParams:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
public static createRandomBigInteger(bitsize: KBigIntegerInputData, random: Random): BigInteger source
Random number of specified bit length.
Params:
Name | Type | Attribute | Description |
bitsize | KBigIntegerInputData | Bit length. |
|
random | Random |
|
Class for creating random numbers. |
public static getDefaultRandom(): Random source
Return default Random class. Used when Random not specified explicitly.
public static probablePrime(bits: KBigIntegerInputData, random: Random, certainty: KBigIntegerInputData, create_count: KBigIntegerInputData): BigInteger source
Prime represented within the specified bit length.
Params:
Name | Type | Attribute | Description |
bits | KBigIntegerInputData | Bit length. |
|
random | Random |
|
Class for creating random numbers. |
certainty | KBigIntegerInputData |
|
Repeat count (prime precision). |
create_count | KBigIntegerInputData |
|
Number of times to retry if prime generation fails. |
public static setDefaultRandom(random: Random) source
Set default class of random. This is used if you do not specify a random number.
Params:
Name | Type | Attribute | Description |
random | Random |
public static valueOf(number: KBigIntegerInputData): BigInteger source
Create an arbitrary-precision integer.
- Does not support strings using exponential notation.
- If you want to initialize with the specified base number, please set up with an array ["ff", 16].
Override:
KonpeitoInteger#valueOfParams:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
Public Constructors
public constructor(number: KBigIntegerInputData) source
Create an arbitrary-precision integer.
Initialization can be performed as follows.
- 1200, "1200", "12e2", "1.2e3", ["1200", 10]
- "0xff", ["ff", 16]
- "0o01234567", ["01234567", 8]
- "0b0110101", ["0110101", 2]
Override:
KonpeitoInteger#constructorParams:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
|
Numeric data. See how to use the function. |
Public Members
public get doubleValue: number: * source
64-bit floating point.
- If it is outside the range of JavaScript Number, it will not be an accurate number.
Override:
KonpeitoInteger#doubleValuepublic get intValue: number: * source
64-bit integer value.
- If it is outside the range of JavaScript Number, it will not be an accurate number.
Override:
KonpeitoInteger#intValuePrivate Members
Public Methods
public add(number: KBigIntegerInputData): BigInteger source
Add.
Override:
KonpeitoInteger#addParams:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
public and(number: KBigIntegerInputData): BigInteger source
Logical AND.
Override:
KonpeitoInteger#andParams:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
public clearBit(bit: KBigIntegerInputData): BigInteger source
Lower a specific bit.
Params:
Name | Type | Attribute | Description |
bit | KBigIntegerInputData |
public clip(min: KBigIntegerInputData, max: KBigIntegerInputData): BigInteger source
Clip number within range.
Params:
Name | Type | Attribute | Description |
min | KBigIntegerInputData | ||
max | KBigIntegerInputData |
public compareTo(number: KBigIntegerInputData): number source
Compare values.
Override:
KonpeitoInteger#compareToParams:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
public compareToAbs(number: KBigIntegerInputData): number source
Compare values without sign.
Params:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
public div(number: KBigIntegerInputData): BigInteger source
Divide.
Override:
KonpeitoInteger#divParams:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
public divide(number: KBigIntegerInputData): BigInteger source
Divide.
Override:
KonpeitoInteger#divideParams:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
public divideAndRemainder(number: KBigIntegerInputData): Array<BigInteger> source
Divide and rem.
Params:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
public equals(number: KBigIntegerInputData): boolean source
Equals.
Override:
KonpeitoInteger#equalsParams:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
public equalsState(number: KBigIntegerInputData): boolean source
Numeric type match.
Params:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
public extgcd(number: KBigIntegerInputData): BigInteger[] source
Extended Euclidean algorithm.
Override:
KonpeitoInteger#extgcdParams:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
public factor(): BigInteger[] source
Factorization.
- Calculate up to
9007199254740991
.
Override:
KonpeitoInteger#factorpublic fix(): BigInteger source
To integer rounded down to the nearest.
Override:
KonpeitoInteger#fixpublic flipBit(bit: KBigIntegerInputData): BigInteger source
Invert a specific bit.
Params:
Name | Type | Attribute | Description |
bit | KBigIntegerInputData |
public gcd(number: KBigIntegerInputData): BigInteger source
Euclidean algorithm.
Override:
KonpeitoInteger#gcdParams:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
public getLowestSetBit(): number source
Number of digits in which the number "1" appears first when expressed in binary.
- Return -1 If 1 is not found it.
public getShort(point: KBigIntegerInputData): number source
Value at the specified position of the internally used array that composed of hexadecimal numbers.
Params:
Name | Type | Attribute | Description |
point | KBigIntegerInputData | Array address. |
public isFinite(): boolean source
Return true if the value is finite number.
Override:
KonpeitoInteger#isFinitepublic isInfinite(): boolean source
this === Infinity or -Infinity
Override:
KonpeitoInteger#isInfinitepublic isNegativeInfinity(): boolean source
this === -Infinity
Override:
KonpeitoInteger#isNegativeInfinitypublic isPositiveInfinity(): boolean source
this === Infinity
Override:
KonpeitoInteger#isPositiveInfinitypublic isPrime(): boolean source
Return true if the value is prime number.
- Calculate up to
9007199254740991
.
Override:
KonpeitoInteger#isPrimepublic isProbablePrime(certainty: KBigIntegerInputData): boolean source
Return true if the value is prime number by Miller-Labin prime number determination method.
Attention : it takes a very long time to process.
Override:
KonpeitoInteger#isProbablePrimeParams:
Name | Type | Attribute | Description |
certainty | KBigIntegerInputData |
|
Repeat count (prime precision). |
public lcm(number: KBigIntegerInputData): BigInteger source
Least common multiple.
Override:
KonpeitoInteger#lcmParams:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
public max(number: KBigIntegerInputData): BigInteger source
Maximum number.
Params:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
public min(number: KBigIntegerInputData): BigInteger source
Minimum number.
Params:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
public mod(number: KBigIntegerInputData): BigInteger source
Modulo, positive rem of division.
- Result has same sign as the Divisor.
Override:
KonpeitoInteger#modParams:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
public modInverse(m: KBigIntegerInputData): BigInteger source
Modular multiplicative inverse.
Override:
KonpeitoInteger#modInverseParams:
Name | Type | Attribute | Description |
m | KBigIntegerInputData |
public modPow(exponent: KBigIntegerInputData, m: KBigIntegerInputData): BigInteger source
Modular exponentiation.
Override:
KonpeitoInteger#modPowParams:
Name | Type | Attribute | Description |
exponent | KBigIntegerInputData | ||
m | KBigIntegerInputData |
public mul(number: KBigIntegerInputData): BigInteger source
Multiply.
Override:
KonpeitoInteger#mulParams:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
public multiply(number: KBigIntegerInputData): BigInteger source
Multiply.
Override:
KonpeitoInteger#multiplyParams:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
public nextProbablePrime(certainty: KBigIntegerInputData, search_max: KBigIntegerInputData): BigInteger source
Next prime.
Override:
KonpeitoInteger#nextProbablePrimeParams:
Name | Type | Attribute | Description |
certainty | KBigIntegerInputData |
|
Repeat count (prime precision). |
search_max | KBigIntegerInputData |
|
Search range of next prime. |
public or(number: KBigIntegerInputData): BigInteger source
Logical OR.
Override:
KonpeitoInteger#orParams:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
public pow(exponent: KBigIntegerInputData): BigInteger source
Power function.
Override:
KonpeitoInteger#powParams:
Name | Type | Attribute | Description |
exponent | KBigIntegerInputData |
public rem(number: KBigIntegerInputData): BigInteger source
Remainder of division.
- Result has same sign as the Dividend.
Override:
KonpeitoInteger#remParams:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
public remainder(number: KBigIntegerInputData): BigInteger source
Remainder of division.
- Result has same sign as the Dividend.
Override:
KonpeitoInteger#remainderParams:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
public scaleByPowerOfTen(n: KBigIntegerInputData): BigInteger source
Multiply a multiple of ten.
Override:
KonpeitoInteger#scaleByPowerOfTenParams:
Name | Type | Attribute | Description |
n | KBigIntegerInputData |
public setBit(bit: KBigIntegerInputData): BigInteger source
this | (1 << n)
Params:
Name | Type | Attribute | Description |
bit | KBigIntegerInputData |
public shift(n: KBigIntegerInputData): BigInteger source
this << n
Override:
KonpeitoInteger#shiftParams:
Name | Type | Attribute | Description |
n | KBigIntegerInputData |
public shiftLeft(n: KBigIntegerInputData): BigInteger source
this << n
Params:
Name | Type | Attribute | Description |
n | KBigIntegerInputData |
public shiftRight(n: KBigIntegerInputData): BigInteger source
this >> n
Params:
Name | Type | Attribute | Description |
n | KBigIntegerInputData |
public sign(): number source
The positive or negative sign of this number.
- +1 if positive, -1 if negative, 0 if 0.
Override:
KonpeitoInteger#signpublic signum(): number source
The positive or negative sign of this number.
- +1 if positive, -1 if negative, 0 if 0.
Override:
KonpeitoInteger#signumpublic sub(number: KBigIntegerInputData): BigInteger source
Subtract.
Override:
KonpeitoInteger#subParams:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
public subtract(number: KBigIntegerInputData): BigInteger source
Subtract.
Override:
KonpeitoInteger#subtractParams:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
public testBit(bit: KBigIntegerInputData): boolean source
Test if a particular bit is on.
Params:
Name | Type | Attribute | Description |
bit | KBigIntegerInputData |
public toBigDecimal(mc: MathContext): BigDecimal source
return BigDecimal.
Override:
KonpeitoInteger#toBigDecimalParams:
Name | Type | Attribute | Description |
mc | MathContext |
|
MathContext setting after calculation. |
public toString(radix: KBigIntegerInputData): string source
Convert to string.
Override:
KonpeitoInteger#toStringParams:
Name | Type | Attribute | Description |
radix | KBigIntegerInputData |
|
Base number. |
public xor(number: KBigIntegerInputData): BigInteger source
Logical Exclusive-OR.
Override:
KonpeitoInteger#xorParams:
Name | Type | Attribute | Description |
number | KBigIntegerInputData |
Private Methods
private _shift(shift_length: KBigIntegerInputData): BigInteger source
this <<= n
Params:
Name | Type | Attribute | Description |
shift_length | KBigIntegerInputData | Bit shift size. |
private getTwosComplement(bit_length: number): BigInteger source
Create a numerical value for addition. If negative, two's complement.
Params:
Name | Type | Attribute | Description |
bit_length | number |
|
Bit length. If not set, it will be calculated automatically. |