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

Numbers larger than 32 bits are parsed incorrectly #55

Closed
gilbert opened this issue Dec 15, 2023 · 3 comments
Closed

Numbers larger than 32 bits are parsed incorrectly #55

gilbert opened this issue Dec 15, 2023 · 3 comments
Labels
question Further information is requested

Comments

@gilbert
Copy link

gilbert commented Dec 15, 2023

This code parses all number-looking values as numbers. However, if the number is too large, it gets parsed as a different number. For example, 1735778230747959786 is parsed as 1735778230747959800.

@ljharb
Copy link
Member

ljharb commented Dec 15, 2023

It's not "larger than 32 bits", it's "larger than Number.MAX_SAFE_INTEGER" - and that's just the nature of JavaScript.

@shadowspawn
Copy link
Collaborator

shadowspawn commented Dec 15, 2023

Related, I did some work on this in #18 (as I knew an issue had been reported on the original Minimist repository).

@shadowspawn
Copy link
Collaborator

shadowspawn commented Dec 15, 2023

Did this affect something you were using Minimist for @gilbert , or rather you found the possibility of a lossy conversion?

The work-around for a false positive with a string of digits being inappropriately converted to a number is to specify the option is a string. This can also be done for positionals: #52.

@ljharb ljharb added the question Further information is requested label Mar 2, 2024
@ljharb ljharb closed this as completed Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants