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

    Class Decimal

    The arithmetic Decimal tier plus powers, logarithms, and trigonometry. Exported as Decimal by both the root and scientific entry points. Calculations preserve library clones and return this tier for application subclasses.

    Hierarchy (View Summary)

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

    Create an independently configurable constructor for this tier.

    Type Declaration

    fromRationalSum: (terms: Iterable<DecimalRationalTerm>) => Decimal

    Construct a correctly rounded sum in the scientific 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