| 1 | declare class Fraction {
|
|---|
| 2 | constructor();
|
|---|
| 3 | constructor(num: Fraction.FractionInput);
|
|---|
| 4 | constructor(numerator: number | bigint, denominator: number | bigint);
|
|---|
| 5 |
|
|---|
| 6 | s: bigint;
|
|---|
| 7 | n: bigint;
|
|---|
| 8 | d: bigint;
|
|---|
| 9 |
|
|---|
| 10 | abs(): Fraction;
|
|---|
| 11 | neg(): Fraction;
|
|---|
| 12 |
|
|---|
| 13 | add: Fraction.FractionParam;
|
|---|
| 14 | sub: Fraction.FractionParam;
|
|---|
| 15 | mul: Fraction.FractionParam;
|
|---|
| 16 | div: Fraction.FractionParam;
|
|---|
| 17 | pow: Fraction.FractionParam;
|
|---|
| 18 | log: Fraction.FractionParam;
|
|---|
| 19 | gcd: Fraction.FractionParam;
|
|---|
| 20 | lcm: Fraction.FractionParam;
|
|---|
| 21 |
|
|---|
| 22 | mod(): Fraction;
|
|---|
| 23 | mod(num: Fraction.FractionInput): Fraction;
|
|---|
| 24 |
|
|---|
| 25 | ceil(places?: number): Fraction;
|
|---|
| 26 | floor(places?: number): Fraction;
|
|---|
| 27 | round(places?: number): Fraction;
|
|---|
| 28 | roundTo: Fraction.FractionParam;
|
|---|
| 29 |
|
|---|
| 30 | inverse(): Fraction;
|
|---|
| 31 | simplify(eps?: number): Fraction;
|
|---|
| 32 |
|
|---|
| 33 | equals(num: Fraction.FractionInput): boolean;
|
|---|
| 34 | lt(num: Fraction.FractionInput): boolean;
|
|---|
| 35 | lte(num: Fraction.FractionInput): boolean;
|
|---|
| 36 | gt(num: Fraction.FractionInput): boolean;
|
|---|
| 37 | gte(num: Fraction.FractionInput): boolean;
|
|---|
| 38 | compare(num: Fraction.FractionInput): number;
|
|---|
| 39 | divisible(num: Fraction.FractionInput): boolean;
|
|---|
| 40 |
|
|---|
| 41 | valueOf(): number;
|
|---|
| 42 | toString(decimalPlaces?: number): string;
|
|---|
| 43 | toLatex(showMixed?: boolean): string;
|
|---|
| 44 | toFraction(showMixed?: boolean): string;
|
|---|
| 45 | toContinued(): bigint[];
|
|---|
| 46 | clone(): Fraction;
|
|---|
| 47 |
|
|---|
| 48 | static default: typeof Fraction;
|
|---|
| 49 | static Fraction: typeof Fraction;
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 | declare namespace Fraction {
|
|---|
| 53 | interface NumeratorDenominator { n: number | bigint; d: number | bigint; }
|
|---|
| 54 | type FractionInput =
|
|---|
| 55 | | Fraction
|
|---|
| 56 | | number
|
|---|
| 57 | | bigint
|
|---|
| 58 | | string
|
|---|
| 59 | | [number | bigint | string, number | bigint | string]
|
|---|
| 60 | | NumeratorDenominator;
|
|---|
| 61 |
|
|---|
| 62 | type FractionParam = {
|
|---|
| 63 | (numerator: number | bigint, denominator: number | bigint): Fraction;
|
|---|
| 64 | (num: FractionInput): Fraction;
|
|---|
| 65 | };
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 | /**
|
|---|
| 69 | * Export matches CJS runtime:
|
|---|
| 70 | * module.exports = Fraction;
|
|---|
| 71 | * module.exports.default = Fraction;
|
|---|
| 72 | * module.exports.Fraction = Fraction;
|
|---|
| 73 | */
|
|---|
| 74 | declare const FractionExport: typeof Fraction & {
|
|---|
| 75 | default: typeof Fraction;
|
|---|
| 76 | Fraction: typeof Fraction;
|
|---|
| 77 | };
|
|---|
| 78 |
|
|---|
| 79 | export = FractionExport; |
|---|