Options
All
• Public
• Public/Protected
• All

# Interface WrappedDecimal

### Hierarchy

• Decimal
• WrappedDecimal

## Methods

#### Returns WrappedDecimal

• cmp(y: Numeric): 0 | 1 | -1
• Return 1 if the value of this Decimal is greater than the value of `y`, -1 if the value of this Decimal is less than the value of `y`, 0 if they have the same value

#### Returns 0 | 1 | -1

• comparedTo(y: Numeric): 0 | 1 | -1
• Return 1 if the value of this Decimal is greater than the value of `y`, -1 if the value of this Decimal is less than the value of `y`, 0 if they have the same value

#### Returns 0 | 1 | -1

• decimalPlaces(): number
• Return the number of decimal places of the value of this Decimal.

#### Returns WrappedDecimal

• dp(): number
• Return the number of decimal places of the value of this Decimal.

#### Returns number

• eq(y: Numeric): boolean
• Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.

#### Returns boolean

• equals(y: Numeric): boolean
• Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.

• #### Returns WrappedDecimal

• exponent(): number
• Return the (base 10) exponent value of this Decimal (this.e is the base 10000000 exponent).

#### Returns number

• greaterThan(y: Numeric): boolean
• Return true if the value of this Decimal is greater than the value of `y`, otherwise return false.

#### Returns boolean

• greaterThanOrEqualTo(y: Numeric): boolean
• Return true if the value of this Decimal is greater than or equal to the value of `y`, otherwise return false.

#### Returns boolean

• gt(y: Numeric): boolean
• Return true if the value of this Decimal is greater than the value of `y`, otherwise return false.

#### Returns boolean

• gte(y: Numeric): boolean
• Return true if the value of this Decimal is greater than or equal to the value of `y`, otherwise return false.

#### Returns WrappedDecimal

• isInteger(): boolean
• Return true if the value of this Decimal is an integer, otherwise return false.

#### Returns boolean

• isNegative(): boolean
• Return true if the value of this Decimal is negative, otherwise return false.

#### Returns boolean

• isPositive(): boolean
• Return true if the value of this Decimal is positive, otherwise return false.

#### Returns boolean

• isZero(): boolean
• Return true if the value of this Decimal is 0, otherwise return false.

#### Returns boolean

• isint(): boolean
• Return true if the value of this Decimal is an integer, otherwise return false.

#### Returns boolean

• isneg(): boolean
• Return true if the value of this Decimal is negative, otherwise return false.

#### Returns boolean

• ispos(): boolean
• Return true if the value of this Decimal is positive, otherwise return false.

#### Returns boolean

• lessThan(y: Numeric): boolean
• Return true if the value of this Decimal is less than `y`, otherwise return false.

#### Returns boolean

• lessThanOrEqualTo(y: Numeric): boolean
• Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.

#### Returns WrappedDecimal

• lt(y: Numeric): boolean
• Return true if the value of this Decimal is less than `y`, otherwise return false.

#### Returns boolean

• lte(y: Numeric): boolean
• Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.

#### Returns WrappedDecimal

• precision(zeros: number | boolean): number
• Return the number of significant digits of the value of this Decimal.

#### Parameters

• ##### zeros: number | boolean

Whether to count integer-part trailing zeros: true, false, 1 or 0.

#### Returns number

• sd(zeros: number | boolean): number
• Return the number of significant digits of the value of this Decimal.

#### Parameters

• ##### zeros: number | boolean

Whether to count integer-part trailing zeros: true, false, 1 or 0.

#### Returns WrappedDecimal

• toDecimalPlaces(dp?: number, rm?: number): Decimal
• Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp` decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.

If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.

#### Parameters

• ##### Optional dp: number

Decimal places. Integer, 0 to MAX_DIGITS inclusive.

• ##### Optional rm: number

Rounding mode. Integer, 0 to 8 inclusive.

#### Returns Decimal

• toExponential(dp?: number, rm?: number): string
• Return a string representing the value of this Decimal in exponential notation rounded to `dp` fixed decimal places using rounding mode `rounding`.

#### Parameters

• ##### Optional dp: number

Decimal places. Integer, 0 to MAX_DIGITS inclusive.

• ##### Optional rm: number

Rounding mode. Integer, 0 to 8 inclusive.

#### Returns string

• toFixed(dp?: number, rm?: number): string
• Return a string representing the value of this Decimal in normal (fixed-point) notation to `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is omitted.

As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.

#### Parameters

• ##### Optional dp: number

Decimal places. Integer, 0 to MAX_DIGITS inclusive.

• ##### Optional rm: number

Rounding mode. Integer, 0 to 8 inclusive.

(-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'. (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'. (-0).toFixed(3) is '0.000'. (-0.5).toFixed(0) is '-0'.

#### Returns 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 WrappedDecimal

• toJSON(): string
• Return a string representing the value of this Decimal.

Return exponential notation if this Decimal has a positive exponent equal to or greater than `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.

#### Returns string

• toNumber(): number
• Return the value of this Decimal converted to a number primitive.

#### Returns WrappedDecimal

• toPrecision(sd?: number, rm?: number): string
• Return a string representing the value of this Decimal rounded to `sd` significant digits using rounding mode `rounding`.

Return exponential notation if `sd` is less than the number of digits necessary to represent the integer part of the value in normal notation.

#### Parameters

• ##### Optional sd: number

Significant digits. Integer, 1 to MAX_DIGITS inclusive.

• ##### Optional rm: number

Rounding mode. Integer, 0 to 8 inclusive.

#### Returns WrappedDecimal

• toString(): string
• Return a string representing the value of this Decimal.

Return exponential notation if this Decimal has a positive exponent equal to or greater than `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.

#### Returns WrappedDecimal

• val(): string
• Return a string representing the value of this Decimal.

Return exponential notation if this Decimal has a positive exponent equal to or greater than `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.

#### Returns string

• valueOf(): string
• Return a string representing the value of this Decimal.

Return exponential notation if this Decimal has a positive exponent equal to or greater than `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.