Returns the sum of this number and the given one.
Returns the integer bitwise-and combined with another integer.
Returns the integer bitwise-or combined with another integer.
Returns the integer bitwise-xor combined with another integer.
Returns a number which is rounded up to the next largest integer. Same as round(RoundingMode.TO_POSITIVE).
Optional
decimals: numberReturns number which is clamped to the range delineated by min and max.
Compares the current number to the provided number. Returns -1 when the provided number is smaller than the current one. Returns 0 when the provided number is equal with the current one. Returns 1 when the provided number is greater than the current one.
Returns the result of the division of this number by the given one.
Returns the result of the integer division of this number by the given one. The fractional part is truncated.
Returns true if the current number is equal to the provided number
Returns the largest number, but less than or equal to the current number. Same as round(RoundingMode.TO_NEGATIVE).
Optional
decimals: numberReturns the fractional part of the number (|res| < 1).
Returns the numerator and the denominator of the current number. By default it simplifies the fraction
Optional
normalize: booleanReturns true if the current number is greater than the provided number
Returns true if the current number is greater than or equal to the provided number
Returns the integer part of the number.
Returns the inverse of the number. (1/x)
Returns true if the current number is less than the provided number
Returns true if the current number is less than or equal to the provided number
Optional
type: ModTypeReturns the product of this number and the given one.
Returns the number with inverted sign. (-x)
Returns opimized internal representation of the current number (e.g. it simplifies fractions using GCD) This is may be a slow operation, but in some cases normalization might help with performance of repeated operations.
Returns this number exponentiated to the given value.
Returns modulo of this number exponentiated to the given value (modular exponentiation)
Optional
type: ModTypeRounds current number to the specified amount of decimals. RoundingMode.NEAREST_TO_POSITIVE is the default
Optional
decimals: numberOptional
roundingMode: RoundingModeRounds current number to the specified amount of significant digits. RoundingMode.NEAREST_TO_POSITIVE is the default
Returns the integer left shifted by a given number of bits.
Returns the integer right shifted by a given number of bits.
Returns the difference of this number and the given one.
Returns a string representing the number in exponential notation. Defaults to RoundingMode.TO_ZERO
Optional
roundingMode: RoundingModeOptional
trimZeros: booleanReturns a string representing the number using fixed-point notation, rounded to the specified number of decimals. Defaults to RoundingMode.TO_ZERO
Optional
roundingMode: RoundingModeOptional
trimZeros: booleanReturns a string representing the number using fixed-point notation, rounded to the specified number of significant digits. In contrary to JS Number.toPrecision(), this function never returns exponential notation. Defaults to RoundingMode.TO_ZERO
Optional
roundingMode: RoundingModeOptional
trimZeros: booleanReturns string representation in decimal format. The result might contain repeating digit sequences formatted like "1.4(3)" It is recommended to set a maximum length for the fractional part to avoid performance issues when having long cycles. When such limit is provided, toString() truncates the undesired digits
Optional
radix: numberOptional
maxDigits: numberTruncates the number to the specified number of decimals. Same as round(RoundingMode.TO_ZERO).
Optional
decimals: number
Returns the absolute value of this number.