1 | export declare type ValueType = string | number;
|
2 | export interface DecimalClass {
|
3 | add: (value: ValueType) => DecimalClass;
|
4 | isEmpty: () => boolean;
|
5 | isNaN: () => boolean;
|
6 | isInvalidate: () => boolean;
|
7 | toNumber: () => number;
|
8 | |
9 |
|
10 |
|
11 |
|
12 | toString: (safe?: boolean) => string;
|
13 | equals: (target: DecimalClass) => boolean;
|
14 | lessEquals: (target: DecimalClass) => boolean;
|
15 | negate: () => DecimalClass;
|
16 | }
|
17 |
|
18 |
|
19 |
|
20 | export declare class NumberDecimal implements DecimalClass {
|
21 | origin: string;
|
22 | number: number;
|
23 | empty: boolean;
|
24 | constructor(value: ValueType);
|
25 | negate(): NumberDecimal;
|
26 | add(value: ValueType): NumberDecimal;
|
27 | isEmpty(): boolean;
|
28 | isNaN(): boolean;
|
29 | isInvalidate(): boolean;
|
30 | equals(target: DecimalClass): boolean;
|
31 | lessEquals(target: DecimalClass): boolean;
|
32 | toNumber(): number;
|
33 | toString(safe?: boolean): string;
|
34 | }
|
35 | export declare class BigIntDecimal implements DecimalClass {
|
36 | origin: string;
|
37 | negative: boolean;
|
38 | integer: bigint;
|
39 | decimal: bigint;
|
40 |
|
41 | decimalLen: number;
|
42 | empty: boolean;
|
43 | nan: boolean;
|
44 | constructor(value: string | number);
|
45 | private getMark;
|
46 | private getIntegerStr;
|
47 | private getDecimalStr;
|
48 | /**
|
49 | * Align BigIntDecimal with same decimal length. e.g. 12.3 + 5 = 1230000
|
50 | * This is used for add function only.
|
51 | */
|
52 | private alignDecimal;
|
53 | negate(): BigIntDecimal;
|
54 | add(value: ValueType): BigIntDecimal;
|
55 | isEmpty(): boolean;
|
56 | isNaN(): boolean;
|
57 | isInvalidate(): boolean;
|
58 | equals(target: DecimalClass): boolean;
|
59 | lessEquals(target: DecimalClass): boolean;
|
60 | toNumber(): number;
|
61 | toString(safe?: boolean): string;
|
62 | }
|
63 | export default function getMiniDecimal(value: ValueType): DecimalClass;
|
64 | /**
|
65 | * Align the logic of toFixed to around like 1.5 => 2.
|
66 | * If set `cutOnly`, will just remove the over decimal part.
|
67 | */
|
68 | export declare function toFixed(numStr: string, separatorStr: string, precision?: number, cutOnly?: boolean): any;
|