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

Maximum ID value #17

Closed
austinkloske22 opened this issue Oct 31, 2023 · 2 comments · Fixed by #18
Closed

Maximum ID value #17

austinkloske22 opened this issue Oct 31, 2023 · 2 comments · Fixed by #18
Labels

Comments

@austinkloske22
Copy link

Hello,

The project description says that we are generating 64-bit IDs but I am getting numbers far beyond what I thought 64-bit limits allow.

The unsigned 64-bit integer range should be: 0 - max.
((2^64) - 1 ) = 18446744073709551615

For signed it should be -max to max.
((2^63) -1) = 9223372036854775807

The the readme.md the sample code generates ID = 14755887168818983731200. From a test I ran, I generated 1832785790032599770841743360.

This numbers generated from this lib don't fit into a 64-bit number range. How can this project be used to generate 64-bit Ids?

@AkashRajpurohit
Copy link
Owner

Thanks for reporting this, seems like an issue with how js is dealing with large numbers.
I believe it would be better to simplify the snowflake generation part, will fix this.

Copy link

🎉 This issue has been resolved in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

2 participants