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

  • _Dec
    • Dec

Implements

Index

Constructors

constructor

  • new Dec(arg?: Value): Dec

Methods

add

  • add(other: Value): Dec

div

  • div(other: Value): Dec

mod

  • mod(other: Value): Dec

mul

  • mul(other: Value): Dec

sub

  • sub(other: Value): Dec

toInt

Static withPrec

  • withPrec(value: Value, prec: number): Dec