Rational

A number type allowing for higher precision when used to represent a rational number with a specified denominator.

Extends

  • Rational

Extended by

Constructors

  • constructor

    • new Rational(numerator: number, denominatorType: DenominatorType, doubleValue: number = ...): Rational

      Represents a number that can be expressed in the form numerator / denominator. Supports a fixed set of denominator values.

      Parameters

      • numerator: numberThe numerator of the rational number.
      • denominatorType: DenominatorTypeThe type of the denominator of the rational number.
      • doubleValue: number = ...The closest JavaScript number (if not supplied an approximation is calculated).

      Returns Rational

Methods

  • fromJSON

    • fromJSON(json: any): Rational

      Returns Rational

  • valueOf

    • valueOf(): number

      Returns the doubleValue.

      Returns number

  • toJSON

    • toJSON(): any

      Returns any

  • toString

    • toString(): string

      Returns string

Properties

Also in this Section