Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • I80F48

Index

Constructors

constructor

Properties

data

data: BN

Static FRACTIONS

FRACTIONS: number = 48

Static MAX_BN

MAX_BN: BN = ...

Static MAX_SIZE

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

Static MIN_BN

MIN_BN: BN = ...

Static MULTIPLIER_BIG

MULTIPLIER_BIG: Big = ...

Static MULTIPLIER_BN

MULTIPLIER_BN: BN = ...

Static MULTIPLIER_NUMBER

MULTIPLIER_NUMBER: number = ...

Methods

abs

add

ceil

cmp

div

eq

floor

frac

getBinaryLayout

  • getBinaryLayout(): string

getData

  • getData(): BN

gt

gte

iadd

idiv

imul

isNeg

  • isNeg(): boolean

isPos

  • isPos(): boolean

isZero

  • isZero(): boolean

isub

lt

lte

max

min

mul

neg

sub

toArray

  • toArray(): Uint8Array

toArrayLike

  • toArrayLike(ArrayType: typeof Buffer, endian?: Endianness, length?: number): Buffer

toBig

  • toBig(): Big

toFixed

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

    Parameters

    • Optional decimals: number

    Returns string

toFormat

  • toFormat(decimals: number): string

toLocaleString

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

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

    Returns string

toNumber

  • toNumber(): number

toString

  • toString(): string

toTwos

  • toTwos(): BN

Static fromArray

  • fromArray(src: Uint8Array): I80F48

Static fromBig

Static fromI64

Static fromNumber

Static fromNumberOrUndef

  • fromNumberOrUndef(x?: number): undefined | I80F48

Static fromOptionalString

  • fromOptionalString(x?: string): undefined | I80F48

Static fromString

Static fromU64

Generated using TypeDoc