dev
    Preparing search index...

    Class Fraction

    Fraction represents a rational number.

    Index

    Constructors

    • Set the numerator and denominator.

      Parameters

      • Optionalnumerator: number
      • Optionaldenominator: number

      Returns Fraction

    Properties

    denominator: number = 1
    numerator: number = 1

    Accessors

    Methods

    • Set the numerator and denominator.

      Parameters

      • numerator: number = 1
      • denominator: number = 1

      Returns this

    • GCD: Greatest common divisor using the Euclidean algorithm. Note: GCD(0, 0) => 0 and GCD(0, n) => n.

      Parameters

      • a: number
      • b: number

      Returns number

    • LCM: Lowest common multiple.

      Parameters

      • a: number
      • b: number

      Returns number

    • Lowest common multiple for more than two numbers.

      Note that the args array will be manipulated and shortened recursively during computation.

      Parameters

      • args: number[]

      Returns number