Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion] A module that includes BigInt utilities #4553

Open
roj1512 opened this issue Apr 7, 2024 · 0 comments
Open

[Suggestion] A module that includes BigInt utilities #4553

roj1512 opened this issue Apr 7, 2024 · 0 comments
Labels
feedback welcome We want community's feedback on this issue or PR

Comments

@roj1512
Copy link
Contributor

roj1512 commented Apr 7, 2024

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.
@iuioiua iuioiua added the feedback welcome We want community's feedback on this issue or PR label Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback welcome We want community's feedback on this issue or PR
Projects
None yet
Development

No branches or pull requests

2 participants