Protected
constructorReturns the new Fixed-Point Number (FixedPointNumber) instance having
Number of Fractional Digits (or decimal places).
Scaled Value.
Optional
ef: number = 0Edge Flag.
Protected
Readonly
edgeEdge Flag denotes the NaN or NEGATIVE_INFINITY or POSITIVE_INFINITY value.
If ef
is not zero, fractionalDigits and scaledValue are not meaningful.
Readonly
fractionalFractional Digits or decimal places.
Readonly
scaledScaled Value = value * 10 ^ fractionalDigits.
Protected
Static
Readonly
DEFAULT_The default number of decimal places to use for fixed-point math.
Static
Readonly
NaNNot a Number.
fractionalDigits and scaledValue not meaningful.
Static
Readonly
NEGATIVE_The negative Infinity value.
fractionalDigits and scaledValue not meaningful.
Static
Readonly
ONERepresents the one constant.
Static
Readonly
POSITIVE_The positive Infinite value.
fractionalDigits and scaledValue not meaningful.
Static
Readonly
ZERORepresents the zero constant.
Returns the integer part of this FixedPointNumber value.
the integer part of this FixedPointNumber value.
Returns the array of bytes representing the Normalization Form Canonical Composition Unicode Equivalence of this value expressed in decimal base.
Return this value approximated as number.
Returns a FixedPointNumber whose value is the absolute value, i.e. the magnitude, of the value of this FixedPointNumber.
the absolute value of this FixedPointNumber.
Compares this instance with that
FixedPointNumber instance.
null
if either instance is NaN;that
FixedPointNumber, including infinite with equal sign;that
FixedPointNumber;,that
FixedPointNumber.The instance to compare with this instance.
A null if either instance is NaN; -1, 0, or 1 if this instance is less than, equal to, or greater than the specified instance, respectively.
This method uses internally compareTo wrapping the InvalidOperation exception when comparing between NaN values to behave according the [bignumber.js comparedTo] rules.
Compares this instance with that
FixedPointNumber instance.
that
FixedPointNumber, including infinite with equal sign;that
FixedPointNumber;,that
FixedPointNumber.The instance to compare with this instance.
Returns -1, 0, or 1 if this instance is less than, equal to, or greater than the specified instance, respectively.
InvalidOperation If this or that
FixedPointNumber is NaN.
Returns a FixedPointNumber whose value is the value of this FixedPointNumber divided by that
FixedPointNumber.
Limit cases
The fixed-point number to divide by.
The result of the division.
Adjust the precision of the floating-point number by the specified number of decimal places.
The number of decimal places to adjust to, it must be a positive value.
A new FixedPointNumber instance with the adjusted precision.
Returns true
if the value of thisFPN is equal to the value of that
FixedPointNumber, otherwise returns false
.
As with JavaScript, NaN
does not equal NaN
.
The FixedPointNumber to compare against.
true
if the FixedPointNumber numbers are equal, otherwise false
.
This method uses comparedTo internally.
Returns true
if the value of this FixedPointNumber is greater than that
FixedPointNumber, otherwise returns
false`.
@param {FixedPointNumber} that The FixedPointNumber to compare against.
@return {boolean} true
if this FixedPointNumber is greater than that
FixedPointNumber, otherwise false
.
This method uses comparedTo internally.
Returns true
if the value of this FixedPointNumber is greater or equal than that
FixedPointNumber, otherwise returns
false`.
@param {FixedPointNumber} that - The FixedPointNumber to compare against.
@return {boolean} true
if this FixedPointNumber is greater or equal than that
FixedPointNumber, otherwise false
.
This method uses comparedTo internally.
Returns a fixed-point number whose value is the integer part of dividing the value of this fixed-point number
by that
fixed point number.
Limit cases
The fixed-point number to divide by.
The result of the division.
Returns true
if the value of thisFPN is equal to the value of that
FixedPointNumber, otherwise returns false
.
As with JavaScript, NaN
does not equal NaN
.
The FixedPointNumber to compare against.
true
if the FixedPointNumber numbers are equal, otherwise false
.
This method uses eq internally.
Returns true
if the value of this FixedPointNumber is a finite number, otherwise returns false
.
The only possible non-finite values of a FixedPointNumber are NaN, NEGATIVE_INFINITY and POSITIVE_INFINITY.
true
if the value of this FixedPointNumber is a finite number, otherwise returns false
.
Return true
if the value of this FixedPointNumber is NEGATIVE_INFINITY or POSITIVE_INFINITY,
otherwise returns false.
true` if the value of this FixedPointNumber is NEGATIVE_INFINITY or POSITIVE_INFINITY,
Returns true
if this FixedPointNumber value is NEGATIVE_INFINITY, otherwise returns false
.
Returns true
if this FixedPointNumber value is POSITIVE_INFINITY, otherwise returns false
.
true
if this FixedPointNumber value is POSITIVE_INFINITY, otherwise returns false
.
Returns true
if the value of this FixedPointNumber is less than the value of that
FixedPointNumber, otherwise returns false
.
The FixedPointNumber to compare against.
true
if the value of this FixedPointNumber is less than the value of that
FixedPointNumber, otherwise returns false
.
This method uses comparedTo internally.
Returns true
if the value of this FixedPointNumber is less than or equal to the value of that
FixedPointNumber,
otherwise returns false
.
The FixedPointNumber to compare against.
true
if the value of this FixedPointNumber is less than or equal to the value of that
FixedPointNumber,
otherwise returns false
.
This method uses comparedTo internally.
Returns a FixedPointNumber whose value is the value of this FixedPointNumber minus that
FixedPointNumber.
Limit cases
The fixed-point number to subtract.
The result of the subtraction. The return value is always exact and unrounded.
Returns a FixedPointNumber whose value is the value of this FixedPointNumber modulo that
FixedPointNumber,
i.e. the integer remainder of dividing this FixedPointNumber by that
.
Limit cases
{FixedPointNumber} - The fixed-point number to divide by.
the integer remainder of dividing this FixedPointNumber by that
.
Returns a new instance of FixedPointNumber whose value is the value of this FixedPointNumber value negated, i.e. multiplied by -1.
Returns a FixedPointNumber whose value is the value of this FixedPointNumber plus that
FixedPointNumber.
Limit cases
The fixed-point number to add to the current number.
The result of the addition. The return value is always exact and unrounded.
Returns a FixedPointNumber whose value is the value of this FixedPointNumber raised to the power of that
FixedPointNumber.
This method implements the Exponentiation by Squaring algorithm.
Limit cases
The exponent as a fixed-point number. truncated to its integer component because Exponentiation by Squaring is not valid for rational exponents.
Returns a FixedPointNumber whose value is the square root of the value of this FixedPointNumber
Limit cases
The square root of the number.
Returns a FixedPointNumber whose value is the value of this FixedPointNumber multiplied by that
FixedPointNumber.
Limits cases
The fixed-point number to multiply with this number.
a FixedPointNumber whose value is the value of this FixedPointNumber multiplied by that
FixedPointNumber.
Converts the fixed-point number to its string representation.
Optional
decimalSeparator: string = '.'The character to use as the decimal separator in the string representation. Default is '.'.
A string representation of the fixed-point number.
Static
isStatic
isStatic
isChecks if a given string expression is a number in base 10 notation,
considering -
for negative and +
optional for positive values.
The method returns true
for the following cases.
The string expression to be checked.
true
is exp
represents a number, otherwise false
.
Static
ofConstructs a new instance of FixedPointNumber (Fixed Point Number) parsing the
exp
numeric expression in base 10 and representing the value with the
precision of decimalPlaces
fractional decimal digits.
The value to represent. It can be a bigint, number, or string representation of the number.
Optional
decimalPlaces: bigint = ...The number of fractional decimal digits to be used to represent the value.
A new instance of FixedPointNumber with the given parameters.
Represents a fixed-point number for precision arithmetic.