denoland / denoland/std

[Suggestion] A module that includes BigInt utilities

Open
#4,553 0 comments 1 reaction 0 assignees View on GitHub
feedback welcome
Dominant language
TypeScript
Stars
3.6k
Forks
681
PR merge metrics
No merged PRs in 30d

Description

BigInt utilities include, but are not limited to:

- A function that takes in x, y, z, and calculates a (x ** y) % z to power, like Python’s built-in `pow`. Why not just do (x ** y) % z? Because it is really slow for large ints, and there are faster ways.
- A function that converts Uint8Arrays to BigInts (with support for signed BigInts).
- A function that converts BigInts to Uint8Arrays (with support for signed BigInts).
- A function that takes n, and returns a random BigInt that has a maximum byte length of n.
- A function that takes min, max, and returns a random BigInt in that range.
- Alternative to Math.min, Math.max.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.