natSafeMath: {
    add: NatOp;
    bankersDivide: NatOp;
    ceilDivide: NatOp;
    floorDivide: NatOp;
    isGTE: ((x: number | bigint, y: number | bigint) => boolean);
    multiply: NatOp;
    subtract: NatOp;
} = ...

These operations should be used for calculations with the values of basic fungible tokens.

natSafeMath is designed to be used directly, and so it needs to validate the inputs, as well as the outputs when necessary.

Type declaration

  • add: NatOp
  • bankersDivide: NatOp

    Divide using half-to-even (aka Banker's Rounding) as in IEEE 774 default rounding

  • ceilDivide: NatOp
  • floorDivide: NatOp
  • isGTE: ((x: number | bigint, y: number | bigint) => boolean)
      • (x, y): boolean
      • Parameters

        • x: number | bigint
        • y: number | bigint

        Returns boolean

  • multiply: NatOp
  • subtract: NatOp