Options
All
  • Public
  • Public/Protected
  • All
Menu

Class QQ

The QQ class represents a rational number, ℚ.

The QQ implementation is that of an immutable (value) type.

The numerator and denominator are reduced to their lowest form.

Construct new instances using the static valueOf method.

Hierarchy

  • QQ

Implements

Index

Constructors

constructor

  • new QQ(n: number, d: number, code: number): QQ

Properties

Private _denom

_denom: number

Private _numer

_numer: number

Static Private NEG_01_01

NEG_01_01: QQ = new QQ(-1, 1, magicCode)

Static Private NEG_01_03

NEG_01_03: QQ = new QQ(-1, 3, magicCode)

Static Private NEG_02_01

NEG_02_01: QQ = new QQ(-2, 1, magicCode)

Static Private NEG_03_01

NEG_03_01: QQ = new QQ(-3, 1, magicCode)

Static Private ONE

ONE: QQ = new QQ(1, 1, magicCode)

Static Private POS_01_02

POS_01_02: QQ = new QQ(1, 2, magicCode)

Static Private POS_01_03

POS_01_03: QQ = new QQ(1, 3, magicCode)

Static Private POS_01_04

POS_01_04: QQ = new QQ(1, 4, magicCode)

Static Private POS_01_05

POS_01_05: QQ = new QQ(1, 5, magicCode)

Static Private POS_02_01

POS_02_01: QQ = new QQ(2, 1, magicCode)

Static Private POS_02_03

POS_02_03: QQ = new QQ(2, 3, magicCode)

Static Private POS_03_01

POS_03_01: QQ = new QQ(3, 1, magicCode)

Static Private POS_04_01

POS_04_01: QQ = new QQ(4, 1, magicCode)

Static Private POS_05_01

POS_05_01: QQ = new QQ(5, 1, magicCode)

Static Private POS_06_01

POS_06_01: QQ = new QQ(6, 1, magicCode)

Static Private POS_07_01

POS_07_01: QQ = new QQ(7, 1, magicCode)

Static Private POS_08_01

POS_08_01: QQ = new QQ(8, 1, magicCode)

Static Private ZERO

ZERO: QQ = new QQ(0, 1, magicCode)

Accessors

denom

  • get denom(): number
  • set denom(unused: number): void

numer

  • get numer(): number
  • set numer(unused: number): void

Methods

__add__

  • __add__(rhs: QQ): QQ

__div__

  • __div__(rhs: QQ): QQ

__mul__

  • __mul__(rhs: QQ): QQ

__neg__

  • __neg__(): QQ

__pos__

  • __pos__(): QQ

__radd__

  • __radd__(lhs: QQ): QQ

__rdiv__

  • __rdiv__(lhs: QQ): QQ

__rmul__

  • __rmul__(lhs: QQ): QQ

__rsub__

  • __rsub__(lhs: QQ): QQ

__sub__

  • __sub__(rhs: QQ): QQ

add

div

equals

  • equals(other: QQ): boolean

hashCode

  • hashCode(): number

inv

  • inv(): QQ

isOne

  • isOne(): boolean

isZero

  • isZero(): boolean

mul

neg

  • neg(): QQ

sub

toString

  • toString(): string

Static valueOf

  • valueOf(n: number, d: number): QQ