Motif API
    Preparing search index...
    interface Decimal {
        abs(): Decimal;
        absoluteValue(): Decimal;
        add(y: Numeric): Decimal;
        cmp(y: Numeric): -1 | 0 | 1;
        comparedTo(y: Numeric): -1 | 0 | 1;
        decimalPlaces(): number;
        div(y: Numeric): Decimal;
        dividedBy(y: Numeric): Decimal;
        dividedToIntegerBy(y: Numeric): Decimal;
        dp(): number;
        eq(y: Numeric): boolean;
        equals(y: Numeric): boolean;
        exp(): Decimal;
        exponent(): number;
        greaterThan(y: Numeric): boolean;
        greaterThanOrEqualTo(y: Numeric): boolean;
        gt(y: Numeric): boolean;
        gte(y: Numeric): boolean;
        idiv(y: Numeric): Decimal;
        isint(): boolean;
        isInteger(): boolean;
        isneg(): boolean;
        isNegative(): boolean;
        ispos(): boolean;
        isPositive(): boolean;
        isZero(): boolean;
        lessThan(y: Numeric): boolean;
        lessThanOrEqualTo(y: Numeric): boolean;
        ln(): Decimal;
        log(base?: Numeric): Decimal;
        logarithm(base?: Numeric): Decimal;
        lt(y: Numeric): boolean;
        lte(y: Numeric): boolean;
        minus(y: Numeric): Decimal;
        mod(y: Numeric): Decimal;
        modulo(y: Numeric): Decimal;
        mul(y: Numeric): Decimal;
        naturalExponetial(): Decimal;
        naturalLogarithm(): Decimal;
        neg(): Decimal;
        negated(): Decimal;
        plus(y: Numeric): Decimal;
        pow(y: Numeric): Decimal;
        precision(zeros: number | boolean): number;
        sd(zeros: number | boolean): number;
        sqrt(): Decimal;
        squareRoot(): Decimal;
        sub(y: Numeric): Decimal;
        times(y: Numeric): Decimal;
        toDecimalPlaces(dp?: number, rm?: number): Decimal;
        todp(dp?: number, rm?: number): Decimal;
        toExponential(dp?: number, rm?: number): string;
        toFixed(dp?: number, rm?: number): string;
        toint(): Decimal;
        toInteger(): Decimal;
        toJSON(): string;
        toNumber(): number;
        toPower(y: Numeric): Decimal;
        toPrecision(sd?: number, rm?: number): string;
        tosd(sd?: number, rm?: number): Decimal;
        toSignificantDigits(sd?: number, rm?: number): Decimal;
        toString(): string;
        val(): string;
        valueOf(): string;
    }
    Index

    Methods

    • Return a new Decimal whose value is the absolute value of this Decimal.

      Returns Decimal

    • Return a new Decimal whose value is the absolute value of this Decimal.

      Returns Decimal

    • Return a new Decimal whose value is the value of this Decimal plus y, truncated to precision significant digits.

      Parameters

      Returns Decimal

    • 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

      Parameters

      Returns -1 | 0 | 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

      Parameters

      Returns -1 | 0 | 1

    • Return the number of decimal places of the value of this Decimal.

      Returns number

    • Return a new Decimal whose value is the value of this Decimal divided by y, truncated to precision significant digits.

      Parameters

      Returns Decimal

    • Return a new Decimal whose value is the value of this Decimal divided by y, truncated to precision significant digits.

      Parameters

      Returns Decimal

    • Return a new Decimal whose value is the integer part of dividing the value of this Decimal by the value of y, truncated to precision significant digits.

      Parameters

      Returns Decimal

    • Return the number of decimal places of the value of this Decimal.

      Returns number

    • Return true if the value of this Decimal is equal to the value of y, otherwise return false.

      Parameters

      Returns boolean

    • Return true if the value of this Decimal is equal to the value of y, otherwise return false.

      Parameters

      Returns boolean

    • Return a new Decimal whose value is the natural exponential of the value of this Decimal, i.e. the base e raised to the power the value of this Decimal, truncated to precision significant digits.

      Returns Decimal

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

      Returns number

    • Return true if the value of this Decimal is greater than the value of y, otherwise return false.

      Parameters

      Returns boolean

    • Return true if the value of this Decimal is greater than or equal to the value of y, otherwise return false.

      Parameters

      Returns boolean

    • Return true if the value of this Decimal is greater than the value of y, otherwise return false.

      Parameters

      Returns boolean

    • Return true if the value of this Decimal is greater than or equal to the value of y, otherwise return false.

      Parameters

      Returns boolean

    • Return a new Decimal whose value is the integer part of dividing the value of this Decimal by the value of y, truncated to precision significant digits.

      Parameters

      Returns Decimal

    • Return true if the value of this Decimal is an integer, otherwise return false.

      Returns boolean

    • Return true if the value of this Decimal is an integer, otherwise return false.

      Returns boolean

    • Return true if the value of this Decimal is negative, otherwise return false.

      Returns boolean

    • Return true if the value of this Decimal is negative, otherwise return false.

      Returns boolean

    • Return true if the value of this Decimal is positive, otherwise return false.

      Returns boolean

    • Return true if the value of this Decimal is positive, otherwise return false.

      Returns boolean

    • Return true if the value of this Decimal is 0, otherwise return false.

      Returns boolean

    • Return true if the value of this Decimal is less than y, otherwise return false.

      Parameters

      Returns boolean

    • Return true if the value of this Decimal is less than or equal to y, otherwise return false.

      Parameters

      Returns boolean

    • Return a new Decimal whose value is the natural logarithm of the value of this Decimal, truncated to precision significant digits.

      Returns Decimal

    • Return the logarithm of the value of this Decimal to the specified base, truncated to precision significant digits.

      If no base is specified, return log10.

      logbase = ln(x) / ln(base)

      The maximum error of the result is 1 ulp (unit in the last place).

      Parameters

      Returns Decimal

    • Return the logarithm of the value of this Decimal to the specified base, truncated to precision significant digits.

      If no base is specified, return log10.

      logbase = ln(x) / ln(base)

      The maximum error of the result is 1 ulp (unit in the last place).

      Parameters

      Returns Decimal

    • Return true if the value of this Decimal is less than y, otherwise return false.

      Parameters

      Returns boolean

    • Return true if the value of this Decimal is less than or equal to y, otherwise return false.

      Parameters

      Returns boolean

    • Return a new Decimal whose value is the value of this Decimal minus y, truncated to precision significant digits.

      Parameters

      Returns Decimal

    • Return a new Decimal whose value is the value of this Decimal modulo y, truncated to precision significant digits.

      Parameters

      Returns Decimal

    • Return a new Decimal whose value is the value of this Decimal modulo y, truncated to precision significant digits.

      Parameters

      Returns Decimal

    • Return a new Decimal whose value is the value of this Decimal times y, truncated to precision significant digits.

      Parameters

      Returns Decimal

    • Return a new Decimal whose value is the natural exponential of the value of this Decimal, i.e. the base e raised to the power the value of this Decimal, truncated to precision significant digits.

      Returns Decimal

    • Return a new Decimal whose value is the natural logarithm of the value of this Decimal, truncated to precision significant digits.

      Returns Decimal

    • Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by -1.

      Returns Decimal

    • Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by -1.

      Returns Decimal

    • Return a new Decimal whose value is the value of this Decimal plus y, truncated to precision significant digits.

      Parameters

      Returns Decimal

    • Return a new Decimal whose value is the value of this Decimal raised to the power y, truncated to precision significant digits.

      For non-integer or very large exponents pow(x, y) is calculated using

      x^y = exp(y*ln(x))

      The maximum error is 1 ulp (unit in last place).

      Parameters

      • y: Numeric

        The power to which to raise this Decimal.

      Returns Decimal

    • 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

    • 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

    • Return a new Decimal whose value is the square root of this Decimal, truncated to precision significant digits.

      Returns Decimal

    • Return a new Decimal whose value is the square root of this Decimal, truncated to precision significant digits.

      Returns Decimal

    • Return a new Decimal whose value is the value of this Decimal minus y, truncated to precision significant digits.

      Parameters

      Returns Decimal

    • Return a new Decimal whose value is the value of this Decimal times y, truncated to precision significant digits.

      Parameters

      Returns 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

      • Optionaldp: number

        Decimal places. Integer, 0 to MAX_DIGITS inclusive.

      • Optionalrm: number

        Rounding mode. Integer, 0 to 8 inclusive.

      Returns 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

      • Optionaldp: number

        Decimal places. Integer, 0 to MAX_DIGITS inclusive.

      • Optionalrm: number

        Rounding mode. Integer, 0 to 8 inclusive.

      Returns Decimal

    • Return a string representing the value of this Decimal in exponential notation rounded to dp fixed decimal places using rounding mode rounding.

      Parameters

      • Optionaldp: number

        Decimal places. Integer, 0 to MAX_DIGITS inclusive.

      • Optionalrm: number

        Rounding mode. Integer, 0 to 8 inclusive.

      Returns 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

      • Optionaldp: number

        Decimal places. Integer, 0 to MAX_DIGITS inclusive.

      • Optionalrm: 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

    • Return a new Decimal whose value is the value of this Decimal rounded to a whole number using rounding mode rounding.

      Returns Decimal

    • Return a new Decimal whose value is the value of this Decimal rounded to a whole number using rounding mode rounding.

      Returns Decimal

    • 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

    • Return the value of this Decimal converted to a number primitive.

      Returns number

    • Return a new Decimal whose value is the value of this Decimal raised to the power y, truncated to precision significant digits.

      For non-integer or very large exponents pow(x, y) is calculated using

      x^y = exp(y*ln(x))

      The maximum error is 1 ulp (unit in last place).

      Parameters

      • y: Numeric

        The power to which to raise this Decimal.

      Returns Decimal

    • 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

      • Optionalsd: number

        Significant digits. Integer, 1 to MAX_DIGITS inclusive.

      • Optionalrm: number

        Rounding mode. Integer, 0 to 8 inclusive.

      Returns string

    • Return a new Decimal whose value is the value of this Decimal rounded to a maximum of sd significant digits using rounding mode rm, or to precision and rounding respectively if omitted.

      Parameters

      • Optionalsd: number

        Significant digits. Integer, 1 to MAX_DIGITS inclusive.

      • Optionalrm: number

        Rounding mode. Integer, 0 to 8 inclusive.

      Returns Decimal

    • Return a new Decimal whose value is the value of this Decimal rounded to a maximum of sd significant digits using rounding mode rm, or to precision and rounding respectively if omitted.

      Parameters

      • Optionalsd: number

        Significant digits. Integer, 1 to MAX_DIGITS inclusive.

      • Optionalrm: number

        Rounding mode. Integer, 0 to 8 inclusive.

      Returns Decimal

    • 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

    • 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

    • 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