CCC Docs
    Preparing search index...

    Function fixedPointFrom

    • Converts a FixedPointLike value to a FixedPoint (bigint) with fixed-point decimals.

      Parameters

      • val: FixedPointLike

        The value to convert, which can be a bigint, string, or number.

      • decimals: number = 8

        The number of decimal places for the fixed-point representation. Default is 8.

      Returns bigint

      A FixedPoint (bigint) representing the value with fixed-point decimals.

      const fixedPoint = fixedPointFrom(123456789n, 8); // Outputs 123456789n
      const fixedPointFromString = fixedPointFrom("1.23456789", 8); // Outputs 123456789n
      const fixedPointFromNumber = fixedPointFrom(1.23456789, 8); // Outputs 123456789n