BigDecimal
Extends:
Arbitrary-precision floating-point number class (immutable).
Static Member Summary
Static Public Members | ||
public static get |
E: BigDecimal: * E, Napier's constant. |
|
public static get |
HALF: BigDecimal: * 0.5 |
|
public static get |
HALF_PI: BigDecimal: * 0.5 * PI. |
|
public static get |
LN10: BigDecimal: * log_e(10) |
|
public static get |
LN2: BigDecimal: * log_e(2) |
|
public static get |
LOG10E: BigDecimal: * log_10(e) |
|
public static get |
LOG2E: BigDecimal: * log_2(e) |
|
public static get |
MINUS_ONE: BigDecimal: * -1 |
|
public static get |
Negative Infinity. |
|
public static get |
NaN: BigDecimal: * Not a Number. |
|
public static get |
ONE: BigDecimal: * 1 |
|
public static get |
PI: BigDecimal: * PI |
|
public static get |
Positive infinity. |
|
public static get |
QUARTER_PI: BigDecimal: * 0.25 * PI. |
|
public static get |
SQRT1_2: BigDecimal: * sqrt(0.5) |
|
public static get |
SQRT2: BigDecimal: * sqrt(2) |
|
public static get |
TEN: BigDecimal: * 10 |
|
public static get |
TWO: BigDecimal: * 2 |
|
public static get |
TWO_PI: BigDecimal: * 2 * PI. |
|
public static get |
ZERO: BigDecimal: * 0 |
Static Method Summary
Static Public Methods | ||
public static |
create(number: KBigDecimalInputData): BigDecimal Create an arbitrary-precision floating-point number. |
|
public static |
Return default MathContext class. |
|
public static |
Pop default the MathContext. |
|
public static |
pushDefaultContext(context: MathContext) Push default the MathContext. |
|
public static |
rand(random: Random): BigDecimal Create random values with uniform random numbers. |
|
public static |
randn(random: Random): BigDecimal Create random values with normal distribution. |
|
public static |
setDefaultContext(context: MathContext) Set default the MathContext. |
|
public static |
valueOf(x: KBigDecimalLocalInputData, scale: MathContext): BigDecimal Convert number to BigDecimal type. |
Constructor Summary
Public Constructor | ||
public |
constructor(number: KBigDecimalInputData) Create an arbitrary-precision floating-point number. |
Member Summary
Public Members | ||
public get |
booleanValue: boolean: * boolean value. |
|
public get |
doubleValue: number: * 64-bit floating point. |
|
public get |
floatValue: number: * 32-bit floating point. |
|
public get |
32-bit integer value. |
|
public get |
intValueExact: number: * 32-bit integer value. |
Method Summary
Public Methods | ||
public |
abs(): BigDecimal Absolute value. |
|
public |
acos(): BigDecimal Arc cosine function. |
|
public |
acosh(): BigDecimal Inverse hyperbolic cosine function. |
|
public |
acot(): BigDecimal Inverse cotangent function. |
|
public |
acoth(): BigDecimal Inverse hyperbolic cotangent function. |
|
public |
acsc(): BigDecimal Inverse cosecant function. |
|
public |
acsch(): BigDecimal Inverse hyperbolic cosecant function. |
|
public |
add(number: KBigDecimalInputData): BigDecimal Add. |
|
public |
and(number: KBigDecimalInputData): BigDecimal Logical AND. |
|
public |
asec(): BigDecimal Reverse secant function. |
|
public |
asech(): BigDecimal Inverse hyperbolic secant function. |
|
public |
asin(): BigDecimal Arc sine function. |
|
public |
asinh(): BigDecimal Inverse hyperbolic sine function. |
|
public |
atan(): BigDecimal Atan (arc tangent) function. |
|
public |
atan2(number: KBigDecimalInputData, context: MathContext): BigDecimal Atan (arc tangent) function. |
|
public |
atanh(): BigDecimal Inverse hyperbolic tangent function. |
|
public |
cbrt(): BigDecimal Cube root. |
|
public |
ceil(): BigDecimal Ceil. |
|
public |
clip(min: KBigDecimalInputData, max: KBigDecimalInputData): BigDecimal Clip number within range. |
|
public |
clone(): BigDecimal Deep copy. |
|
public |
compareTo(number: KBigDecimalInputData, tolerance: KBigDecimalInputData): number Compare values. |
|
public |
cos(): BigDecimal Cosine function. |
|
public |
cosh(): BigDecimal Hyperbolic cosine function. |
|
public |
cot(): BigDecimal Cotangent function. |
|
public |
coth(): BigDecimal Hyperbolic cotangent function. |
|
public |
csc(): BigDecimal Cosecant function. |
|
public |
csch(): BigDecimal Hyperbolic cosecant function. |
|
public |
div(number: KBigDecimalInputData, type: MathContext | KBigDecimalDivideType): BigDecimal Divide. |
|
public |
divide(number: KBigDecimalInputData, type: MathContext | KBigDecimalDivideType): BigDecimal Divide. |
|
public |
divideAndRemainder(number: KBigDecimalInputData): Array<BigDecimal> Divide and remainder. |
|
public |
Divide not calculated to the decimal point. |
|
public |
equals(number: KBigDecimalInputData, tolerance: KBigDecimalInputData): boolean Equals. |
|
public |
equalsState(number: KBigDecimalInputData): boolean Numeric type match. |
|
public |
exp(): BigDecimal Exponential function. |
|
public |
expm1(): BigDecimal e^x - 1 |
|
public |
extgcd(number: KBigDecimalInputData): Array<BigDecimal> Extended Euclidean algorithm. |
|
public |
factor(): BigDecimal[] Factorization. |
|
public |
Factorial function, x!. |
|
public |
fix(): BigDecimal To integer rounded down to the nearest. |
|
public |
floor(): BigDecimal Floor. |
|
public |
fract(): BigDecimal Fraction. |
|
public |
gcd(number: KBigDecimalInputData): BigDecimal Euclidean algorithm. |
|
public |
inv(): BigDecimal Inverse number of this value. |
|
public |
Return true if the value is finite number. |
|
public |
this === Infinity or -Infinity |
|
public |
isInteger(tolerance: KBigDecimalInputData): boolean Return true if the value is integer. |
|
public |
this === NaN |
|
public |
this < 0 |
|
public |
this === -Infinity |
|
public |
this >= 0 |
|
public |
isOne(tolerance: KBigDecimalInputData): boolean this === 1 |
|
public |
this > 0 |
|
public |
this === Infinity |
|
public |
Return true if the value is prime number. |
|
public |
isProbablePrime(certainty: KBigDecimalInputData): boolean Return true if the value is prime number by Miller-Labin prime number determination method. |
|
public |
isZero(tolerance: KBigDecimalInputData): boolean this === 0 |
|
public |
lcm(number: KBigDecimalInputData): BigDecimal Least common multiple. |
|
public |
log(): BigDecimal Logarithmic function. |
|
public |
log10(): BigDecimal log_10(x) |
|
public |
log1p(): BigDecimal ln(1 + x) |
|
public |
log2(): BigDecimal log_2(x) |
|
public |
logit(): BigDecimal Logit function. |
|
public |
max(number: KBigDecimalInputData): BigDecimal Maximum number. |
|
public |
min(number: KBigDecimalInputData): BigDecimal Minimum number. |
|
public |
mod(number: KBigDecimalInputData): BigDecimal Modulo, positive remainder of division. |
|
public |
Modular multiplicative inverse. |
|
public |
modPow(exponent: KBigDecimalInputData, m: KBigDecimalInputData): BigDecimal Modular exponentiation. |
|
public |
Move the decimal point to the left. |
|
public |
Move the decimal point to the right. |
|
public |
mul(number: KBigDecimalInputData): BigDecimal Multiply. |
|
public |
multiply(number: KBigDecimalInputData): BigDecimal Multiply. |
|
public |
negate(): BigDecimal this * -1 |
|
public |
nextProbablePrime(certainty: KBigDecimalInputData, search_max: KBigDecimalInputData): BigDecimal Next prime. |
|
public |
not(): BigDecimal Logical Not. |
|
public |
or(number: KBigDecimalInputData): BigDecimal Logical OR. |
|
public |
plus(): BigDecimal this * 1 |
|
public |
pow(number: KBigDecimalInputData): BigDecimal Power function. |
|
public |
Precision. |
|
public |
rem(number: KBigDecimalInputData): BigDecimal Remainder of division. |
|
public |
remainder(number: KBigDecimalInputData): BigDecimal Remainder of division. |
|
public |
round(mc: MathContext): BigDecimal Round with specified settings. |
|
public |
rsqrt(): BigDecimal Reciprocal square root. |
|
public |
The scale of this BigDecimal. |
|
public |
Multiply a multiple of ten. |
|
public |
sec(): BigDecimal Secant function. |
|
public |
sech(): BigDecimal Hyperbolic secant function. |
|
public |
setScale(new_scale: KBigDecimalInputData, rounding_mode: RoundingModeEntity): BigDecimal Change the scale. |
|
public |
this << n
|
|
public |
The positive or negative sign of this number. |
|
public |
The positive or negative sign of this number. |
|
public |
sin(): BigDecimal Sine function. |
|
public |
sinc(): BigDecimal Normalized sinc function. |
|
public |
sinh(): BigDecimal Hyperbolic sine function. |
|
public |
sqrt(): BigDecimal Square root. |
|
public |
square(): BigDecimal Square. |
|
public |
Remove the 0 to the right of the numbers and normalize the scale. |
|
public |
sub(number: KBigDecimalInputData): BigDecimal Subtract. |
|
public |
subtract(number: KBigDecimalInputData): BigDecimal Subtract. |
|
public |
tan(): BigDecimal Tangent function. |
|
public |
tanh(): BigDecimal Hyperbolic tangent function. |
|
public |
return BigDecimal. |
|
public |
return BigInteger. |
|
public |
return Complex. |
|
public |
Convert to string usding technical notation. |
|
public |
return Fraction. |
|
public |
Convert to JSON. |
|
public |
return Matrix. |
|
public |
Convert to string without exponential notation. |
|
public |
Convert to string using scientific notation. |
|
public |
Convert to string. |
|
public |
trunc(): BigDecimal To integer rounded down to the nearest. |
|
public |
ulp(): BigDecimal The smallest value that can be represented with the set precision. |
|
public |
An integer with the exponent part removed. |
|
public |
xor(number: KBigDecimalInputData): BigDecimal Logical Exclusive-OR. |
Private Methods | ||
private |
Return string of this number without sign. |
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. |
From class KonpeitoFloat | ||
public static get |
E: KonpeitoFloat: * E, Napier's constant. |
|
public static get |
HALF: KonpeitoFloat: * 0.5 |
|
public static get |
HALF_PI: KonpeitoFloat: * 0.5 * PI. |
|
public static get |
LN10: KonpeitoFloat: * log_e(10) |
|
public static get |
LN2: KonpeitoFloat: * log_e(2) |
|
public static get |
LOG10E: KonpeitoFloat: * log_10(e) |
|
public static get |
LOG2E: KonpeitoFloat: * log_2(e) |
|
public static get |
PI: KonpeitoFloat: * PI. |
|
public static get |
0.25 * PI. |
|
public static get |
SQRT1_2: KonpeitoFloat: * sqrt(0.5) |
|
public static get |
SQRT2: KonpeitoFloat: * sqrt(2) |
|
public static get |
TWO_PI: KonpeitoFloat: * 2 * PI. |
|
public |
Arc cosine function. |
|
public |
Inverse hyperbolic cosine function. |
|
public |
Inverse cotangent function. |
|
public |
Inverse hyperbolic cotangent function. |
|
public |
Inverse cosecant function. |
|
public |
Inverse hyperbolic cosecant function. |
|
public |
Reverse secant function. |
|
public |
Inverse hyperbolic secant function. |
|
public |
Arc sine function. |
|
public |
Inverse hyperbolic sine function. |
|
public |
Atan (arc tangent) function. |
|
public |
atan2(number: any): KonpeitoFloat Atan (arc tangent) function. |
|
public |
Inverse hyperbolic tangent function. |
|
public |
Cube root. |
|
public |
cos(): KonpeitoFloat Cosine function. |
|
public |
Hyperbolic cosine function. |
|
public |
cot(): KonpeitoFloat Cotangent function. |
|
public |
Hyperbolic cotangent function. |
|
public |
csc(): KonpeitoFloat Cosecant function. |
|
public |
Hyperbolic cosecant function. |
|
public |
exp(): KonpeitoFloat Exponential function. |
|
public |
e^x - 1 |
|
public |
log(): KonpeitoFloat Logarithmic function. |
|
public |
log_10(x) |
|
public |
ln(1 + x) |
|
public |
log_2(x) |
|
public |
Logit function. |
|
public |
Reciprocal square root. |
|
public |
sec(): KonpeitoFloat Secant function. |
|
public |
Hyperbolic secant function. |
|
public |
sin(): KonpeitoFloat Sine function. |
|
public |
Normalized sinc function. |
|
public |
Hyperbolic sine function. |
|
public |
Square root. |
|
public |
tan(): KonpeitoFloat Tangent function. |
|
public |
Hyperbolic tangent function. |
Static Public Members
public static get NEGATIVE_INFINITY: BigDecimal: * source
Negative Infinity.
Override:
KonpeitoInteger#NEGATIVE_INFINITYpublic static get POSITIVE_INFINITY: BigDecimal: * source
Positive infinity.
Override:
KonpeitoInteger#POSITIVE_INFINITYStatic Public Methods
public static create(number: KBigDecimalInputData): BigDecimal source
Create an arbitrary-precision floating-point number.
Initialization can be performed as follows.
- 1200, "1200", "12e2", "1.2e3"
- When initializing with array. [ integer, [scale = 0], [context=default]].
- When initializing with object. { integer, [scale = 0], [context=default]}.
Description of the settings are as follows, you can also omitted.
- The "scale" is an integer scale factor.
- The "context" is used to normalize the created floating point.
If "context" is not specified, the "default_context" set for the class is used. The "context" is the used when no environment settings are specified during calculation.
Override:
KonpeitoInteger#createParams:
Name | Type | Attribute | Description |
number | KBigDecimalInputData | Real data. |
public static getDefaultContext(): MathContext source
Return default MathContext class.
- Used when MathContext not specified explicitly.
public static popDefaultContext() source
Pop default the MathContext.
- Use with
pushDefaultContext
when you want to switch settings temporarily.
public static pushDefaultContext(context: MathContext) source
Push default the MathContext.
- Use with
popDefaultContext
when you want to switch settings temporarily.
Params:
Name | Type | Attribute | Description |
context | MathContext |
|
public static rand(random: Random): BigDecimal source
Create random values with uniform random numbers.
Params:
Name | Type | Attribute | Description |
random | Random |
|
Class for creating random numbers. |
public static randn(random: Random): BigDecimal source
Create random values with normal distribution.
Params:
Name | Type | Attribute | Description |
random | Random |
|
Class for creating random numbers. |
public static setDefaultContext(context: MathContext) source
Set default the MathContext.
- This is used if you do not specify MathContext when creating a new object.
Params:
Name | Type | Attribute | Description |
context | MathContext |
|
public static valueOf(x: KBigDecimalLocalInputData, scale: MathContext): BigDecimal source
Convert number to BigDecimal type.
Override:
KonpeitoInteger#valueOfParams:
Name | Type | Attribute | Description |
x | KBigDecimalLocalInputData | ||
scale | MathContext |
|
Public Constructors
public constructor(number: KBigDecimalInputData) source
Create an arbitrary-precision floating-point number.
Initialization can be performed as follows.
- 1200, "1200", "12e2", "1.2e3"
- When initializing with array. [ integer, [scale = 0], [context=default]].
- When initializing with object. { integer, [scale = 0], [context=default]}.
Description of the settings are as follows, you can also omitted.
- The "scale" is an integer scale factor.
- The "context" is used to normalize the created floating point.
If "context" is not specified, the "default_context" set for the class is used. The "context" is the used when no environment settings are specified during calculation.
Override:
KonpeitoFloat#constructorParams:
Name | Type | Attribute | Description |
number | KBigDecimalInputData | Real data. |
Public Members
public get doubleValue: number: * source
64-bit floating point.
Override:
KonpeitoInteger#doubleValuePublic Methods
public acoth(): BigDecimal source
Inverse hyperbolic cotangent function.
Override:
KonpeitoFloat#acothpublic acsch(): BigDecimal source
Inverse hyperbolic cosecant function.
Override:
KonpeitoFloat#acschpublic add(number: KBigDecimalInputData): BigDecimal source
Add.
Override:
KonpeitoInteger#addParams:
Name | Type | Attribute | Description |
number | KBigDecimalInputData |
public and(number: KBigDecimalInputData): BigDecimal source
Logical AND.
- Calculated as an integer.
Override:
KonpeitoInteger#andParams:
Name | Type | Attribute | Description |
number | KBigDecimalInputData |
public atan(): BigDecimal source
Atan (arc tangent) function.
- Return the values of [-PI/2, PI/2].
Override:
KonpeitoFloat#atanpublic atan2(number: KBigDecimalInputData, context: MathContext): BigDecimal source
Atan (arc tangent) function. Return the values of [-PI, PI] . Supports only real numbers.
Override:
KonpeitoFloat#atan2Params:
Name | Type | Attribute | Description |
number | KBigDecimalInputData | ||
context | MathContext |
|
MathContext setting after calculation. If omitted, use the MathContext of the B. |
public clip(min: KBigDecimalInputData, max: KBigDecimalInputData): BigDecimal source
Clip number within range.
Params:
Name | Type | Attribute | Description |
min | KBigDecimalInputData | ||
max | KBigDecimalInputData |
public compareTo(number: KBigDecimalInputData, tolerance: KBigDecimalInputData): number source
Compare values.
Override:
KonpeitoInteger#compareToParams:
Name | Type | Attribute | Description |
number | KBigDecimalInputData | ||
tolerance | KBigDecimalInputData |
|
Calculation tolerance of calculation. |
public div(number: KBigDecimalInputData, type: MathContext | KBigDecimalDivideType): BigDecimal source
Divide.
- The argument can specify the scale after calculation.
- In the case of precision infinity, it may generate an error by a repeating decimal.
- When "{}" is specified for the argument, it is calculated on the scale of "this.scale() - divisor.scale()".
- When null is specified for the argument, it is calculated on the scale of "divisor.context".
Override:
KonpeitoInteger#divParams:
Name | Type | Attribute | Description |
number | KBigDecimalInputData | ||
type | MathContext | KBigDecimalDivideType |
|
Scale, MathContext, RoundingMode used for the calculation. |
public divide(number: KBigDecimalInputData, type: MathContext | KBigDecimalDivideType): BigDecimal source
Divide.
- The argument can specify the scale after calculation.
- In the case of precision infinity, it may generate an error by a repeating decimal.
- When "{}" is specified for the argument, it is calculated on the scale of "this.scale() - divisor.scale()".
- When null is specified for the argument, it is calculated on the scale of "divisor.context".
Override:
KonpeitoInteger#divideParams:
Name | Type | Attribute | Description |
number | KBigDecimalInputData | ||
type | MathContext | KBigDecimalDivideType |
|
Scale, MathContext, RoundingMode used for the calculation. |
public divideAndRemainder(number: KBigDecimalInputData): Array<BigDecimal> source
Divide and remainder.
Params:
Name | Type | Attribute | Description |
number | KBigDecimalInputData |
public divideToIntegralValue(number: KBigDecimalInputData): BigDecimal source
Divide not calculated to the decimal point.
Params:
Name | Type | Attribute | Description |
number | KBigDecimalInputData |
public equals(number: KBigDecimalInputData, tolerance: KBigDecimalInputData): boolean source
Equals.
- Attention : Test for equality, including the precision and the scale.
- Use the "compareTo" if you only want to find out whether they are also mathematically equal.
- If you specify a "tolerance", it is calculated by ignoring the test of the precision and the scale.
Override:
KonpeitoInteger#equalsParams:
Name | Type | Attribute | Description |
number | KBigDecimalInputData | ||
tolerance | KBigDecimalInputData |
|
Calculation tolerance of calculation. |
public equalsState(number: KBigDecimalInputData): boolean source
Numeric type match.
Params:
Name | Type | Attribute | Description |
number | KBigDecimalInputData |
public extgcd(number: KBigDecimalInputData): Array<BigDecimal> source
Extended Euclidean algorithm.
- Calculated as an integer.
Override:
KonpeitoInteger#extgcdParams:
Name | Type | Attribute | Description |
number | KBigDecimalInputData |
public factor(): BigDecimal[] source
Factorization.
- Calculated as an integer.
- Calculate up to
9007199254740991
.
Override:
KonpeitoInteger#factorpublic factorial(): BigDecimal source
Factorial function, x!.
- Supports only integers.
Override:
KonpeitoInteger#factorialpublic fix(): BigDecimal source
To integer rounded down to the nearest.
Override:
KonpeitoInteger#fixpublic gcd(number: KBigDecimalInputData): BigDecimal source
Euclidean algorithm.
- Calculated as an integer.
Override:
KonpeitoInteger#gcdParams:
Name | Type | Attribute | Description |
number | KBigDecimalInputData |
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 isInteger(tolerance: KBigDecimalInputData): boolean source
Return true if the value is integer.
Params:
Name | Type | Attribute | Description |
tolerance | KBigDecimalInputData |
|
Calculation tolerance of calculation. |
public isNegativeInfinity(): boolean source
this === -Infinity
Override:
KonpeitoInteger#isNegativeInfinitypublic isOne(tolerance: KBigDecimalInputData): boolean source
this === 1
Override:
KonpeitoInteger#isOneParams:
Name | Type | Attribute | Description |
tolerance | KBigDecimalInputData |
|
Calculation tolerance of calculation. |
public isPositiveInfinity(): boolean source
this === Infinity
Override:
KonpeitoInteger#isPositiveInfinitypublic isPrime(): boolean source
Return true if the value is prime number.
- Calculated as an integer.
- Calculate up to
2251799813685248(=2^51)
.
Override:
KonpeitoInteger#isPrimepublic isProbablePrime(certainty: KBigDecimalInputData): 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.
- Calculated as an integer.
Override:
KonpeitoInteger#isProbablePrimeParams:
Name | Type | Attribute | Description |
certainty | KBigDecimalInputData |
|
Repeat count (prime precision). |
public isZero(tolerance: KBigDecimalInputData): boolean source
this === 0
Override:
KonpeitoInteger#isZeroParams:
Name | Type | Attribute | Description |
tolerance | KBigDecimalInputData |
|
Calculation tolerance of calculation. |
public lcm(number: KBigDecimalInputData): BigDecimal source
Least common multiple.
- Calculated as an integer.
Override:
KonpeitoInteger#lcmParams:
Name | Type | Attribute | Description |
number | KBigDecimalInputData |
public max(number: KBigDecimalInputData): BigDecimal source
Maximum number.
Params:
Name | Type | Attribute | Description |
number | KBigDecimalInputData |
public min(number: KBigDecimalInputData): BigDecimal source
Minimum number.
Params:
Name | Type | Attribute | Description |
number | KBigDecimalInputData |
public mod(number: KBigDecimalInputData): BigDecimal source
Modulo, positive remainder of division.
- Result has same sign as the Divisor.
Override:
KonpeitoInteger#modParams:
Name | Type | Attribute | Description |
number | KBigDecimalInputData |
public modInverse(m: KBigDecimalInputData): BigDecimal source
Modular multiplicative inverse.
- Calculated as an integer.
Override:
KonpeitoInteger#modInverseParams:
Name | Type | Attribute | Description |
m | KBigDecimalInputData |
public modPow(exponent: KBigDecimalInputData, m: KBigDecimalInputData): BigDecimal source
Modular exponentiation.
- Calculated as an integer.
Override:
KonpeitoInteger#modPowParams:
Name | Type | Attribute | Description |
exponent | KBigDecimalInputData | ||
m | KBigDecimalInputData |
public movePointLeft(n: KBigDecimalInputData): BigDecimal source
Move the decimal point to the left.
Params:
Name | Type | Attribute | Description |
n | KBigDecimalInputData |
public movePointRight(n: KBigDecimalInputData): BigDecimal source
Move the decimal point to the right.
Params:
Name | Type | Attribute | Description |
n | KBigDecimalInputData |
public mul(number: KBigDecimalInputData): BigDecimal source
Multiply.
Override:
KonpeitoInteger#mulParams:
Name | Type | Attribute | Description |
number | KBigDecimalInputData |
public multiply(number: KBigDecimalInputData): BigDecimal source
Multiply.
Override:
KonpeitoInteger#multiplyParams:
Name | Type | Attribute | Description |
number | KBigDecimalInputData |
public nextProbablePrime(certainty: KBigDecimalInputData, search_max: KBigDecimalInputData): BigDecimal source
Next prime.
Override:
KonpeitoInteger#nextProbablePrimeParams:
Name | Type | Attribute | Description |
certainty | KBigDecimalInputData |
|
Repeat count (prime precision). |
search_max | KBigDecimalInputData |
|
Search range of next prime. |
public not(): BigDecimal source
Logical Not. (mutable)
- Calculated as an integer.
Override:
KonpeitoInteger#notpublic or(number: KBigDecimalInputData): BigDecimal source
Logical OR.
- Calculated as an integer.
Override:
KonpeitoInteger#orParams:
Name | Type | Attribute | Description |
number | KBigDecimalInputData |
public pow(number: KBigDecimalInputData): BigDecimal source
Power function.
- An exception occurs when doing a huge multiplication.
Override:
KonpeitoInteger#powParams:
Name | Type | Attribute | Description |
number | KBigDecimalInputData |
public rem(number: KBigDecimalInputData): BigDecimal source
Remainder of division.
- Result has same sign as the Dividend.
Override:
KonpeitoInteger#remParams:
Name | Type | Attribute | Description |
number | KBigDecimalInputData |
public remainder(number: KBigDecimalInputData): BigDecimal source
Remainder of division.
- Result has same sign as the Dividend.
Override:
KonpeitoInteger#remainderParams:
Name | Type | Attribute | Description |
number | KBigDecimalInputData |
public round(mc: MathContext): BigDecimal source
Round with specified settings.
- This method is not a method round the decimal point.
- This method converts numbers in the specified Context and rounds unconvertible digits.
Use this.setScale(0, RoundingMode.HALF_UP)
if you want to round the decimal point.
When the argument is omitted, such decimal point rounding operation is performed.
Override:
KonpeitoInteger#roundParams:
Name | Type | Attribute | Description |
mc | MathContext |
|
New setting. |
public scaleByPowerOfTen(n: KBigDecimalInputData): BigDecimal source
Multiply a multiple of ten.
- Supports only integers.
- Only the scale is changed without changing the precision.
Override:
KonpeitoInteger#scaleByPowerOfTenParams:
Name | Type | Attribute | Description |
n | KBigDecimalInputData |
public setScale(new_scale: KBigDecimalInputData, rounding_mode: RoundingModeEntity): BigDecimal source
Change the scale.
Params:
Name | Type | Attribute | Description |
new_scale | KBigDecimalInputData | New scale. |
|
rounding_mode | RoundingModeEntity |
|
Rounding method when converting precision. |
public shift(n: KBigDecimalInputData): BigDecimal source
this << n
- Calculated as an integer.
Override:
KonpeitoInteger#shiftParams:
Name | Type | Attribute | Description |
n | KBigDecimalInputData |
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 stripTrailingZeros(): BigDecimal source
Remove the 0 to the right of the numbers and normalize the scale.
public sub(number: KBigDecimalInputData): BigDecimal source
Subtract.
Override:
KonpeitoInteger#subParams:
Name | Type | Attribute | Description |
number | KBigDecimalInputData |
public subtract(number: KBigDecimalInputData): BigDecimal source
Subtract.
Override:
KonpeitoInteger#subtractParams:
Name | Type | Attribute | Description |
number | KBigDecimalInputData |
public toBigDecimal(mc: MathContext): BigDecimal source
return BigDecimal.
Override:
KonpeitoInteger#toBigDecimalParams:
Name | Type | Attribute | Description |
mc | MathContext |
|
MathContext setting after calculation. |
public toScientificNotation(e_len: KBigDecimalInputData): string source
Convert to string using scientific notation.
Params:
Name | Type | Attribute | Description |
e_len | KBigDecimalInputData | Number of digits in exponent part. |
public xor(number: KBigDecimalInputData): BigDecimal source
Logical Exclusive-OR.
- Calculated as an integer.
Override:
KonpeitoInteger#xorParams:
Name | Type | Attribute | Description |
number | KBigDecimalInputData |