fraction.d.ts
1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
declare module 'Fraction';
export interface NumeratorDenominator {
n: number;
d: number;
}
type FractionConstructor = {
(fraction: Fraction): Fraction;
(num: number | string): Fraction;
(numerator: number, denominator: number): Fraction;
(numbers: [number | string, number | string]): Fraction;
(fraction: NumeratorDenominator): Fraction;
(firstValue: Fraction | number | string | [number | string, number | string] | NumeratorDenominator, secondValue?: number): Fraction;
};
export default class Fraction {
constructor (fraction: Fraction);
constructor (num: number | string);
constructor (numerator: number, denominator: number);
constructor (numbers: [number | string, number | string]);
constructor (fraction: NumeratorDenominator);
constructor (firstValue: Fraction | number | string | [number | string, number | string] | NumeratorDenominator, secondValue?: number);
s: number;
n: number;
d: number;
abs(): Fraction;
neg(): Fraction;
add: FractionConstructor;
sub: FractionConstructor;
mul: FractionConstructor;
div: FractionConstructor;
pow: FractionConstructor;
gcd: FractionConstructor;
lcm: FractionConstructor;
mod(n?: number | string | Fraction): Fraction;
ceil(places?: number): Fraction;
floor(places?: number): Fraction;
round(places?: number): Fraction;
inverse(): Fraction;
simplify(eps?: number): Fraction;
equals(n: number | string | Fraction): boolean;
compare(n: number | string | Fraction): number;
divisible(n: number | string | Fraction): boolean;
valueOf(): number;
toString(decimalPlaces?: number): string;
toLatex(excludeWhole?: boolean): string;
toFraction(excludeWhole?: boolean): string;
toContinued(): number[];
clone(): Fraction;
}