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

BigInt support? #201

Open
bpierre opened this issue Oct 5, 2018 · 5 comments
Open

BigInt support? #201

bpierre opened this issue Oct 5, 2018 · 5 comments

Comments

@bpierre
Copy link

bpierre commented Oct 5, 2018

I was wondering if there was any plan to support BigInt when available in the environment?

https://developers.google.com/web/updates/2018/05/bigint

Edit (08-2023): I made this library which I now use for dapps: https://github.com/bpierre/dnum

@douglasb99
Copy link

Really important!

@fanatid
Copy link
Collaborator

fanatid commented Dec 27, 2019

What you like to see as BigInt support? Accept BigInt in constructor/methods?

@douglasb99
Copy link

douglasb99 commented Dec 27, 2019

Basically that or something similar. BigInt is becoming popular. A library I am writing I would like to support it for public methods as a dataype. Internally we use your library and it would be nice if it was super easy to convert between the two so supporting it in the constructor would be useful, or some static method to construct a BN from a BigInt would be great. To BigInt methods would also be very useful.

@jcubic
Copy link

jcubic commented Apr 18, 2020

What about duplicate the library API with BigInt, there is no need to have all the code for operations if you can use native JS operators like add can be just +. It would be awesome to import this thinner library if BigInt have native support.

@alexandrius
Copy link

@jcubic I reimplemented all the methods using BigInt keeping the same API
https://github.com/alexandrius/bn.js-bigint

Major benefits are creating instances and stringifying them, other than that I wouldn't suggest migrating.
Here's the benchmark results:
https://github.com/alexandrius/bn.js-bigint/blob/master/bench.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants