@neutrium/decimal API - v2.3.0
    Preparing search index...

    Class Decimal

    The core Decimal representation plus arithmetic and rounding operations. Integer powers are included; import the scientific tier for general powers, logarithms, and trigonometry.

    Hierarchy (View Summary)

    Index
    clone: (config?: Partial<DecimalConfig>) => DecimalConstructor

    Create an independently configurable constructor for this tier.

    Type Declaration

    max: {
        (value: DecimalValueIterable): Decimal;
        (value: DecimalValue, ...values: DecimalValue[]): Decimal;
    }

    Select the greatest value from an iterable or scalar inputs.

    Type Declaration

    min: {
        (value: DecimalValueIterable): Decimal;
        (value: DecimalValue, ...values: DecimalValue[]): Decimal;
    }

    Select the least value from an iterable or scalar inputs.

    Type Declaration

    • Convert according to JavaScript's primitive hint.

      Parameters

      • hint: "string" | "number" | "default"

      Returns string | number

    • Returns number

      The number of digits after the decimal point, or NaN for a non-finite value.

    • Raise to a safe integer Number exponent, rounding only the final result. Negative exponents calculate reciprocals. Invalid exponents throw INVALID_ARGUMENT.

      Parameters

      • exponent: number

      Returns Decimal

    • Count this value's significant digits.

      Parameters

      • OptionalincludeTrailingIntegerZeros: boolean

      Returns number

    • Estimate the bytes used by this value's stored numeric state.

      The estimate counts the coefficient reference, exponent, sign, and each base-1e7 coefficient word as one eight-byte slot. It excludes engine-dependent object and array headers, alignment, private-field metadata, and shared prototype data.

      Returns number

    • Compare an exact rational sum with zero, returning -1, 0 or 1. Precision, rounding, exponent and formatting settings do not affect the comparison. Terms have the same validation and resource limits as fromRationalSum. Empty, all-zero and exactly cancelling inputs return +0.

      Parameters

      Returns -1 | 0 | 1

    • Construct a sum of exact rational terms, rounding once using this constructor's settings. Terms represent numerator / denominator times ten to exponent. Denominators must be positive. Empty or all-zero inputs produce +0; nonzero cancellation produces -0 only with floor rounding. Invalid terms or non-iterable input throw INVALID_ARGUMENT.

      Parameters

      Returns Decimal