Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Big
    • WrappedBig

Index

Properties

c: number[]

Returns an array of single digits

e: number

Returns the exponent, Integer, -1e+6 to 1e+6 inclusive

s: number

Returns the sign, -1 or 1

Methods

  • Returns WrappedBig

  • Parameters

    • n: BigSource

    Returns WrappedBig

  • cmp(n: BigSource): Comparison
  • Compare the values.

    throws

    NaN if n is invalid.

    Parameters

    • n: BigSource

    Returns Comparison

  • Parameters

    • n: BigSource

    Returns WrappedBig

  • eq(n: BigSource): boolean
  • Returns true if the value of this Big equals the value of n, otherwise returns false.

    throws

    NaN if n is invalid.

    Parameters

    • n: BigSource

    Returns boolean

  • gt(n: BigSource): boolean
  • Returns true if the value of this Big is greater than the value of n, otherwise returns false.

    throws

    NaN if n is invalid.

    Parameters

    • n: BigSource

    Returns boolean

  • gte(n: BigSource): boolean
  • Returns true if the value of this Big is greater than or equal to the value of n, otherwise returns false.

    throws

    NaN if n is invalid.

    Parameters

    • n: BigSource

    Returns boolean

  • lt(n: BigSource): boolean
  • Returns true if the value of this Big is less than the value of n, otherwise returns false.

    throws

    NaN if n is invalid.

    Parameters

    • n: BigSource

    Returns boolean

  • lte(n: BigSource): boolean
  • Returns true if the value of this Big is less than or equal to the value of n, otherwise returns false.

    throws

    NaN if n is invalid.

    Parameters

    • n: BigSource

    Returns boolean

  • Parameters

    • n: BigSource

    Returns WrappedBig

  • Parameters

    • n: BigSource

    Returns WrappedBig

  • Parameters

    • n: BigSource

    Returns WrappedBig

  • Parameters

    • n: BigSource

    Returns WrappedBig

  • Parameters

    • exp: number

    Returns WrappedBig

  • prec(sd: number, rm?: RoundingMode): Big
  • Return a new Big whose value is the value of this Big rounded to a maximum precision of sd significant digits using rounding mode rm, or Big.RM if rm is not specified.

    throws

    !prec! if sd is invalid.

    throws

    !Big.RM! if rm is invalid.

    Parameters

    • sd: number

      Significant digits: integer, 1 to MAX_DP inclusive.

    • Optional rm: RoundingMode

      Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).

    Returns Big

  • Parameters

    • Optional dp: number
    • Optional rm: RoundingMode

    Returns WrappedBig

  • Returns WrappedBig

  • Parameters

    • n: BigSource

    Returns WrappedBig

  • Parameters

    • n: BigSource

    Returns WrappedBig

  • toExponential(dp?: number, rm?: RoundingMode): string
  • Returns a string representing the value of this Big number in exponential notation to a fixed number of decimal places dp.

    If the value of this Big number in exponential notation has more digits to the right of the decimal point than is specified by dp, the return value will be rounded to dp decimal places using rounding mode Big.RM.

    If the value of this Big number in exponential notation has fewer digits to the right of the decimal point than is specified by dp, the return value will be appended with zeros accordingly.

    If dp is omitted, or is null or undefined, the number of digits after the decimal point defaults to the minimum number of digits necessary to represent the value exactly.

    throws

    !toFix! if dp is invalid.

    Parameters

    • Optional dp: number

      Decimal places, 0 to 1e+6 inclusive

    • Optional rm: RoundingMode

      Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).

    Returns string

  • toFixed(dp?: number, rm?: RoundingMode): string
  • Returns a string representing the value of this Big number in normal notation to a fixed number of decimal places dp.

    If the value of this Big number in normal notation has more digits to the right of the decimal point than is specified by dp, the return value will be rounded to dp decimal places using rounding mode Big.RM.

    If the value of this Big number in normal notation has fewer fraction digits then is specified by dp, the return value will be appended with zeros accordingly.

    Unlike Number.prototype.toFixed, which returns exponential notation if a number is greater or equal to 1021, this method will always return normal notation.

    If dp is omitted, or is null or undefined, then the return value is simply the value in normal notation. This is also unlike Number.prototype.toFixed, which returns the value to zero decimal places.

    throws

    !toFix! if dp is invalid.

    Parameters

    • Optional dp: number

      Decimal places, 0 to 1e+6 inclusive

    • Optional rm: RoundingMode

      Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).

    Returns string

  • toFormat(): string
  • toFormat(options: FormatOptions): string
  • toFormat(fractionLength: number): string
  • toFormat(fractionLength: number, options: FormatOptions): string
  • toFormat(fractionLength: number, missionUnknown: number): string
  • toFormat(fractionLength: number, missionUnknown: number, options: FormatOptions): string
  • Returns string

  • Parameters

    • options: FormatOptions

    Returns string

  • Parameters

    • fractionLength: number

    Returns string

  • Parameters

    • fractionLength: number
    • options: FormatOptions

    Returns string

  • Parameters

    • fractionLength: number
    • missionUnknown: number

    Returns string

  • Parameters

    • fractionLength: number
    • missionUnknown: number
    • options: FormatOptions

    Returns string

  • toJSON(): string
  • Returns a string representing the value of this Big number.

    If this Big number has a positive exponent that is equal to or greater than 21, or a negative exponent equal to or less than -7, then exponential notation is returned.

    The point at which toString returns exponential rather than normal notation can be adjusted by changing the value of Big.E_POS and Big.E_NEG. By default, Big numbers correspond to Javascript's number type in this regard.

    Returns string

  • toNumber(): number
  • Returns a primitive number representing the value of this Big number.

    If Big.strict is true an error will be thrown if toNumber is called on a Big number which cannot be converted to a primitive number without a loss of precision.

    since

    6.0

    Returns number

  • toPrecision(sd?: number, rm?: RoundingMode): string
  • Returns a string representing the value of this Big number to the specified number of significant digits sd.

    If the value of this Big number has more digits than is specified by sd, the return value will be rounded to sd significant digits using rounding mode Big.RM.

    If the value of this Big number has fewer digits than is specified by sd, the return value will be appended with zeros accordingly.

    If sd is less than the number of digits necessary to represent the integer part of the value in normal notation, then exponential notation is used.

    If sd is omitted, or is null or undefined, then the return value is the same as .toString().

    throws

    !toPre! if sd is invalid.

    Parameters

    • Optional sd: number

      Significant digits, 1 to 1e+6 inclusive

    • Optional rm: RoundingMode

      Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).

    Returns string

  • toString(): string
  • Returns a string representing the value of this Big number.

    If this Big number has a positive exponent that is equal to or greater than 21, or a negative exponent equal to or less than -7, then exponential notation is returned.

    The point at which toString returns exponential rather than normal notation can be adjusted by changing the value of Big.E_POS and Big.E_NEG. By default, Big numbers correspond to Javascript's number type in this regard.

    Returns string

  • valueOf(): string
  • Returns a string representing the value of this Big number.

    If this Big number has a positive exponent that is equal to or greater than 21, or a negative exponent equal to or less than -7, then exponential notation is returned.

    The point at which toString returns exponential rather than normal notation can be adjusted by changing the value of Big.E_POS and Big.E_NEG. By default, Big numbers correspond to Javascript's number type in this regard.

    Returns string