@agrozyme/numeric 1.0.11 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc.yml +8 -0
- package/package.json +23 -17
- package/root/index.ts +139 -368
- package/tsc-multi.json +4 -3
- package/tsconfig.json +24 -11
- package/out/index.d.ts +0 -158
- package/out/index.js +0 -471
- package/out/index.mjs +0 -455
package/tsconfig.json
CHANGED
|
@@ -1,21 +1,34 @@
|
|
|
1
1
|
{
|
|
2
|
-
"compileOnSave":
|
|
2
|
+
"compileOnSave": false,
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
|
|
4
|
+
// Type Checking
|
|
5
|
+
"strict": true,
|
|
6
|
+
|
|
7
|
+
// Modules
|
|
8
|
+
"module": "ESNext",
|
|
9
|
+
"moduleResolution": "NodeNext",
|
|
10
|
+
"rootDir": "root",
|
|
11
|
+
|
|
12
|
+
// Emit
|
|
5
13
|
"downlevelIteration": true,
|
|
6
14
|
"importHelpers": true,
|
|
7
|
-
"
|
|
8
|
-
"module": "ESNext",
|
|
15
|
+
"newLine": "LF",
|
|
9
16
|
"outDir": "out",
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
"sourceMap": true,
|
|
18
|
+
|
|
19
|
+
// Interop Constraints
|
|
13
20
|
"esModuleInterop": true,
|
|
14
|
-
"moduleResolution": "Node",
|
|
15
|
-
"emitDecoratorMetadata": true,
|
|
16
|
-
"experimentalDecorators": true,
|
|
17
21
|
"forceConsistentCasingInFileNames": true,
|
|
18
|
-
"
|
|
22
|
+
"isolatedModules": true,
|
|
23
|
+
|
|
24
|
+
// Language and Environment
|
|
25
|
+
"jsx": "preserve",
|
|
26
|
+
"target": "ESNext",
|
|
27
|
+
|
|
28
|
+
// Projects
|
|
29
|
+
"composite": true,
|
|
30
|
+
|
|
31
|
+
// Completeness
|
|
19
32
|
"skipLibCheck": true
|
|
20
33
|
},
|
|
21
34
|
"include": ["root/**/*.ts", "test/**/*.ts"]
|
package/out/index.d.ts
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { BigNumber, BigNumberish } from '@ethersproject/bignumber';
|
|
3
|
-
import bigInt from 'big-integer';
|
|
4
|
-
import BN from 'bn.js';
|
|
5
|
-
import { Decimal } from 'decimal.js';
|
|
6
|
-
import { InspectOptionsStylized } from 'util';
|
|
7
|
-
export declare type NumericValue = Numeric | Decimal.Value | bigInt.BigNumber | BigNumberish;
|
|
8
|
-
export interface IFormatNumberOptions {
|
|
9
|
-
negativeType?: 'right' | 'left' | 'brackets' | 'none';
|
|
10
|
-
negativeLeftSymbol?: string;
|
|
11
|
-
negativeRightSymbol?: string;
|
|
12
|
-
negativeLeftOut?: boolean;
|
|
13
|
-
negativeRightOut?: boolean;
|
|
14
|
-
prefix?: string;
|
|
15
|
-
suffix?: string;
|
|
16
|
-
integerSeparator?: string;
|
|
17
|
-
decimalsSeparator?: string;
|
|
18
|
-
decimal?: string;
|
|
19
|
-
padLeft?: number;
|
|
20
|
-
padRight?: number;
|
|
21
|
-
round?: number;
|
|
22
|
-
truncate?: number;
|
|
23
|
-
}
|
|
24
|
-
export declare class Numeric extends Decimal {
|
|
25
|
-
constructor(value: NumericValue);
|
|
26
|
-
static abs(value: NumericValue): Numeric;
|
|
27
|
-
static acos(value: NumericValue): Numeric;
|
|
28
|
-
static acosh(value: NumericValue): Numeric;
|
|
29
|
-
static add(x: NumericValue, y: NumericValue): Numeric;
|
|
30
|
-
static asin(value: NumericValue): Numeric;
|
|
31
|
-
static asinh(value: NumericValue): Numeric;
|
|
32
|
-
static atan(value: NumericValue): Numeric;
|
|
33
|
-
static atan2(x: NumericValue, y: NumericValue): Numeric;
|
|
34
|
-
static atanh(value: NumericValue): Numeric;
|
|
35
|
-
static cbrt(value: NumericValue): Numeric;
|
|
36
|
-
static ceil(value: NumericValue): Numeric;
|
|
37
|
-
static cos(value: NumericValue): Numeric;
|
|
38
|
-
static cosh(value: NumericValue): Numeric;
|
|
39
|
-
static div(x: NumericValue, y: NumericValue): Numeric;
|
|
40
|
-
static exp(value: NumericValue): Numeric;
|
|
41
|
-
static floor(value: NumericValue): Numeric;
|
|
42
|
-
static hypot(...values: NumericValue[]): Numeric;
|
|
43
|
-
static ln(value: NumericValue): Numeric;
|
|
44
|
-
static log(value: NumericValue, base?: NumericValue): Numeric;
|
|
45
|
-
static log10(value: NumericValue): Numeric;
|
|
46
|
-
static log2(value: NumericValue): Numeric;
|
|
47
|
-
static max(...values: NumericValue[]): Numeric;
|
|
48
|
-
static min(...values: NumericValue[]): Numeric;
|
|
49
|
-
static mod(x: NumericValue, y: NumericValue): Numeric;
|
|
50
|
-
static mul(x: NumericValue, y: NumericValue): Numeric;
|
|
51
|
-
static pow(base: NumericValue, exponent: NumericValue): Numeric;
|
|
52
|
-
static random(significantDigits?: number): Numeric;
|
|
53
|
-
static round(value: NumericValue): Numeric;
|
|
54
|
-
static set(object: Decimal.Config): typeof Decimal;
|
|
55
|
-
static sign(value: NumericValue): Numeric;
|
|
56
|
-
static sin(value: NumericValue): Numeric;
|
|
57
|
-
static sinh(value: NumericValue): Numeric;
|
|
58
|
-
static sqrt(value: NumericValue): Numeric;
|
|
59
|
-
static sub(x: NumericValue, y: NumericValue): Numeric;
|
|
60
|
-
static tan(value: NumericValue): Numeric;
|
|
61
|
-
static tanh(value: NumericValue): Numeric;
|
|
62
|
-
static trunc(value: NumericValue): Numeric;
|
|
63
|
-
abs(): Numeric;
|
|
64
|
-
absoluteValue(): Numeric;
|
|
65
|
-
acos(): Numeric;
|
|
66
|
-
acosh(): Numeric;
|
|
67
|
-
add(value: NumericValue): Numeric;
|
|
68
|
-
asin(): Numeric;
|
|
69
|
-
asinh(): Numeric;
|
|
70
|
-
atan(): Numeric;
|
|
71
|
-
atanh(): Numeric;
|
|
72
|
-
cbrt(): Numeric;
|
|
73
|
-
ceil(): Numeric;
|
|
74
|
-
cmp(value: NumericValue): number;
|
|
75
|
-
comparedTo(value: NumericValue): number;
|
|
76
|
-
cos(): Numeric;
|
|
77
|
-
cosh(): Numeric;
|
|
78
|
-
cosine(): Numeric;
|
|
79
|
-
cubeRoot(): Numeric;
|
|
80
|
-
div(value: NumericValue): Numeric;
|
|
81
|
-
divToInt(value: NumericValue): Numeric;
|
|
82
|
-
dividedBy(value: NumericValue): Numeric;
|
|
83
|
-
dividedToIntegerBy(value: NumericValue): Numeric;
|
|
84
|
-
eq(value: NumericValue): boolean;
|
|
85
|
-
equals(value: NumericValue): boolean;
|
|
86
|
-
exp(): Numeric;
|
|
87
|
-
floor(): Numeric;
|
|
88
|
-
greaterThan(value: NumericValue): boolean;
|
|
89
|
-
greaterThanOrEqualTo(value: NumericValue): boolean;
|
|
90
|
-
gt(value: NumericValue): boolean;
|
|
91
|
-
gte(value: NumericValue): boolean;
|
|
92
|
-
hyperbolicCosine(): Numeric;
|
|
93
|
-
hyperbolicSine(): Numeric;
|
|
94
|
-
hyperbolicTangent(): Numeric;
|
|
95
|
-
inverseCosine(): Numeric;
|
|
96
|
-
inverseHyperbolicCosine(): Numeric;
|
|
97
|
-
inverseHyperbolicSine(): Numeric;
|
|
98
|
-
inverseHyperbolicTangent(): Numeric;
|
|
99
|
-
inverseSine(): Numeric;
|
|
100
|
-
inverseTangent(): Numeric;
|
|
101
|
-
lessThan(value: NumericValue): boolean;
|
|
102
|
-
lessThanOrEqualTo(value: NumericValue): boolean;
|
|
103
|
-
ln(): Numeric;
|
|
104
|
-
log(value?: NumericValue): Numeric;
|
|
105
|
-
logarithm(value?: NumericValue): Numeric;
|
|
106
|
-
lt(value: NumericValue): boolean;
|
|
107
|
-
lte(value: NumericValue): boolean;
|
|
108
|
-
minus(value: NumericValue): Numeric;
|
|
109
|
-
mod(value: NumericValue): Numeric;
|
|
110
|
-
modulo(value: NumericValue): Numeric;
|
|
111
|
-
mul(value: NumericValue): Numeric;
|
|
112
|
-
naturalExponential(): Numeric;
|
|
113
|
-
naturalLogarithm(): Numeric;
|
|
114
|
-
neg(): Numeric;
|
|
115
|
-
negated(): Numeric;
|
|
116
|
-
plus(value: NumericValue): Numeric;
|
|
117
|
-
pow(value: NumericValue): Numeric;
|
|
118
|
-
round(): Numeric;
|
|
119
|
-
sin(): Numeric;
|
|
120
|
-
sine(): Numeric;
|
|
121
|
-
sinh(): Numeric;
|
|
122
|
-
sqrt(): Numeric;
|
|
123
|
-
squareRoot(): Numeric;
|
|
124
|
-
sub(value: NumericValue): Numeric;
|
|
125
|
-
tan(): Numeric;
|
|
126
|
-
tangent(): Numeric;
|
|
127
|
-
tanh(): Numeric;
|
|
128
|
-
times(value: NumericValue): Numeric;
|
|
129
|
-
toDP(decimalPlaces?: number, rounding?: Decimal.Rounding): Numeric;
|
|
130
|
-
toDecimalPlaces(decimalPlaces?: number, rounding?: Decimal.Rounding): Numeric;
|
|
131
|
-
toFraction(maxDenominator?: NumericValue): Numeric[];
|
|
132
|
-
toNearest(value: NumericValue, rounding?: Decimal.Rounding): Numeric;
|
|
133
|
-
toPower(value: NumericValue): Numeric;
|
|
134
|
-
toSD(decimalPlaces?: number, rounding?: Decimal.Rounding): Numeric;
|
|
135
|
-
toSignificantDigits(decimalPlaces?: number, rounding?: Decimal.Rounding): Numeric;
|
|
136
|
-
trunc(): Numeric;
|
|
137
|
-
truncated(): Numeric;
|
|
138
|
-
inspect(depth: number, options: InspectOptionsStylized): string;
|
|
139
|
-
}
|
|
140
|
-
export declare const toNumeric: (value: NumericValue) => Numeric;
|
|
141
|
-
export declare const toNumerics: (values: NumericValue[]) => Numeric[];
|
|
142
|
-
export declare const toIntegerString: (value: NumericValue) => string;
|
|
143
|
-
export declare const toBigInt: (value: NumericValue) => bigint;
|
|
144
|
-
export declare const toBN: (value: NumericValue) => BN;
|
|
145
|
-
export declare const toBigInteger: (value: NumericValue) => bigInt.BigInteger;
|
|
146
|
-
export declare const toBigNumber: (value: NumericValue) => BigNumber;
|
|
147
|
-
export declare const createArrayCompareFunction: (ascending?: boolean) => (left: NumericValue, right: NumericValue) => number;
|
|
148
|
-
export declare const formatValue: (value: NumericValue, options?: IFormatNumberOptions | undefined) => string;
|
|
149
|
-
export declare const getNumericConfig: () => Required<Decimal.Config>;
|
|
150
|
-
export declare const setupNumericConfig: () => void;
|
|
151
|
-
export declare const NegativeOne: Numeric;
|
|
152
|
-
export declare const Zero: Numeric;
|
|
153
|
-
export declare const One: Numeric;
|
|
154
|
-
export declare const Two: Numeric;
|
|
155
|
-
export declare const WeiPerEther: Numeric;
|
|
156
|
-
export declare const MaxUint256: Numeric;
|
|
157
|
-
export declare const MaxInt256: Numeric;
|
|
158
|
-
export declare const MinInt256: Numeric;
|
package/out/index.js
DELETED
|
@@ -1,471 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MinInt256 = exports.MaxInt256 = exports.MaxUint256 = exports.WeiPerEther = exports.Two = exports.One = exports.Zero = exports.NegativeOne = exports.setupNumericConfig = exports.getNumericConfig = exports.formatValue = exports.createArrayCompareFunction = exports.toBigNumber = exports.toBigInteger = exports.toBN = exports.toBigInt = exports.toIntegerString = exports.toNumerics = exports.toNumeric = exports.Numeric = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const bignumber_1 = require("@ethersproject/bignumber");
|
|
6
|
-
const bytes_1 = require("@ethersproject/bytes");
|
|
7
|
-
const constants = tslib_1.__importStar(require("@ethersproject/constants"));
|
|
8
|
-
const big_integer_1 = tslib_1.__importDefault(require("big-integer"));
|
|
9
|
-
const bn_js_1 = tslib_1.__importDefault(require("bn.js"));
|
|
10
|
-
const browser_or_node_1 = require("browser-or-node");
|
|
11
|
-
const decimal_js_1 = require("decimal.js");
|
|
12
|
-
const format_number_1 = tslib_1.__importDefault(require("format-number"));
|
|
13
|
-
//noinspection FunctionNamingConventionJS
|
|
14
|
-
class Numeric extends decimal_js_1.Decimal {
|
|
15
|
-
constructor(value) {
|
|
16
|
-
if (value instanceof decimal_js_1.Decimal) {
|
|
17
|
-
super(value);
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
switch (typeof value) {
|
|
21
|
-
case 'string':
|
|
22
|
-
case 'number':
|
|
23
|
-
super(value);
|
|
24
|
-
break;
|
|
25
|
-
case 'bigint':
|
|
26
|
-
super(value.toString());
|
|
27
|
-
break;
|
|
28
|
-
default:
|
|
29
|
-
if (big_integer_1.default.isInstance(value) || bignumber_1.BigNumber.isBigNumber(value) || bn_js_1.default.isBN(value)) {
|
|
30
|
-
super(value.toString());
|
|
31
|
-
}
|
|
32
|
-
else if ((0, bytes_1.isBytesLike)(value)) {
|
|
33
|
-
super((0, bytes_1.hexlify)(value));
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
super(value);
|
|
37
|
-
}
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
// get [Symbol.toStringTag]() {
|
|
43
|
-
// return 'Numeric';
|
|
44
|
-
// }
|
|
45
|
-
static abs(value) {
|
|
46
|
-
return new Numeric(value).abs();
|
|
47
|
-
}
|
|
48
|
-
static acos(value) {
|
|
49
|
-
return new Numeric(value).acos();
|
|
50
|
-
}
|
|
51
|
-
static acosh(value) {
|
|
52
|
-
return new Numeric(value).acosh();
|
|
53
|
-
}
|
|
54
|
-
static add(x, y) {
|
|
55
|
-
return new Numeric(x).add(y);
|
|
56
|
-
}
|
|
57
|
-
static asin(value) {
|
|
58
|
-
return new Numeric(value).asin();
|
|
59
|
-
}
|
|
60
|
-
static asinh(value) {
|
|
61
|
-
return new Numeric(value).asinh();
|
|
62
|
-
}
|
|
63
|
-
static atan(value) {
|
|
64
|
-
return new Numeric(value).atan();
|
|
65
|
-
}
|
|
66
|
-
static atan2(x, y) {
|
|
67
|
-
return new Numeric(decimal_js_1.Decimal.atan2(new Numeric(x), new Numeric(y)));
|
|
68
|
-
}
|
|
69
|
-
static atanh(value) {
|
|
70
|
-
return new Numeric(value).atanh();
|
|
71
|
-
}
|
|
72
|
-
static cbrt(value) {
|
|
73
|
-
return new Numeric(value).cbrt();
|
|
74
|
-
}
|
|
75
|
-
static ceil(value) {
|
|
76
|
-
return new Numeric(value).ceil();
|
|
77
|
-
}
|
|
78
|
-
static cos(value) {
|
|
79
|
-
return new Numeric(value).cos();
|
|
80
|
-
}
|
|
81
|
-
static cosh(value) {
|
|
82
|
-
return new Numeric(value).cosh();
|
|
83
|
-
}
|
|
84
|
-
static div(x, y) {
|
|
85
|
-
return new Numeric(x).div(y);
|
|
86
|
-
}
|
|
87
|
-
static exp(value) {
|
|
88
|
-
return new Numeric(value).exp();
|
|
89
|
-
}
|
|
90
|
-
static floor(value) {
|
|
91
|
-
return new Numeric(value).floor();
|
|
92
|
-
}
|
|
93
|
-
static hypot(...values) {
|
|
94
|
-
return new Numeric(decimal_js_1.Decimal.hypot(...(0, exports.toNumerics)(values)));
|
|
95
|
-
}
|
|
96
|
-
static ln(value) {
|
|
97
|
-
return new Numeric(value).ln();
|
|
98
|
-
}
|
|
99
|
-
static log(value, base) {
|
|
100
|
-
return new Numeric(value).log(base);
|
|
101
|
-
}
|
|
102
|
-
static log10(value) {
|
|
103
|
-
return new Numeric(value).log(10);
|
|
104
|
-
}
|
|
105
|
-
static log2(value) {
|
|
106
|
-
return new Numeric(value).log(2);
|
|
107
|
-
}
|
|
108
|
-
static max(...values) {
|
|
109
|
-
return new Numeric(decimal_js_1.Decimal.max(...(0, exports.toNumerics)(values)));
|
|
110
|
-
}
|
|
111
|
-
static min(...values) {
|
|
112
|
-
return new Numeric(decimal_js_1.Decimal.min(...(0, exports.toNumerics)(values)));
|
|
113
|
-
}
|
|
114
|
-
static mod(x, y) {
|
|
115
|
-
return new Numeric(x).mod(y);
|
|
116
|
-
}
|
|
117
|
-
static mul(x, y) {
|
|
118
|
-
return new Numeric(x).mul(y);
|
|
119
|
-
}
|
|
120
|
-
static pow(base, exponent) {
|
|
121
|
-
return new Numeric(base).pow(exponent);
|
|
122
|
-
}
|
|
123
|
-
static random(significantDigits) {
|
|
124
|
-
return new Numeric(decimal_js_1.Decimal.random(significantDigits));
|
|
125
|
-
}
|
|
126
|
-
static round(value) {
|
|
127
|
-
return new Numeric(value).round();
|
|
128
|
-
}
|
|
129
|
-
static set(object) {
|
|
130
|
-
return decimal_js_1.Decimal.set(object);
|
|
131
|
-
}
|
|
132
|
-
static sign(value) {
|
|
133
|
-
return new Numeric(decimal_js_1.Decimal.sign(new Numeric(value)));
|
|
134
|
-
}
|
|
135
|
-
static sin(value) {
|
|
136
|
-
return new Numeric(value).sin();
|
|
137
|
-
}
|
|
138
|
-
static sinh(value) {
|
|
139
|
-
return new Numeric(value).sinh();
|
|
140
|
-
}
|
|
141
|
-
static sqrt(value) {
|
|
142
|
-
return new Numeric(value).sqrt();
|
|
143
|
-
}
|
|
144
|
-
static sub(x, y) {
|
|
145
|
-
return new Numeric(x).sub(y);
|
|
146
|
-
}
|
|
147
|
-
static tan(value) {
|
|
148
|
-
return new Numeric(value).tan();
|
|
149
|
-
}
|
|
150
|
-
static tanh(value) {
|
|
151
|
-
return new Numeric(value).tanh();
|
|
152
|
-
}
|
|
153
|
-
static trunc(value) {
|
|
154
|
-
return new Numeric(value).trunc();
|
|
155
|
-
}
|
|
156
|
-
abs() {
|
|
157
|
-
return new Numeric(super.abs());
|
|
158
|
-
}
|
|
159
|
-
absoluteValue() {
|
|
160
|
-
return new Numeric(super.absoluteValue());
|
|
161
|
-
}
|
|
162
|
-
acos() {
|
|
163
|
-
return new Numeric(super.acos());
|
|
164
|
-
}
|
|
165
|
-
acosh() {
|
|
166
|
-
return new Numeric(super.acosh());
|
|
167
|
-
}
|
|
168
|
-
add(value) {
|
|
169
|
-
return new Numeric(super.add(new Numeric(value)));
|
|
170
|
-
}
|
|
171
|
-
asin() {
|
|
172
|
-
return new Numeric(super.asin());
|
|
173
|
-
}
|
|
174
|
-
asinh() {
|
|
175
|
-
return new Numeric(super.asinh());
|
|
176
|
-
}
|
|
177
|
-
atan() {
|
|
178
|
-
return new Numeric(super.atan());
|
|
179
|
-
}
|
|
180
|
-
atanh() {
|
|
181
|
-
return new Numeric(super.atanh());
|
|
182
|
-
}
|
|
183
|
-
cbrt() {
|
|
184
|
-
return new Numeric(super.cbrt());
|
|
185
|
-
}
|
|
186
|
-
ceil() {
|
|
187
|
-
return new Numeric(super.ceil());
|
|
188
|
-
}
|
|
189
|
-
cmp(value) {
|
|
190
|
-
return super.cmp(new Numeric(value));
|
|
191
|
-
}
|
|
192
|
-
comparedTo(value) {
|
|
193
|
-
return super.comparedTo(new Numeric(value));
|
|
194
|
-
}
|
|
195
|
-
cos() {
|
|
196
|
-
return new Numeric(super.cos());
|
|
197
|
-
}
|
|
198
|
-
cosh() {
|
|
199
|
-
return new Numeric(super.cosh());
|
|
200
|
-
}
|
|
201
|
-
cosine() {
|
|
202
|
-
return new Numeric(super.cosine());
|
|
203
|
-
}
|
|
204
|
-
cubeRoot() {
|
|
205
|
-
return new Numeric(super.cubeRoot());
|
|
206
|
-
}
|
|
207
|
-
div(value) {
|
|
208
|
-
return new Numeric(super.div(new Numeric(value)));
|
|
209
|
-
}
|
|
210
|
-
divToInt(value) {
|
|
211
|
-
return new Numeric(super.divToInt(new Numeric(value)));
|
|
212
|
-
}
|
|
213
|
-
dividedBy(value) {
|
|
214
|
-
return new Numeric(super.dividedBy(new Numeric(value)));
|
|
215
|
-
}
|
|
216
|
-
dividedToIntegerBy(value) {
|
|
217
|
-
return new Numeric(super.dividedToIntegerBy(new Numeric(value)));
|
|
218
|
-
}
|
|
219
|
-
eq(value) {
|
|
220
|
-
return super.eq(new Numeric(value));
|
|
221
|
-
}
|
|
222
|
-
equals(value) {
|
|
223
|
-
return super.equals(new Numeric(value));
|
|
224
|
-
}
|
|
225
|
-
exp() {
|
|
226
|
-
return new Numeric(super.exp());
|
|
227
|
-
}
|
|
228
|
-
floor() {
|
|
229
|
-
return new Numeric(super.floor());
|
|
230
|
-
}
|
|
231
|
-
greaterThan(value) {
|
|
232
|
-
return super.greaterThan(new Numeric(value));
|
|
233
|
-
}
|
|
234
|
-
greaterThanOrEqualTo(value) {
|
|
235
|
-
return super.greaterThanOrEqualTo(new Numeric(value));
|
|
236
|
-
}
|
|
237
|
-
gt(value) {
|
|
238
|
-
return super.gt(new Numeric(value));
|
|
239
|
-
}
|
|
240
|
-
gte(value) {
|
|
241
|
-
return super.gte(new Numeric(value));
|
|
242
|
-
}
|
|
243
|
-
hyperbolicCosine() {
|
|
244
|
-
return new Numeric(super.hyperbolicCosine());
|
|
245
|
-
}
|
|
246
|
-
hyperbolicSine() {
|
|
247
|
-
return new Numeric(super.hyperbolicSine());
|
|
248
|
-
}
|
|
249
|
-
hyperbolicTangent() {
|
|
250
|
-
return new Numeric(super.hyperbolicTangent());
|
|
251
|
-
}
|
|
252
|
-
inverseCosine() {
|
|
253
|
-
return new Numeric(super.inverseCosine());
|
|
254
|
-
}
|
|
255
|
-
inverseHyperbolicCosine() {
|
|
256
|
-
return new Numeric(super.inverseHyperbolicCosine());
|
|
257
|
-
}
|
|
258
|
-
inverseHyperbolicSine() {
|
|
259
|
-
return new Numeric(super.inverseHyperbolicSine());
|
|
260
|
-
}
|
|
261
|
-
inverseHyperbolicTangent() {
|
|
262
|
-
return new Numeric(super.inverseHyperbolicTangent());
|
|
263
|
-
}
|
|
264
|
-
inverseSine() {
|
|
265
|
-
return new Numeric(super.inverseSine());
|
|
266
|
-
}
|
|
267
|
-
inverseTangent() {
|
|
268
|
-
return new Numeric(super.inverseTangent());
|
|
269
|
-
}
|
|
270
|
-
lessThan(value) {
|
|
271
|
-
return super.lessThan(new Numeric(value));
|
|
272
|
-
}
|
|
273
|
-
lessThanOrEqualTo(value) {
|
|
274
|
-
return super.lessThanOrEqualTo(new Numeric(value));
|
|
275
|
-
}
|
|
276
|
-
ln() {
|
|
277
|
-
return new Numeric(super.ln());
|
|
278
|
-
}
|
|
279
|
-
log(value) {
|
|
280
|
-
return new Numeric(super.log(undefined === value ? undefined : new Numeric(value)));
|
|
281
|
-
}
|
|
282
|
-
logarithm(value) {
|
|
283
|
-
return new Numeric(super.logarithm(undefined === value ? undefined : new Numeric(value)));
|
|
284
|
-
}
|
|
285
|
-
lt(value) {
|
|
286
|
-
return super.lt(new Numeric(value));
|
|
287
|
-
}
|
|
288
|
-
lte(value) {
|
|
289
|
-
return super.lte(new Numeric(value));
|
|
290
|
-
}
|
|
291
|
-
minus(value) {
|
|
292
|
-
return new Numeric(super.minus(new Numeric(value)));
|
|
293
|
-
}
|
|
294
|
-
mod(value) {
|
|
295
|
-
return new Numeric(super.mod(new Numeric(value)));
|
|
296
|
-
}
|
|
297
|
-
modulo(value) {
|
|
298
|
-
return new Numeric(super.modulo(new Numeric(value)));
|
|
299
|
-
}
|
|
300
|
-
mul(value) {
|
|
301
|
-
return new Numeric(super.mul(new Numeric(value)));
|
|
302
|
-
}
|
|
303
|
-
naturalExponential() {
|
|
304
|
-
return new Numeric(super.naturalExponential());
|
|
305
|
-
}
|
|
306
|
-
naturalLogarithm() {
|
|
307
|
-
return new Numeric(super.naturalLogarithm());
|
|
308
|
-
}
|
|
309
|
-
neg() {
|
|
310
|
-
return new Numeric(super.neg());
|
|
311
|
-
}
|
|
312
|
-
negated() {
|
|
313
|
-
return new Numeric(super.negated());
|
|
314
|
-
}
|
|
315
|
-
plus(value) {
|
|
316
|
-
return new Numeric(super.plus(new Numeric(value)));
|
|
317
|
-
}
|
|
318
|
-
pow(value) {
|
|
319
|
-
return new Numeric(super.pow(new Numeric(value)));
|
|
320
|
-
}
|
|
321
|
-
round() {
|
|
322
|
-
return new Numeric(super.round());
|
|
323
|
-
}
|
|
324
|
-
sin() {
|
|
325
|
-
return new Numeric(super.sin());
|
|
326
|
-
}
|
|
327
|
-
sine() {
|
|
328
|
-
return new Numeric(super.sine());
|
|
329
|
-
}
|
|
330
|
-
sinh() {
|
|
331
|
-
return new Numeric(super.sinh());
|
|
332
|
-
}
|
|
333
|
-
sqrt() {
|
|
334
|
-
return new Numeric(super.sqrt());
|
|
335
|
-
}
|
|
336
|
-
squareRoot() {
|
|
337
|
-
return new Numeric(super.squareRoot());
|
|
338
|
-
}
|
|
339
|
-
sub(value) {
|
|
340
|
-
return new Numeric(super.sub(new Numeric(value)));
|
|
341
|
-
}
|
|
342
|
-
tan() {
|
|
343
|
-
return new Numeric(super.tan());
|
|
344
|
-
}
|
|
345
|
-
tangent() {
|
|
346
|
-
return new Numeric(super.tangent());
|
|
347
|
-
}
|
|
348
|
-
tanh() {
|
|
349
|
-
return new Numeric(super.tanh());
|
|
350
|
-
}
|
|
351
|
-
times(value) {
|
|
352
|
-
return new Numeric(super.times(new Numeric(value)));
|
|
353
|
-
}
|
|
354
|
-
toDP(decimalPlaces, rounding) {
|
|
355
|
-
return new Numeric(undefined !== rounding && undefined !== decimalPlaces
|
|
356
|
-
? super.toDP(decimalPlaces, rounding)
|
|
357
|
-
: super.toDP(decimalPlaces));
|
|
358
|
-
}
|
|
359
|
-
toDecimalPlaces(decimalPlaces, rounding) {
|
|
360
|
-
return new Numeric(undefined !== rounding && undefined !== decimalPlaces
|
|
361
|
-
? super.toDecimalPlaces(decimalPlaces, rounding)
|
|
362
|
-
: super.toDecimalPlaces(decimalPlaces));
|
|
363
|
-
}
|
|
364
|
-
toFraction(maxDenominator) {
|
|
365
|
-
return (0, exports.toNumerics)(super.toFraction(undefined === maxDenominator ? undefined : new Numeric(maxDenominator)));
|
|
366
|
-
}
|
|
367
|
-
toNearest(value, rounding) {
|
|
368
|
-
return new Numeric(super.toNearest(new Numeric(value), rounding));
|
|
369
|
-
}
|
|
370
|
-
toPower(value) {
|
|
371
|
-
return new Numeric(super.toPower(new Numeric(value)));
|
|
372
|
-
}
|
|
373
|
-
toSD(decimalPlaces, rounding) {
|
|
374
|
-
return new Numeric(undefined !== rounding && undefined !== decimalPlaces
|
|
375
|
-
? super.toSD(decimalPlaces, rounding)
|
|
376
|
-
: super.toSD(decimalPlaces));
|
|
377
|
-
}
|
|
378
|
-
toSignificantDigits(decimalPlaces, rounding) {
|
|
379
|
-
return new Numeric(undefined !== rounding && undefined !== decimalPlaces
|
|
380
|
-
? super.toSignificantDigits(decimalPlaces, rounding)
|
|
381
|
-
: super.toSignificantDigits(decimalPlaces));
|
|
382
|
-
}
|
|
383
|
-
trunc() {
|
|
384
|
-
return new Numeric(super.trunc());
|
|
385
|
-
}
|
|
386
|
-
truncated() {
|
|
387
|
-
return new Numeric(super.truncated());
|
|
388
|
-
}
|
|
389
|
-
inspect(depth, options) {
|
|
390
|
-
const value = this.toFixed();
|
|
391
|
-
return browser_or_node_1.isNode ? options.stylize(value, 'bigint') : value;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
exports.Numeric = Numeric;
|
|
395
|
-
const toNumeric = (value) => {
|
|
396
|
-
return new Numeric(value);
|
|
397
|
-
};
|
|
398
|
-
exports.toNumeric = toNumeric;
|
|
399
|
-
const toNumerics = (values) => {
|
|
400
|
-
return values.map(exports.toNumeric);
|
|
401
|
-
};
|
|
402
|
-
exports.toNumerics = toNumerics;
|
|
403
|
-
const toIntegerString = (value) => {
|
|
404
|
-
return (0, exports.toNumeric)(value).toFixed(0);
|
|
405
|
-
};
|
|
406
|
-
exports.toIntegerString = toIntegerString;
|
|
407
|
-
const toBigInt = (value) => {
|
|
408
|
-
return BigInt((0, exports.toIntegerString)(value));
|
|
409
|
-
};
|
|
410
|
-
exports.toBigInt = toBigInt;
|
|
411
|
-
const toBN = (value) => {
|
|
412
|
-
return new bn_js_1.default((0, exports.toIntegerString)(value));
|
|
413
|
-
};
|
|
414
|
-
exports.toBN = toBN;
|
|
415
|
-
const toBigInteger = (value) => {
|
|
416
|
-
return (0, big_integer_1.default)((0, exports.toIntegerString)(value));
|
|
417
|
-
};
|
|
418
|
-
exports.toBigInteger = toBigInteger;
|
|
419
|
-
const toBigNumber = (value) => {
|
|
420
|
-
return bignumber_1.BigNumber.from((0, exports.toIntegerString)(value));
|
|
421
|
-
};
|
|
422
|
-
exports.toBigNumber = toBigNumber;
|
|
423
|
-
const createArrayCompareFunction = (ascending = true) => {
|
|
424
|
-
//noinspection JSSuspiciousNameCombination
|
|
425
|
-
return ascending
|
|
426
|
-
? (left, right) => Numeric.sub(left, right).toNumber()
|
|
427
|
-
: (left, right) => Numeric.sub(right, left).toNumber();
|
|
428
|
-
};
|
|
429
|
-
exports.createArrayCompareFunction = createArrayCompareFunction;
|
|
430
|
-
const formatValue = (value, options) => {
|
|
431
|
-
const format = (0, format_number_1.default)(options);
|
|
432
|
-
const text = new Numeric(value).toFixed();
|
|
433
|
-
return format(text);
|
|
434
|
-
};
|
|
435
|
-
exports.formatValue = formatValue;
|
|
436
|
-
const getNumericConfig = () => {
|
|
437
|
-
const { precision, rounding, minE, maxE, toExpNeg, toExpPos, crypto, modulo } = Numeric;
|
|
438
|
-
const data = {
|
|
439
|
-
precision,
|
|
440
|
-
rounding,
|
|
441
|
-
minE,
|
|
442
|
-
maxE,
|
|
443
|
-
toExpNeg,
|
|
444
|
-
toExpPos,
|
|
445
|
-
crypto,
|
|
446
|
-
modulo,
|
|
447
|
-
defaults: false,
|
|
448
|
-
};
|
|
449
|
-
return data;
|
|
450
|
-
};
|
|
451
|
-
exports.getNumericConfig = getNumericConfig;
|
|
452
|
-
const setupNumericConfig = () => {
|
|
453
|
-
const config = {
|
|
454
|
-
precision: 256,
|
|
455
|
-
//rounding: Numeric.ROUND_FLOOR,
|
|
456
|
-
toExpNeg: Numeric.minE,
|
|
457
|
-
toExpPos: Numeric.maxE,
|
|
458
|
-
crypto: false,
|
|
459
|
-
};
|
|
460
|
-
Numeric.set({ defaults: true });
|
|
461
|
-
Numeric.set(config);
|
|
462
|
-
};
|
|
463
|
-
exports.setupNumericConfig = setupNumericConfig;
|
|
464
|
-
exports.NegativeOne = new Numeric(-1);
|
|
465
|
-
exports.Zero = new Numeric(0);
|
|
466
|
-
exports.One = new Numeric(1);
|
|
467
|
-
exports.Two = new Numeric(2);
|
|
468
|
-
exports.WeiPerEther = new Numeric(constants.WeiPerEther);
|
|
469
|
-
exports.MaxUint256 = new Numeric(constants.MaxUint256);
|
|
470
|
-
exports.MaxInt256 = new Numeric(constants.MaxInt256);
|
|
471
|
-
exports.MinInt256 = new Numeric(constants.MinInt256);
|