Flutter Web timetoken big int in javascript - Precision loss in JavaScript when representing large numbers #110
Labels
status: accepted
This issue is accepted as valid, but it's not being worked on yet.
type: bug
This issue reports a bug.
Pubnub uses timestamp in nanoseconds (1 billionth of a second)
For example timetoken = 16819214431624417
I encountered an issue while working with large numbers in JavaScript. Specifically, when attempting to represent the number '16819214431624417', JavaScript is representing it as '16819214431624416', which results in a loss of precision.
After researching this issue, I discovered that this is due to the fact that '16819214431624417' is larger than the safe maximum value that can be accurately represented in JavaScript using the "Number" data type, which is (2^53 - 1) or 9007199254740991.
While there are libraries available, such as BigNumber.js, that can provide an arbitrary-precision number data type for performing calculations with extremely large or small numbers, it would be helpful if there was a built-in solution in JavaScript to handle these types of scenarios.
I believe that this issue is important to address, as it can cause unexpected behavior in JavaScript applications that rely on accurate representations of large numbers.
This issue cause a infinity loop here (Only in Javascript - Flutter Web)
Version package
pubnub: ^4.2.1
The text was updated successfully, but these errors were encountered: