-
Notifications
You must be signed in to change notification settings - Fork 194
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
Unable to parse values larger than 1.7976931348623157E+308 #25
Comments
Hi @SebastianG77 , your suggestions seem good to me. Would you be able to volunteer to make this change and submit PR? |
Alright, I can fix it, but I am not sure whether I will be able to do it before next weekend. Will send you a pull request as soon as I finished. |
I also ran into this error :/ |
but this error would dissapear with native bignumbers right? @nickkolok do you still get this error in your PR? |
@Almenon I'm afraid no.
|
@Almenon I believe that the appropriate solution is to pass any number-like string to a user-defined function and the deal with the stuff which the function returns. |
Hey guys, I am afraid I might lack of context regarding your discussion, but I also fixed this error in this PR: #26 . I also published my changes to npm (https://www.npmjs.com/package/true-json-bigint) as I needed them at that time. Feel free to try them out and give some feedback. Let me know if your problems still appear while using this package. |
Hi,
when trying to parse a JSON-String which contains a very very big number, I get the following error message: "Bad number". The reason is, that you use isFinite() to check if the number is a finite one. However, according to the specification, Infinity is determined, as following:
"Infinity is displayed when a number exceeds the upper limit of the floating point numbers, which is 1.797693134862315E+308."
As a result, whenever a numeric value that will be parsed is larger than 1.797693134862315E+308, json-bigint is unable to parse the JSON file.
Nevertheless, bignumber.js also has a function isFinite(), which is able to handle values larger than 1.797693134862315E+308. Since from my point of view, this module should be used to parse JSON-files containing any numeric value, I would appreciate if the currently used function isFinite() will be replaced by the function isFinite() of bignumber.js. Find the different results of these function in the following example:
I also added a small example, where you can see the value 3e+500 will not be parsed appropriately with json-bigint. However, when using the standard JSON parser, the value can be parsed, even though the returned value is of course incorrect.
The text was updated successfully, but these errors were encountered: