UNPKG

@mathigon/fermat

Version:

Powerful mathematics and statistics library for JavaScript.

27 lines (26 loc) 1.12 kB
/** Fraction class. */ export declare class Fraction { n: number; d: number; constructor(n: number, d?: number); get decimal(): number; get sign(): 1 | 0 | -1; get simplified(): Fraction; get inverse(): Fraction; toMathML(): string; toString(): string; static fromDecimal(x: number, max?: number): Fraction; static fromString(s: string): Fraction | undefined; add(a: Fraction | number): Fraction; subtract(a: Fraction | number): Fraction; multiply(a: Fraction | number): Fraction; divide(a: Fraction | number): Fraction; /** Calculates the sum of two fractions a and b. */ static sum(a: Fraction | number, b: Fraction | number): Fraction; /** Calculates the difference of two fractions a and b. */ static difference(a: Fraction | number, b: Fraction | number): Fraction; /** Calculates the product of two fractions a and b. */ static product(a: Fraction | number, b: Fraction | number): Fraction; /** Calculates the quotient of two fractions a and b. */ static quotient(a: Fraction | number, b: Fraction | number): Fraction; }