Home Reference Source
public class | source

KonpeitoInteger

Indirect Subclass:

BigDecimal, Complex, Matrix

Base class for numbers (immutable).

Static Member Summary

Static Public Members
public static get

-1

public static get

Negative Infinity.

public static get

Not a Number.

public static get

1

public static get

Positive infinity.

public static get

10

public static get

2

public static get

0

Static Method Summary

Static Public Methods
public static

create(number: any): KonpeitoInteger

Create an entity object of this class.

public static

valueOf(number: any): KonpeitoInteger

Create number.

Constructor Summary

Public Constructor
public

constructor(number: any)

Create an number.

Member Summary

Public Members
public get

boolean value.

public get

floating point.

public get

integer value.

Method Summary

Public Methods
public

Absolute value.

public

add(number: any): KonpeitoInteger

Add.

public

and(number: any): KonpeitoInteger

Logical AND.

public

Ceil.

public

Deep copy.

public

compareTo(number: any): number

Compare values.

public

div(number: any): KonpeitoInteger

Divide.

public

divide(number: any): KonpeitoInteger

Divide.

public

equals(number: any): boolean

Equals.

public

extgcd(number: any): KonpeitoInteger[]

Extended Euclidean algorithm.

public

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

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

Multiply a multiple of ten.

public

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 MINUS_ONE: KonpeitoInteger: * source

-1

Return:

KonpeitoInteger

1

public static get NEGATIVE_INFINITY: KonpeitoInteger: * source

Negative Infinity.

Return:

KonpeitoInteger

Infinity

public static get NaN: KonpeitoInteger: * source

Not a Number.

Return:

KonpeitoInteger

NaN

public static get ONE: KonpeitoInteger: * source

1

Return:

KonpeitoInteger

1

public static get POSITIVE_INFINITY: KonpeitoInteger: * source

Positive infinity.

Return:

KonpeitoInteger

Infinity

public static get TEN: KonpeitoInteger: * source

10

Return:

KonpeitoInteger

10

public static get TWO: KonpeitoInteger: * source

2

Return:

KonpeitoInteger

2

public static get ZERO: KonpeitoInteger: * source

0

Return:

KonpeitoInteger

0

Static Public Methods

public static create(number: any): KonpeitoInteger source

Create an entity object of this class.

Params:

NameTypeAttributeDescription
number any

Return:

KonpeitoInteger

public static valueOf(number: any): KonpeitoInteger source

Create number.

Params:

NameTypeAttributeDescription
number any

Return:

KonpeitoInteger

Public Constructors

public constructor(number: any) source

Create an number.

Params:

NameTypeAttributeDescription
number any
  • optional

Numeric data. See how to use the function.

Public Members

public get booleanValue: boolean: * source

boolean value.

Return:

boolean

public get doubleValue: number: * source

floating point.

Return:

number

public get intValue: number: * source

integer value.

Return:

number

Public Methods

public abs(): KonpeitoInteger source

Absolute value.

Return:

KonpeitoInteger

abs(A)

public add(number: any): KonpeitoInteger source

Add.

Params:

NameTypeAttributeDescription
number any

Return:

KonpeitoInteger

A + B

public and(number: any): KonpeitoInteger source

Logical AND.

Params:

NameTypeAttributeDescription
number any

Return:

KonpeitoInteger

A & B

public ceil(): KonpeitoInteger source

Ceil.

Return:

KonpeitoInteger

ceil(A)

public clone(): KonpeitoInteger source

Deep copy.

Return:

KonpeitoInteger

public compareTo(number: any): number source

Compare values.

Params:

NameTypeAttributeDescription
number any

Return:

number

A > B ? 1 : (A === B ? 0 : -1)

public div(number: any): KonpeitoInteger source

Divide.

Params:

NameTypeAttributeDescription
number any

Return:

KonpeitoInteger

fix(A / B)

public divide(number: any): KonpeitoInteger source

Divide.

Params:

NameTypeAttributeDescription
number any

Return:

KonpeitoInteger

fix(A / B)

public equals(number: any): boolean source

Equals.

Params:

NameTypeAttributeDescription
number any

Return:

boolean

A === B

public extgcd(number: any): KonpeitoInteger[] source

Extended Euclidean algorithm.

Params:

NameTypeAttributeDescription
number any

Return:

KonpeitoInteger[]

[a, b, gcd(x, y)], Result of calculating ax + by = gcd(x, y).

public factor(): KonpeitoInteger[] source

Factorization.

  • Calculate up to 9007199254740991.

Return:

KonpeitoInteger[]

factor

public factorial(): KonpeitoInteger source

Factorial function, x!.

Return:

KonpeitoInteger

n!

public fix(): KonpeitoInteger source

To integer rounded down to the nearest.

Return:

KonpeitoInteger

fix(A), trunc(A)

public floor(): KonpeitoInteger source

Floor.

Return:

KonpeitoInteger

floor(A)

public fract(): KonpeitoInteger source

Fraction.

Return:

KonpeitoInteger

fract(A)

public gcd(number: any): KonpeitoInteger source

Euclidean algorithm.

Params:

NameTypeAttributeDescription
number any

Return:

KonpeitoInteger

gcd(x, y)

public inv(): KonpeitoInteger source

Inverse number of this value.

Return:

KonpeitoInteger

1 / A

public isFinite(): boolean source

Return true if the value is finite number.

Return:

boolean

!isNaN(A) && !isInfinite(A)

public isInfinite(): boolean source

this === Infinity or -Infinity

Return:

boolean

isPositiveInfinity(A) || isNegativeInfinity(A)

public isNaN(): boolean source

this === NaN

Return:

boolean

isNaN(A)

public isNegative(): boolean source

this < 0

Return:

boolean

public isNegativeInfinity(): boolean source

this === -Infinity

Return:

boolean

isNegativeInfinity(A)

public isNotNegative(): boolean source

this >= 0

Return:

boolean

public isOne(): boolean source

this === 1

Return:

boolean

public isPositive(): boolean source

this > 0

Return:

boolean

public isPositiveInfinity(): boolean source

this === Infinity

Return:

boolean

isPositiveInfinity(A)

public isPrime(): boolean source

Return true if the value is prime number.

  • Calculate up to 9007199254740991.

Return:

boolean

If the calculation range is exceeded, null is returned.

public isProbablePrime(certainty: any): 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.

Params:

NameTypeAttributeDescription
certainty any
  • optional
  • default: 100

Repeat count (prime precision).

Return:

boolean

public isZero(): boolean source

this === 0

Return:

boolean

public lcm(number: any): KonpeitoInteger source

Least common multiple.

Params:

NameTypeAttributeDescription
number any

Return:

KonpeitoInteger

lcm(x, y)

public mod(number: any): KonpeitoInteger source

Modulo, positive rem of division.

  • Result has same sign as the Divisor.

Params:

NameTypeAttributeDescription
number any

Return:

KonpeitoInteger

A mod B

public modInverse(m: any): KonpeitoInteger source

Modular multiplicative inverse.

Params:

NameTypeAttributeDescription
m any

Return:

KonpeitoInteger

A^(-1) mod m

public modPow(exponent: any, m: any): KonpeitoInteger source

Modular exponentiation.

Params:

NameTypeAttributeDescription
exponent any
m any

Return:

KonpeitoInteger

A^B mod m

public mul(number: any): KonpeitoInteger source

Multiply.

Params:

NameTypeAttributeDescription
number any

Return:

KonpeitoInteger

A * B

public multiply(number: any): KonpeitoInteger source

Multiply.

Params:

NameTypeAttributeDescription
number any

Return:

KonpeitoInteger

A * B

public negate(): KonpeitoInteger source

this * -1

Return:

KonpeitoInteger

A

public nextProbablePrime(certainty: any, search_max: any): KonpeitoInteger source

Next prime.

Params:

NameTypeAttributeDescription
certainty any
  • optional
  • default: 100

Repeat count (prime precision).

search_max any
  • optional
  • default: 100000

Search range of next prime.

Return:

KonpeitoInteger

public not(): KonpeitoInteger source

Logical Not. (mutable)

Return:

KonpeitoInteger

!A

public or(number: any): KonpeitoInteger source

Logical OR.

Params:

NameTypeAttributeDescription
number any

Return:

KonpeitoInteger

A | B

public pow(exponent: any): KonpeitoInteger source

Power function.

Params:

NameTypeAttributeDescription
exponent any

Return:

KonpeitoInteger

pow(A, B)

public rem(number: any): KonpeitoInteger source

Remainder of division.

  • Result has same sign as the Dividend.

Params:

NameTypeAttributeDescription
number any

Return:

KonpeitoInteger

A % B

public remainder(number: any): KonpeitoInteger source

Remainder of division.

  • Result has same sign as the Dividend.

Params:

NameTypeAttributeDescription
number any

Return:

KonpeitoInteger

A % B

public round(): KonpeitoInteger source

Rounding to the nearest integer.

Return:

KonpeitoInteger

round(A)

public scaleByPowerOfTen(n: any): KonpeitoInteger source

Multiply a multiple of ten.

Params:

NameTypeAttributeDescription
n any

Return:

KonpeitoInteger

x * 10^n

public shift(n: any): KonpeitoInteger source

this << n

Params:

NameTypeAttributeDescription
n any

Return:

KonpeitoInteger

A << n

public sign(): any source

The positive or negative sign of this number.

  • +1 if positive, -1 if negative, 0 if 0.

Return:

any

public signum(): any source

The positive or negative sign of this number.

  • +1 if positive, -1 if negative, 0 if 0.

Return:

any

public square(): KonpeitoInteger source

Square.

Return:

KonpeitoInteger

pow(A, 2)

public sub(number: any): KonpeitoInteger source

Subtract.

Params:

NameTypeAttributeDescription
number any

Return:

KonpeitoInteger

A - B

public subtract(number: any): KonpeitoInteger source

Subtract.

Params:

NameTypeAttributeDescription
number any

Return:

KonpeitoInteger

A - B

public toBigDecimal(mc: MathContext): BigDecimal source

return BigDecimal.

Params:

NameTypeAttributeDescription
mc MathContext
  • optional

MathContext setting after calculation.

Return:

BigDecimal

public toBigInteger(): BigInteger source

return BigInteger.

Return:

BigInteger

public toComplex(): Complex source

return Complex.

Return:

Complex

public toFraction(): Fraction source

return Fraction.

Return:

Fraction

public toJSON(): string source

Convert to JSON.

Return:

string

public toMatrix(): Matrix source

return Matrix.

Return:

Matrix

public toString(): string source

Convert to string.

Return:

string

public xor(number: any): KonpeitoInteger source

Logical Exclusive-OR.

Params:

NameTypeAttributeDescription
number any

Return:

KonpeitoInteger

A ^ B