8000 feat: add bigint math · kdt310722/utils@31cab78 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit 31cab78

Browse files
committed
feat: add bigint math
1 parent 5a15b83 commit 31cab78

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/number/bigint.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export const BigIntMath = {
2+
abs: (a: bigint) => (a < 0n ? -a : a),
3+
max: (a: bigint, b: bigint) => (a > b ? a : b),
4+
min: (a: bigint, b: bigint) => (a < b ? a : b),
5+
pow: (a: bigint, b: bigint) => a ** b,
6+
sign: (a: bigint) => (a === 0n ? 0n : (a < 0n ? -1n : 1n)),
7+
}

src/number/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
export * from './bigint'
12
export * from './format'
23
export * from './number'
4+
35
export type * from './types'

0 commit comments

Comments
 (0)
0