Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Dec

Represents decimal values serialized with 18 digits of precision. This implementation is based on the decimal.js library, and returns Dec values for only Dec.add, Dec.sub, Dec.mul, Dec.div, and Dec.mod. For other methods inherited from Decimal, you will need to convert back to Dec to remain compatible for submitting information that requires Dec format back to the blockchain.

Example:

const dec = new Dec(1.5);

const decimal = dec.sqrt();
const dec2 = new Dec(decimal);

Hierarchy

  • Decimal
    • Dec

Implements

Index

Constructors

  • new Dec(arg?: Value): Dec

Methods

  • add(other: Value): Dec
  • div(other: Value): Dec
  • mod(other: Value): Dec
  • mul(other: Value): Dec
  • sub(other: Value): Dec
  • toString(): string
  • withPrec(value: Value, prec: number): Dec