Closed NightlySide closed 2 years ago
The hexadecimal literal is converted to js number and this may cause precision loss, so you need to put it into quotes. Native BigInt does check that although.
The correct way to convert that number is like this:
bigInt("7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee", 16)
using a string and an argument telling what base the number is in, without the 0x
at the beginning.
@peterolson However, looking at the BigInt
Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt
The radius is not needed. If big-integer
can act as a polyfill then shouldn't it provide the same API?
This library is acts as a thin wrapper over the native BigInt if the browser supports it, but it doesn't reproduce the same API. The API is as described in the README of this project.
I'm using "big-integer" as a way to polyfill
BigInt
for react-native (with expo). And everything seems fine except from when a library (I guess libp2p) tries to convert the following number:I get the following error:
For information I have a shim.js file with the following: