Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • I80F48

Index

Constructors

Properties

data: BN
FRACTIONS: number = 48
MAX_BN: BN = ...
MAX_SIZE: number = 128

This is represented by a 128 bit signed integer underneath The first 80 bits are treated as an integer and last 48 bits are treated as fractional part after binary point It's possible to think of an I80F48 as an i128 divided by 2 ^ 40

Read up on how fixed point math works: https://inst.eecs.berkeley.edu/~cs61c/sp06/handout/fixedpt.html Read up on how 2s complement works: https://en.wikipedia.org/wiki/Two%27s_complement

MIN_BN: BN = ...
MULTIPLIER_BIG: any = ...
MULTIPLIER_BN: BN = ...
MULTIPLIER_NUMBER: number = ...

Methods

  • getBinaryLayout(): string
  • getData(): BN
  • isNeg(): boolean
  • isPos(): boolean
  • isZero(): boolean
  • toArray(): Uint8Array
  • toArrayLike(ArrayType: BufferConstructor, endian?: Endianness, length?: number): Buffer
  • Parameters

    • ArrayType: BufferConstructor
    • Optional endian: Endianness
    • Optional length: number

    Returns Buffer

  • toBig(): Big
  • toFixed(decimals?: number): string
  • The number will be rounded first for UI sensibilities, then toFixed

    Parameters

    • Optional decimals: number

    Returns string

  • toLocaleString(locales?: string | string[], options?: NumberFormatOptions): string
  • Parameters

    • Optional locales: string | string[]
    • Optional options: NumberFormatOptions

    Returns string

  • toNumber(): number
  • toString(): string
  • toTwos(): BN
  • fromArray(src: Uint8Array): I80F48
  • fromNumberOrUndef(x?: number): undefined | I80F48
  • fromOptionalString(x?: string): undefined | I80F48

Generated using TypeDoc