-
Notifications
You must be signed in to change notification settings - Fork 69
/
math.ts
33 lines (25 loc) · 1010 Bytes
/
math.ts
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
import { BigNumber, BigNumberish } from '@liquality/types';
export function add(a: BigNumberish, b: BigNumberish) {
return new BigNumber(a.toString()).plus(b.toString());
}
export function sub(a: BigNumberish, b: BigNumberish) {
return new BigNumber(a.toString()).minus(b.toString());
}
export function mul(a: BigNumberish, b: BigNumberish) {
return new BigNumber(a.toString()).multipliedBy(b.toString());
}
export function div(a: BigNumberish, b: BigNumberish) {
return new BigNumber(a.toString()).dividedBy(b.toString());
}
export function eq(a: BigNumberish, b: BigNumberish) {
return new BigNumber(a.toString()).eq(b.toString());
}
export function lte(a: BigNumberish, b: BigNumberish) {
return new BigNumber(a.toString()).lte(b.toString());
}
export function lt(a: BigNumberish, b: BigNumberish) {
return new BigNumber(a.toString()).lt(b.toString());
}
export function gte(a: BigNumberish, b: BigNumberish) {
return new BigNumber(a.toString()).gte(b.toString());
}